Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
- class Playable a
- data Player = Player {}
- data Team = Team {}
- data GameLength
- data Game a = Game {
- leftSide :: a
- rightSide :: a
- leftScore :: Int
- rightScore :: Int
- gameLength :: GameLength
- serving :: Side
- data Side
- newSinglesGame :: Player -> Player -> GameLength -> Side -> Game Player
- newDoublesGame :: Team -> Team -> GameLength -> Side -> Game Team
- winPoint :: Playable a => Game a -> Side -> Game a
- serviceLength :: GameLength -> Int
- valueOf :: GameLength -> Int
- serviceToChange :: Playable a => Game a -> Bool
- winner :: Playable a => Game a -> Maybe a
- changeService :: Playable a => Game a -> Game a
- swapSides :: Playable a => Game a -> Game a
Documentation
Game | |
|
newSinglesGame :: Player -> Player -> GameLength -> Side -> Game Player Source
New SinglesGame with specified PlayersGameLengthservice Side, scores = 0 with the scores set to 0
newDoublesGame :: Team -> Team -> GameLength -> Side -> Game Team Source
A new DoublesGame with specified TeamsGameLengthserving Side with the scores set to 0
serviceLength :: GameLength -> Int Source
How many serves each player gets according to GameLength
valueOf :: GameLength -> Int Source
Convert GameLength to numerical representation
serviceToChange :: Playable a => Game a -> Bool Source
True if it is another Player/Team's turn to serve
changeService :: Playable a => Game a -> Game a Source
Makes the receiver become the server, rotates the serving side Precondition: we have already determined it is time to change service