Game-class: A Squash Game class

Description Fields Author(s) Examples

Description

Models a Squash game where points a played by sampling from a binomial distribution weighted by the skill of both contenders. Furthermore, a graphical visualization of the game result is provided (see graph).

Fields

players

(list) contains both players/opponents of the game

game_length

(numeric) length of the game

winByTwo

(logical) if TRUE, players must win by two clear points

odds

(numeric) a vector of length two representing the winning odds of player1 vs player2

score_lines

(list) played points are kept internally in two score lines separately for each player

Author(s)

Roman Pahl, roman.pahl@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
set.seed(123)
g1 <- Game(Player("A"), Player("B"))
g1$get_winner()                      # NULL
g1$play()
g1$get_winner()$name                 # "A"
g1$get_score()                       # 11 9
## Not run: 
plot(g1$graph())                      

## End(Not run)

rpahl/Squash documentation built on May 28, 2019, 12:35 a.m.