flip some params around
This commit is contained in:
parent
0a6b03fd69
commit
a9b265fabc
2 changed files with 8 additions and 8 deletions
|
|
@ -20,15 +20,15 @@ data GameBoard mode = MkGameBoard
|
|||
, gameMode :: mode
|
||||
}
|
||||
|
||||
clear :: (GameMode mode) => GameBoard mode -> BoardPosition -> BoardPosition -> Bool
|
||||
clear = undefined
|
||||
clear :: (GameMode mode) => BoardPosition -> BoardPosition -> GameBoard mode -> GameBoard mode
|
||||
|
||||
selectCheck :: (GameMode mode) => GameBoard mode -> BoardPosition -> BoardPosition -> Bool
|
||||
selectCheck board@MkGameBoard{gameMode} topLeft bottomRight =
|
||||
check gameMode (select board topLeft bottomRight)
|
||||
selectCheck :: (GameMode mode) => BoardPosition -> BoardPosition -> GameBoard mode -> Bool
|
||||
selectCheck topLeft bottomRight board@MkGameBoard{gameMode} =
|
||||
check gameMode (select topLeft bottomRight board)
|
||||
|
||||
select :: (GameMode mode) => GameBoard mode -> BoardPosition -> BoardPosition -> [Tile mode]
|
||||
select MkGameBoard{board} topLeft bottomRight =
|
||||
select :: (GameMode mode) => BoardPosition -> BoardPosition -> GameBoard mode -> [Tile mode]
|
||||
select topLeft bottomRight MkGameBoard{board} =
|
||||
mapMaybe (board !) (range (topLeft, bottomRight))
|
||||
|
||||
-- TODO: rewrite this with monadic RNG
|
||||
|
|
|
|||
|
|
@ -25,5 +25,5 @@ spec = describe "gameboard" do
|
|||
displayText gameBoard `shouldBe` "1 2 \n3 4 \n"
|
||||
|
||||
it "validates a move" do
|
||||
selectCheck gameBoard (0, 0) (1, 1) `shouldBe` True
|
||||
selectCheck gameBoard (0, 0) (0, 1) `shouldBe` False
|
||||
selectCheck (0, 0) (1, 1) gameBoard `shouldBe` True
|
||||
selectCheck (0, 0) (0, 1) gameBoard `shouldBe` False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue