cheeky non working commit to save my work

This commit is contained in:
Thorn Avery 2019-05-20 07:37:05 +12:00
parent 394f4b4df1
commit 22bf2d1f48
4 changed files with 57 additions and 6 deletions

View File

@ -10,7 +10,7 @@ conHurt charX charY oldBoardState
{ bsGameLog = (bsGameLog oldBoardState) { bsGameLog = (bsGameLog oldBoardState)
++ [ Right (show charX ++ " is not adjacent to " ++ show charY ++ ", could not hurt") ] ++ [ Right (show charX ++ " is not adjacent to " ++ show charY ++ ", could not hurt") ]
} }
| isAlone charX oldGroups = oldBoardState | isAlone charY oldGroups = oldBoardState
{ bsGameLog = (bsGameLog oldBoardState) { bsGameLog = (bsGameLog oldBoardState)
++ [ Left (show charX ++ " hurt " ++ show charY ++ ", " ++ show charY ++ " is downed") ] ++ [ Left (show charX ++ " hurt " ++ show charY ++ ", " ++ show charY ++ " is downed") ]
, bsNeoTokyo = (bsNeoTokyo oldBoardState) , bsNeoTokyo = (bsNeoTokyo oldBoardState)
@ -35,7 +35,7 @@ conAttract charX charY oldBoardState
{ bsGameLog = (bsGameLog oldBoardState) { bsGameLog = (bsGameLog oldBoardState)
++ [ Right (show charX ++ " is not adjacent to " ++ show charY ++ ", could not attract") ] ++ [ Right (show charX ++ " is not adjacent to " ++ show charY ++ ", could not attract") ]
} }
| isAlone charX oldGroups = oldBoardState | isDowned charX oldDowned = oldBoardState
{ bsGameLog = (bsGameLog oldBoardState) { bsGameLog = (bsGameLog oldBoardState)
++ [ Left (show charX ++ " attracted " ++ show charY ++ ", " ++ show charY ++ " is ready") ] ++ [ Left (show charX ++ " attracted " ++ show charY ++ ", " ++ show charY ++ " is ready") ]
, bsNeoTokyo = (bsNeoTokyo oldBoardState) , bsNeoTokyo = (bsNeoTokyo oldBoardState)

View File

@ -1,10 +1,7 @@
module Groups where module Groups where
import State
import Util import Util
import Cards
import Types import Types
import Data.Either
-- Each characters default adjacents -- Each characters default adjacents
defFrens :: MainCharacter -> [MainCharacter] defFrens :: MainCharacter -> [MainCharacter]
@ -59,7 +56,7 @@ removeFromGroup c g = ( [c] : (groupMinusChar c) : (otherGroups c g) )
joinGroups :: MainCharacter -> MainCharacter -> Groups -> Groups joinGroups :: MainCharacter -> MainCharacter -> Groups -> Groups
joinGroups x y g joinGroups x y g
| x `elem` curFrens y g = g | x `elem` curFrens y g = g
| otherwise = (groupX ++ groupY) : (otherGroups x g) | otherwise = (groupX ++ groupY) : (otherGroups x . otherGroups y) g
where where
groupX = charsGroup x g groupX = charsGroup x g
groupY = charsGroup y g groupY = charsGroup y g

23
Init.hs Normal file
View File

@ -0,0 +1,23 @@
module Init where
import Types
import Cards
initBS = BoardState
{ bsNeoTokyo = NeoTokyo
{ ntGroups = [ [Shinji], [Asuka], [Rei], [Misato], [Ritsuko], [Gendo] ]
, ntEvas = [ UnitZero, UnitOne, UnitTwo ]
, ntAngels = []
, ntPutCards = []
, ntDowned = []
}
, bsPlayerLib =
[ (1, ("tA", [ S02_Asuka, S02_Asuka, S01_Shinji ], [], []))
, (2, ("lunarised", [ S03_Rei, S03_Rei, S01_Shinji, S05_Ritsuko ], [], []))
]
, bsActivePlayers = [1,2]
, bsPriorityPlayer = 1
, bsCardStack = []
, bsCardLib = gCardLib
, bsGameLog = []
}

31
Print.hs Normal file
View File

@ -0,0 +1,31 @@
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 -> "<ERROR> : " ++ e)
(bsGameLog bs)
putStrLn " ================="
where
groups = (ntGroups . bsNeoTokyo) bs
concatGroup x = concat $ intersperse ", " (map show x)