diff options
-rw-r--r-- | Game.hs | 14 | ||||
-rw-r--r-- | Main.hs | 4 |
2 files changed, 9 insertions, 9 deletions
@@ -17,17 +17,17 @@ data Game = Game { players :: [Player] } -- | Begin new round of game. -nextRound :: Int -> Game -> IO Game -nextRound n game = do +beginRounds :: Int -> Game -> IO Game +beginRounds n game = do if n == 0 then return game else do - game' <- nextTurn game - nextRound (n - 1) game' + game' <- beginTurn game + beginRounds (n - 1) game' -- | Let current player take their turn. -nextTurn :: Game -> IO Game -nextTurn game@(Game plyrs pidx att dir stock disc) = do +beginTurn :: Game -> IO Game +beginTurn game@(Game plyrs pidx att dir stock disc) = do putStrLn $ replicate 80 '-' putStrLn $ "Current attack: " ++ show att decision <- prompt game @@ -66,7 +66,7 @@ nextTurn game@(Game plyrs pidx att dir stock disc) = do if null $ P.cards player' then return game' - else nextTurn game' + else beginTurn game' -- | Prompt player to play a card (or draw card and skip turn). prompt :: Game -> IO (Maybe Card) @@ -9,7 +9,7 @@ import Game (Game(..), discardPile, prompt, dealCards, - nextRound, + beginRounds, ) import Player (Player(..)) import qualified Player as P @@ -33,5 +33,5 @@ main = do , discardPile = discard } - nextRound 1 $ dealCards 6 game + beginRounds 1 $ dealCards 6 game print () |