Home | History | Annotate | Download | only in codewalk

Lines Matching defs:score

13 	win            = 100 // The winning score in a game of Pig
17 // A score includes scores accumulated in previous turns for each player,
19 type score struct {
23 // An action transitions stochastically to a resulting score.
24 type action func(current score) (result score, turnIsOver bool)
27 // If the roll value is 1, then thisTurn score is abandoned, and the players'
29 func roll(s score) (score, bool) {
32 return score{s.opponent, s.player, 0}, true
34 return score{s.player, s.opponent, outcome + s.thisTurn}, false
38 // thisTurn score is added to the player's score, and the players' roles swap.
39 func stay(s score) (score, bool) {
40 return score{s.opponent, s.player + s.thisTurn, 0}, true
43 // A strategy chooses an action for any given score.
44 type strategy func(score) action
48 return func(s score) action {
59 var s score