2019-05-19 15:37:05 -04:00
|
|
|
module Print where
|
|
|
|
|
|
|
|
import Types
|
|
|
|
import Groups
|
|
|
|
import Data.List
|
|
|
|
import Data.Either
|
|
|
|
|
|
|
|
printState :: BoardState -> IO ()
|
|
|
|
printState bs = do
|
|
|
|
putStrLn "== BOARD STATE =="
|
|
|
|
putStrLn " - Groups -"
|
2019-05-19 18:39:43 -04:00
|
|
|
mapM_ putStrLn $ let zipGroups = zip ['A', 'B'.. ] groups in
|
|
|
|
map
|
|
|
|
(\(id, x) -> [id] ++ " ~ [ " ++ concatGroup x ++ " ] <-> "
|
|
|
|
++
|
|
|
|
(map fst $ filter (\(id,y) -> y `elem` (neighborGroups x groups)) zipGroups)
|
|
|
|
) zipGroups
|
2019-05-19 15:37:05 -04:00
|
|
|
putStrLn " - Downed -"
|
|
|
|
mapM_ putStrLn $ map
|
2019-05-19 18:39:43 -04:00
|
|
|
(\x -> "~ " ++ show x) $ (ntDowned . bsNeoTokyo) bs
|
2019-05-19 15:37:05 -04:00
|
|
|
putStrLn " - GameLog -"
|
|
|
|
mapM_ putStrLn $ map
|
|
|
|
(\x ->
|
|
|
|
case x of
|
|
|
|
Left m -> m
|
|
|
|
Right e -> "<ERROR> : " ++ e)
|
|
|
|
(bsGameLog bs)
|
|
|
|
putStrLn " ================="
|
|
|
|
where
|
|
|
|
groups = (ntGroups . bsNeoTokyo) bs
|
|
|
|
concatGroup x = concat $ intersperse ", " (map show x)
|