31 lines
862 B
Haskell
31 lines
862 B
Haskell
module Print where
|
|
|
|
import Types
|
|
import Groups
|
|
import Data.List
|
|
|
|
printState :: BoardState -> IO ()
|
|
printState bs = do
|
|
putStrLn "== BOARD STATE =="
|
|
putStrLn " - Groups -"
|
|
mapM_ putStrLn $ let zipGroups = zip ['A', 'B'.. ] groups in
|
|
map
|
|
(\(gid, x) -> [gid] ++ " ~ [ " ++ concatGroup x ++ " ] <-> "
|
|
++
|
|
(map fst $ filter (\(_,y) -> y `elem` (neighborGroups x groups)) zipGroups)
|
|
) zipGroups
|
|
putStrLn " - Downed -"
|
|
mapM_ putStrLn $ map
|
|
(\x -> "~ " ++ show x) $ (ntDowned . bsNeoTokyo) bs
|
|
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)
|