module Print where import Types import Groups import Data.List import Data.Either printState :: BoardState -> IO () printState bs = do putStrLn "== BOARD STATE ==" putStrLn " - Groups -" mapM_ putStrLn $ let zipGroup = zip ['A' ... ] groups in map (\(id, x) -> id ++ " ~ [ " ++ concatGroup x ++ " ] <-> " concatGroup x $ map snd $ filter (\(id,y) -> foldr (||) False (map (\z -> (any x) (getAdj z groups)) y) groups) zipGroup (\(id, x) -> foldr (||) False (map (== x `elem` $ zipGroup putStrLn " - Downed -" mapM_ putStrLn $ map (\x -> "~ " ++ show x) $ groups putStrLn " - GameLog -" mapM_ putStrLn $ map (\x -> case x of Left m -> m Right e -> " : " ++ e) (bsGameLog bs) putStrLn " =================" where groups = (ntGroups . bsNeoTokyo) bs concatGroup x = concat $ intersperse ", " (map show x)