diff options
author | Erin van der Veen | 2017-09-18 14:43:12 +0200 |
---|---|---|
committer | Erin van der Veen | 2017-09-18 14:43:12 +0200 |
commit | 9e607528c644ab29b282735af909812a2e55ff31 (patch) | |
tree | 2bfd5f7bfba6042f5e814375baaa434262438dc1 /src/runchess.hs | |
parent | Add 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.hs | 7 |
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 |