summaryrefslogtreecommitdiff
path: root/src/runchess.hs
diff options
context:
space:
mode:
authorErin van der Veen2017-09-18 14:43:12 +0200
committerErin van der Veen2017-09-18 14:43:12 +0200
commit9e607528c644ab29b282735af909812a2e55ff31 (patch)
tree2bfd5f7bfba6042f5e814375baaa434262438dc1 /src/runchess.hs
parentAdd wrapper source code (diff)
Print every state in the game; Create 1 manual test; Remove *.out from .gitignore
Diffstat (limited to 'src/runchess.hs')
-rw-r--r--src/runchess.hs7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/runchess.hs b/src/runchess.hs
index 5854e57..d1a86d2 100644
--- a/src/runchess.hs
+++ b/src/runchess.hs
@@ -21,17 +21,14 @@ readPGN = do
Right games -> return games
applyPGN :: PGN -> IO ()
-applyPGN pgn = mapM_ printBoard (seqList [moveSAN m | m <- moves pgn] $ Right defaultBoard)
+applyPGN pgn = printPGN pgn >> mapM_ printBoard (seqList [moveSAN m | m <- moves pgn] $ Right defaultBoard)
where
seqList (f:fs) (Right io) = f io:seqList fs (f io)
seqList _ (Left _) = []
seqList [] _ = []
-printGame :: Either MoveError Board -> PGN -> IO ()
-printGame b pgn = printPGN pgn >> printBoard b
-
printBoard (Left e) = putStrLn $ show e
-printBoard (Right b) = putStr $ show b
+printBoard (Right b) = putStrLn $ show b
printPGN :: PGN -> IO ()
printPGN pgn = do