fix makeMove
This commit is contained in:
parent
c49b5b2540
commit
57579fa5e4
1 changed files with 8 additions and 4 deletions
12
src/Game.hs
12
src/Game.hs
|
|
@ -10,7 +10,11 @@ makeMove :: (GameMode mode) => PlayerIndex -> BoardAction -> GameState mode -> G
|
||||||
makeMove (MkPlayerIndex idx) (SelectSquare topLeft bottomRight) state@MkGameState{board} =
|
makeMove (MkPlayerIndex idx) (SelectSquare topLeft bottomRight) state@MkGameState{board} =
|
||||||
let tiles = select topLeft bottomRight board
|
let tiles = select topLeft bottomRight board
|
||||||
gMode = gameMode board
|
gMode = gameMode board
|
||||||
in if check gMode tiles
|
transform =
|
||||||
then
|
if check gMode tiles
|
||||||
over (#players % (ix idx) % #score) (+ 1) state
|
-- add one to player score
|
||||||
else state
|
-- TODO: add the proper score here
|
||||||
|
then over (#players % (ix idx) % #score) (+ 1)
|
||||||
|
-- invalid move, do nothing
|
||||||
|
else id
|
||||||
|
in transform state
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue