board-games 0.1.0.2 → 0.1.0.3
raw patch · 2 files changed
+14/−14 lines, 2 filesdep ~cgidep ~transformers
Dependency ranges changed: cgi, transformers
Files
- board-games.cabal +3/−3
- src/Game/Mastermind.hs +11/−11
board-games.cabal view
@@ -1,5 +1,5 @@ Name: board-games-Version: 0.1.0.2+Version: 0.1.0.3 License: GPL License-File: LICENSE Author: Henning Thielemann <haskell@henning-thielemann.de>@@ -44,9 +44,9 @@ Library Build-Depends: html >=1.0 && <1.1,- cgi >=3001.1 && <3001.3,+ cgi >=3001.1 && <3002, utility-ht >=0.0.3 && <0.1,- transformers >=0.2.2 && <0.5+ transformers >=0.2.2 && <0.6 If flag(splitBase) Build-Depends: containers >=0.2 && <0.6,
src/Game/Mastermind.hs view
@@ -102,19 +102,18 @@ remaining :: (CodeSet.C set, Ord a) => Set.Set a -> [a] -> Eval -> set a-remaining alphabet code0 (Eval rightPlaces rightSymbols0) =+remaining alphabet = let findCodes = foldr (\(fixed,c) go rightSymbols floating0 -> if fixed then c #*& go rightSymbols floating0 else- (if rightSymbols == 0- then empty- else unions $ do- (src, floating1) <- selectFromHistogram floating0- guard (c /= src)- return $ src #*& go (rightSymbols-1) floating1)+ (unions $ do+ guard (rightSymbols > 0)+ (src, floating1) <- selectFromHistogram floating0+ guard (c /= src)+ return $ src #*& go (rightSymbols-1) floating1) `union` (Set.difference (Set.delete c alphabet)@@ -124,13 +123,14 @@ if rightSymbols>0 then empty else unit)- in unions $+ in \code (Eval rightPlaces rightSymbols) ->+ unions $ map (\pattern ->- let patternCode = zip pattern code0- in findCodes patternCode rightSymbols0 $+ let patternCode = zip pattern code+ in findCodes patternCode rightSymbols $ histogram $ map snd $ filter (not . fst) patternCode) $- possibleRightPlaces (length code0) rightPlaces+ possibleRightPlaces (length code) rightPlaces partitionSizes :: (Ord a) => Set.Set a -> [a] -> [(Eval, Integer)]