packages feed

board-games 0.4 → 0.4.0.1

raw patch · 5 files changed

+99/−75 lines, 5 filesdep ~parallel

Dependency ranges changed: parallel

Files

board-games.cabal view
@@ -1,5 +1,5 @@ Name:             board-games-Version:          0.4+Version:          0.4.0.1 License:          GPL License-File:     LICENSE Author:           Henning Thielemann <haskell@henning-thielemann.de>@@ -44,7 +44,7 @@   location: http://code.haskell.org/~thielema/games/  Source-Repository this-  tag:      0.4+  tag:      0.4.0.1   type:     darcs   location: http://code.haskell.org/~thielema/games/ @@ -70,8 +70,8 @@     QuickCheck >2.0 && <3.0   If flag(splitBase)     Build-Depends:-      containers >=0.2 && <0.7,-      random >=1.0 && <1.3,+      containers >=0.2 && <0.9,+      random >=1.0 && <1.4,       array >=0.1 && <0.6,       base >= 2 && <5   Else@@ -158,7 +158,7 @@   Build-Depends:     board-games,     QuickCheck,-    parallel >=3.2.1 && <3.3,+    parallel >=3.2.1 && <3.4,     transformers,     enummapset,     containers,
src/Game/Labyrinth.hs view
@@ -1,6 +1,7 @@ module Game.Labyrinth where  import qualified System.Random as Rnd+import qualified System.IO as IO import Game.Utility (randomSelect)  import qualified Graphics.Ascii.Haha.Terminal as ANSI@@ -836,8 +837,8 @@  inputLoop :: (String -> ME.Exceptional String a) -> IO a inputLoop parse =-   ME.switch (\msg -> putStrLn msg >> inputLoop parse) return . parse-      =<< getLine+   let go = ME.switch (\msg -> putStrLn msg >> go) return . parse =<< getLine+   in IO.hFlush IO.stdout >> go  playerCharSet :: EnumSet Char playerCharSet = EnumSet.fromList $ map (playerChar True) allEnums
test/Test/Game/Labyrinth.hs view
@@ -1,52 +1,60 @@ -- Do not edit! Automatically created with doctest-extract from src/Game/Labyrinth.hs-{-# LINE 50 "src/Game/Labyrinth.hs" #-}+{-# LINE 51 "src/Game/Labyrinth.hs" #-}  module Test.Game.Labyrinth where  import qualified Test.DocTest.Driver as DocTest -{-# LINE 51 "src/Game/Labyrinth.hs" #-}+{-# LINE 52 "src/Game/Labyrinth.hs" #-} import     qualified Game.Labyrinth as Labyrinth  test :: DocTest.T () test = do- DocTest.printPrefix "Game.Labyrinth:137: "-{-# LINE 137 "src/Game/Labyrinth.hs" #-}- DocTest.property-{-# LINE 137 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.shiftRowLeft k (Labyrinth.shiftRowRight k b))  DocTest.printPrefix "Game.Labyrinth:138: " {-# LINE 138 "src/Game/Labyrinth.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 138 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.shiftRowRight k (Labyrinth.shiftRowLeft k b))- DocTest.printPrefix "Game.Labyrinth:153: "-{-# LINE 153 "src/Game/Labyrinth.hs" #-}- DocTest.property-{-# LINE 153 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.shiftColumnUp k (Labyrinth.shiftColumnDown k b))+      \k b -> b == Labyrinth.shiftRowLeft k (Labyrinth.shiftRowRight k b)+  )+ DocTest.printPrefix "Game.Labyrinth:139: "+{-# LINE 139 "src/Game/Labyrinth.hs" #-}+ DocTest.property(+{-# LINE 139 "src/Game/Labyrinth.hs" #-}+      \k b -> b == Labyrinth.shiftRowRight k (Labyrinth.shiftRowLeft k b)+  )  DocTest.printPrefix "Game.Labyrinth:154: " {-# LINE 154 "src/Game/Labyrinth.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 154 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.shiftColumnDown k (Labyrinth.shiftColumnUp k b))- DocTest.printPrefix "Game.Labyrinth:202: "-{-# LINE 202 "src/Game/Labyrinth.hs" #-}- DocTest.property-{-# LINE 202 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.cycleRowLeft k (Labyrinth.cycleRowRight k b))+      \k b -> b == Labyrinth.shiftColumnUp k (Labyrinth.shiftColumnDown k b)+  )+ DocTest.printPrefix "Game.Labyrinth:155: "+{-# LINE 155 "src/Game/Labyrinth.hs" #-}+ DocTest.property(+{-# LINE 155 "src/Game/Labyrinth.hs" #-}+      \k b -> b == Labyrinth.shiftColumnDown k (Labyrinth.shiftColumnUp k b)+  )  DocTest.printPrefix "Game.Labyrinth:203: " {-# LINE 203 "src/Game/Labyrinth.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 203 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.cycleRowRight k (Labyrinth.cycleRowLeft k b))- DocTest.printPrefix "Game.Labyrinth:212: "-{-# LINE 212 "src/Game/Labyrinth.hs" #-}- DocTest.property-{-# LINE 212 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.cycleColumnUp k (Labyrinth.cycleColumnDown k b))+      \k b -> b == Labyrinth.cycleRowLeft k (Labyrinth.cycleRowRight k b)+  )+ DocTest.printPrefix "Game.Labyrinth:204: "+{-# LINE 204 "src/Game/Labyrinth.hs" #-}+ DocTest.property(+{-# LINE 204 "src/Game/Labyrinth.hs" #-}+      \k b -> b == Labyrinth.cycleRowRight k (Labyrinth.cycleRowLeft k b)+  )  DocTest.printPrefix "Game.Labyrinth:213: " {-# LINE 213 "src/Game/Labyrinth.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 213 "src/Game/Labyrinth.hs" #-}-     (\k b -> b == Labyrinth.cycleColumnDown k (Labyrinth.cycleColumnUp k b))+      \k b -> b == Labyrinth.cycleColumnUp k (Labyrinth.cycleColumnDown k b)+  )+ DocTest.printPrefix "Game.Labyrinth:214: "+{-# LINE 214 "src/Game/Labyrinth.hs" #-}+ DocTest.property(+{-# LINE 214 "src/Game/Labyrinth.hs" #-}+      \k b -> b == Labyrinth.cycleColumnDown k (Labyrinth.cycleColumnUp k b)+  )
test/Test/Game/Mastermind.hs view
@@ -21,63 +21,75 @@ test = do  DocTest.printPrefix "Game.Mastermind:74: " {-# LINE 74 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 74 "src/Game/Mastermind.hs" #-}-     (\(CodePair secret attempt) -> MM.evaluate secret attempt == MM.evaluate attempt secret)+      \(CodePair secret attempt) -> MM.evaluate secret attempt == MM.evaluate attempt secret+  )+ DocTest.printPrefix "Game.Mastermind:128: "+{-# LINE 128 "src/Game/Mastermind.hs" #-}+ DocTest.example(+{-# LINE 128 "src/Game/Mastermind.hs" #-}+    filter ((MM.Eval 2 0 ==) . MM.evaluate "aabbb") $ replicateM 5 ['a'..'c']+  )+  [ExpectedLine [LineChunk "[\"aaaaa\",\"aaaac\",\"aaaca\",\"aaacc\",\"aacaa\",\"aacac\",\"aacca\",\"aaccc\",\"acbcc\",\"accbc\",\"acccb\",\"cabcc\",\"cacbc\",\"caccb\",\"ccbbc\",\"ccbcb\",\"cccbb\"]"]]+ DocTest.printPrefix "Game.Mastermind:130: "+{-# LINE 130 "src/Game/Mastermind.hs" #-}+ DocTest.example(+{-# LINE 130 "src/Game/Mastermind.hs" #-}+    CodeSet.flatten (MM.matching (EnumSet.fromList ['a'..'c']) "aabbb" (Eval 2 0) :: CodeSetTree.T Char)+  )+  [ExpectedLine [LineChunk "[\"aaaaa\",\"aaaac\",\"aaaca\",\"aaacc\",\"aacaa\",\"aacac\",\"aacca\",\"aaccc\",\"acbcc\",\"accbc\",\"acccb\",\"cabcc\",\"cacbc\",\"caccb\",\"ccbbc\",\"ccbcb\",\"cccbb\"]"]]  DocTest.printPrefix "Game.Mastermind:133: " {-# LINE 133 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 133 "src/Game/Mastermind.hs" #-}-     (\(CodePair secret attempt) -> CodeSetTree.member secret $ MM.matching alphabet attempt (MM.evaluate secret attempt))+      \(CodePair secret attempt) -> CodeSetTree.member secret $ MM.matching alphabet attempt (MM.evaluate secret attempt)+  )  DocTest.printPrefix "Game.Mastermind:134: " {-# LINE 134 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 134 "src/Game/Mastermind.hs" #-}-     (\(CodePair secret attempt) -> forAllEval secret $ \eval -> (eval == MM.evaluate secret attempt) == CodeSetTree.member secret (MM.matching alphabet attempt eval))+      \(CodePair secret attempt) -> forAllEval secret $ \eval -> (eval == MM.evaluate secret attempt) == CodeSetTree.member secret (MM.matching alphabet attempt eval)+  )  DocTest.printPrefix "Game.Mastermind:135: " {-# LINE 135 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 135 "src/Game/Mastermind.hs" #-}-     (\(Code attempt) -> forAllEval attempt $ \eval0 -> forAllEval attempt $ \eval1 -> eval0 == eval1 || CodeSetTree.null (compose2 CodeSetTree.intersection (MM.matching alphabet attempt) eval0 eval1))+      \(Code attempt) -> forAllEval attempt $ \eval0 -> forAllEval attempt $ \eval1 -> eval0 == eval1 || CodeSetTree.null (compose2 CodeSetTree.intersection (MM.matching alphabet attempt) eval0 eval1)+  )  DocTest.printPrefix "Game.Mastermind:136: " {-# LINE 136 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 136 "src/Game/Mastermind.hs" #-}-     (\(Code attempt) -> forAllEval attempt $ \eval -> all ((eval ==) . MM.evaluate attempt) $ take 100 $ CodeSet.flatten $ (MM.matching alphabet attempt eval :: CodeSetInt))+      \(Code attempt) -> forAllEval attempt $ \eval -> all ((eval ==) . MM.evaluate attempt) $ take 100 $ CodeSet.flatten $ (MM.matching alphabet attempt eval :: CodeSetInt)+  )  DocTest.printPrefix "Game.Mastermind:137: " {-# LINE 137 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 137 "src/Game/Mastermind.hs" #-}-     (\(Code attempt) -> forAllEval attempt $ \eval -> let set :: CodeSetInt; set = MM.matching alphabet attempt eval in map (CodeSet.select set) [0 .. min 100 (CodeSet.size set) - 1] == take 100 (CodeSet.flatten set))+      \(Code attempt) -> forAllEval attempt $ \eval -> let set :: CodeSetInt; set = MM.matching alphabet attempt eval in map (CodeSet.select set) [0 .. min 100 (CodeSet.size set) - 1] == take 100 (CodeSet.flatten set)+  )  DocTest.printPrefix "Game.Mastermind:138: " {-# LINE 138 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 138 "src/Game/Mastermind.hs" #-}-     (TestMM.intersections)+      TestMM.intersections+  )  DocTest.printPrefix "Game.Mastermind:139: " {-# LINE 139 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 139 "src/Game/Mastermind.hs" #-}-     (TestMM.solve)- DocTest.printPrefix "Game.Mastermind:128: "-{-# LINE 128 "src/Game/Mastermind.hs" #-}- DocTest.example-{-# LINE 128 "src/Game/Mastermind.hs" #-}-   (filter ((MM.Eval 2 0 ==) . MM.evaluate "aabbb") $ replicateM 5 ['a'..'c'])-  [ExpectedLine [LineChunk "[\"aaaaa\",\"aaaac\",\"aaaca\",\"aaacc\",\"aacaa\",\"aacac\",\"aacca\",\"aaccc\",\"acbcc\",\"accbc\",\"acccb\",\"cabcc\",\"cacbc\",\"caccb\",\"ccbbc\",\"ccbcb\",\"cccbb\"]"]]- DocTest.printPrefix "Game.Mastermind:130: "-{-# LINE 130 "src/Game/Mastermind.hs" #-}- DocTest.example-{-# LINE 130 "src/Game/Mastermind.hs" #-}-   (CodeSet.flatten (MM.matching (EnumSet.fromList ['a'..'c']) "aabbb" (Eval 2 0) :: CodeSetTree.T Char))-  [ExpectedLine [LineChunk "[\"aaaaa\",\"aaaac\",\"aaaca\",\"aaacc\",\"aacaa\",\"aacac\",\"aacca\",\"aaccc\",\"acbcc\",\"accbc\",\"acccb\",\"cabcc\",\"cacbc\",\"caccb\",\"ccbbc\",\"ccbcb\",\"cccbb\"]"]]+      TestMM.solve+  )  DocTest.printPrefix "Game.Mastermind:180: " {-# LINE 180 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 180 "src/Game/Mastermind.hs" #-}-     (\(Code attempt) -> fromIntegral (EnumSet.size alphabet) ^ length attempt == sum (map snd (MM.partitionSizes alphabet attempt)))+      \(Code attempt) -> fromIntegral (EnumSet.size alphabet) ^ length attempt == sum (map snd (MM.partitionSizes alphabet attempt))+  )  DocTest.printPrefix "Game.Mastermind:250: " {-# LINE 250 "src/Game/Mastermind.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 250 "src/Game/Mastermind.hs" #-}-     (TestMM.bestSeparatingCode)+      TestMM.bestSeparatingCode+  )
test/Test/Game/Utility.hs view
@@ -12,16 +12,19 @@ test = do  DocTest.printPrefix "Game.Utility:58: " {-# LINE 58 "private/Game/Utility.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 58 "private/Game/Utility.hs" #-}-     (\a -> a == mergeChoice noChoice (a :: Choice Char))+      \a -> a == mergeChoice noChoice (a :: Choice Char)+  )  DocTest.printPrefix "Game.Utility:59: " {-# LINE 59 "private/Game/Utility.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 59 "private/Game/Utility.hs" #-}-     (\a -> a == mergeChoice a (noChoice :: Choice Char))+      \a -> a == mergeChoice a (noChoice :: Choice Char)+  )  DocTest.printPrefix "Game.Utility:60: " {-# LINE 60 "private/Game/Utility.hs" #-}- DocTest.property+ DocTest.property( {-# LINE 60 "private/Game/Utility.hs" #-}-     (\a b -> mergeChoice a b == mergeChoice b (a :: Choice Char))+      \a b -> mergeChoice a b == mergeChoice b (a :: Choice Char)+  )