A game result is one of
- Player 1 wins
- Player 2 wins
- Neither player wins (draw)
- data GameResult
- gameResult :: (Player -> x) -> x -> GameResult -> x
- playerGameResult :: x -> x -> x -> GameResult -> x
- win :: Player -> GameResult
- player1Wins :: GameResult
- player2Wins :: GameResult
- draw :: GameResult
- isPlayer1Wins :: GameResult -> Bool
- isPlayer2Wins :: GameResult -> Bool
- isDraw :: GameResult -> Bool
Documentation
Reduction (fold)
:: (Player -> x) | If either of the players won. |
-> x | If the game was a draw. |
-> GameResult | The game result to fold. |
-> x |
Fold a game result.
:: x | If player 1 won. |
-> x | If player 2 won. |
-> x | If the game was a draw. |
-> GameResult | The game result to fold. |
-> x |
Fold a game result.
Construction
:: Player | The player to win. |
-> GameResult |
Construct a game result with a win for the given player.
player1Wins :: GameResultSource
Construct a game result with a win for player 1.
player2Wins :: GameResultSource
Construct a game result with a win for player 2.
Construct a game result that is a draw.
Decisions
isPlayer1Wins :: GameResult -> BoolSource
Returns whether or not player 1 won for the game result.
isPlayer2Wins :: GameResult -> BoolSource
Returns whether or not player 2 won for the game result.
isDraw :: GameResult -> BoolSource
Returns whether the game result is a draw.