From 9e607528c644ab29b282735af909812a2e55ff31 Mon Sep 17 00:00:00 2001 From: Erin van der Veen Date: Mon, 18 Sep 2017 14:43:12 +0200 Subject: Print every state in the game; Create 1 manual test; Remove *.out from .gitignore --- src/runchess.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src') 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 -- cgit v1.2.3