summaryrefslogtreecommitdiff
path: root/Game.hs
diff options
context:
space:
mode:
authorFrederick Yin <fkfd@fkfd.me>2023-01-08 20:11:30 +0800
committerFrederick Yin <fkfd@fkfd.me>2023-01-08 20:11:30 +0800
commitc50c43698af9b4291f1e63154d19123ed89b8f10 (patch)
tree76a2b30bd23c888903310d944e3ba0d002560629 /Game.hs
parent1e336424e1c661303fed2a4d4e58915bf267bb55 (diff)
beginRounds and beginTurn are better names
Diffstat (limited to 'Game.hs')
-rw-r--r--Game.hs14
1 files changed, 7 insertions, 7 deletions
diff --git a/Game.hs b/Game.hs
index 7c5c8ba..816a65c 100644
--- a/Game.hs
+++ b/Game.hs
@@ -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)