fix makeMove

This commit is contained in:
Sidharth Kulkarni 2026-05-09 20:16:48 -07:00
parent c49b5b2540
commit 57579fa5e4
Signed by: skulk
SSH key fingerprint: SHA256:Jby+S9d1WmwqnXIrngHgccYNHz+cYquxN1zm3ym3Kbg

View file

@ -10,7 +10,11 @@ makeMove :: (GameMode mode) => PlayerIndex -> BoardAction -> GameState mode -> G
makeMove (MkPlayerIndex idx) (SelectSquare topLeft bottomRight) state@MkGameState{board} =
let tiles = select topLeft bottomRight board
gMode = gameMode board
in if check gMode tiles
then
over (#players % (ix idx) % #score) (+ 1) state
else state
transform =
if check gMode tiles
-- add one to player score
-- TODO: add the proper score here
then over (#players % (ix idx) % #score) (+ 1)
-- invalid move, do nothing
else id
in transform state