table-tennis-0.1.0.3: A table tennis game tracking engine

Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.TableTennis

Synopsis

Documentation

class Playable a Source

Minimal complete definition

rotateSide

data Player Source

Constructors

Player 

Fields

name :: String
 
handicap :: Int
 

data Team Source

Constructors

Team 

Instances

data GameLength Source

Constructors

Eleven 
TwentyOne 

Instances

data Game a Source

Constructors

Game 

Instances

Show a => Show (Game a) 

data Side Source

Constructors

LeftSide 
RightSide 

Instances

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

winPoint :: Playable a => Game a -> Side -> Game a Source

Add a point to the specified Side's score

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

winner :: Playable a => Game a -> Maybe a Source

The winner of a Game or Nothing if nobody has won

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

swapSides :: Playable a => Game a -> Game a Source

Exchange sides of the table (typically after a Game is won)