|
2 | 2 |
|
3 | 3 | This Refactoring Kata was designed by Jon Jagger and is available in his Cyber-Dojo. See [his blog post](http://jonjagger.blogspot.co.uk/2012/05/yahtzee-cyber-dojo-refactoring-in-java.html)
|
4 | 4 |
|
5 |
| -The other language translations have been contributed by: |
| 5 | +I have changed it a little, so that the rules more closely match the original game. |
6 | 6 |
|
7 |
| -Python: Emily Bache |
| 7 | +The other language translations have been contributed by: |
8 | 8 |
|
9 |
| -Ruby: Kim Persson and Lennart Fridén |
| 9 | +- Python: Emily Bache |
| 10 | +- Ruby: Kim Persson and Lennart Fridén |
10 | 11 |
|
11 | 12 | ## Kata: Yahtzee rules
|
12 | 13 |
|
@@ -43,74 +44,85 @@ highest scoring category for a given roll.
|
43 | 44 |
|
44 | 45 | ## Kata: Yahzee Categories and Scoring Rules
|
45 | 46 |
|
46 |
| -_Note these rules differ from the original (copyrighted) rules_ |
47 |
| - |
48 |
| -Chance: |
49 |
| - The player scores the sum of all dice, |
50 |
| - no matter what they read. |
51 |
| - For example, |
52 |
| - 1,1,3,3,6 placed on "chance" scores 14 (1+1+3+3+6) |
53 |
| - 4,5,5,6,1 placed on "chance" scores 21 (4+5+5+6+1) |
54 |
| - |
55 |
| -Yahtzee: |
56 |
| - If all dice have the same number, |
57 |
| - the player scores 50 points. |
58 |
| - For example, |
59 |
| - 1,1,1,1,1 placed on "yahtzee" scores 50 |
60 |
| - 1,1,1,2,1 placed on "yahtzee" scores 0 |
61 |
| - |
62 |
| -Ones, Twos, Threes, Fours, Fives, Sixes: |
63 |
| - The player scores the sum of the dice that reads one, |
64 |
| - two, three, four, five or six, respectively. |
65 |
| - For example, |
66 |
| - 1,1,2,4,4 placed on "fours" scores 8 (4+4) |
67 |
| - 2,3,2,5,1 placed on "twos" scores 4 (2+2) |
68 |
| - 3,3,3,4,5 placed on "ones" scores 0 |
69 |
| - |
70 |
| -Pair: |
71 |
| - The player scores the sum of the two highest matching dice. |
72 |
| - For example, when placed on "pair" |
73 |
| - 3,3,3,4,4 scores 8 (4+4) |
74 |
| - 1,1,6,2,6 scores 12 (6+6) |
75 |
| - 3,3,3,4,1 scores 0 |
76 |
| - 3,3,3,3,1 scores 0 |
77 |
| - |
78 |
| -Two pairs: |
79 |
| - If there are two pairs of dice with the same number, the |
80 |
| - player scores the sum of these dice. |
81 |
| - For example, when placed on "two pairs" |
82 |
| - 1,1,2,3,3 scores 8 (1+1+3+3) |
83 |
| - 1,1,2,3,4 scores 0 |
84 |
| - 1,1,2,2,2 scores 0 |
85 |
| - |
86 |
| -Three of a kind: |
87 |
| - If there are three dice with the same number, the player |
88 |
| - scores the sum of these dice. |
89 |
| - For example, when placed on "three of a kind" |
90 |
| - 3,3,3,4,5 scores 9 (3+3+3) |
91 |
| - 3,3,4,5,6 scores 0 |
92 |
| - 3,3,3,3,1 scores 0 |
93 |
| - |
94 |
| -Four of a kind: |
95 |
| - If there are four dice with the same number, the player |
96 |
| - scores the sum of these dice. |
97 |
| - For example, when placed on "four of a kind" |
98 |
| - 2,2,2,2,5 scores 8 (2+2+2+2) |
99 |
| - 2,2,2,5,5 scores 0 |
100 |
| - 2,2,2,2,2 scores 0 |
101 |
| - |
102 |
| -Small straight: |
103 |
| - When placed on "small straight", if the dice read |
104 |
| - 1,2,3,4,5, the player scores 15 (the sum of all the dice. |
105 |
| - |
106 |
| -Large straight: |
107 |
| - When placed on "large straight", if the dice read |
108 |
| - 2,3,4,5,6, the player scores 20 (the sum of all the dice). |
109 |
| - |
110 |
| -Full house: |
111 |
| - If the dice are two of a kind and three of a kind, the |
112 |
| - player scores the sum of all the dice. |
113 |
| - For example, when placed on "full house" |
114 |
| - 1,1,2,2,2 scores 8 (1+1+2+2+2) |
115 |
| - 2,2,3,3,4 scores 0 |
116 |
| - 4,4,4,4,4 scores 0 |
| 47 | +### Chance: |
| 48 | +The player scores the sum of all dice, no matter what they read. |
| 49 | +For example: |
| 50 | + |
| 51 | +- 1,1,3,3,6 placed on "chance" scores 14 (1+1+3+3+6) |
| 52 | +- 4,5,5,6,1 placed on "chance" scores 21 (4+5+5+6+1) |
| 53 | + |
| 54 | +### Yahtzee: |
| 55 | +If all dice have the same number, |
| 56 | +the player scores 50 points. |
| 57 | +For example: |
| 58 | + |
| 59 | +- 1,1,1,1,1 placed on "yahtzee" scores 50 |
| 60 | +- 1,1,1,2,1 placed on "yahtzee" scores 0 |
| 61 | + |
| 62 | +### Ones, Twos, Threes, Fours, Fives, Sixes: |
| 63 | +The player scores the sum of the dice that reads one, |
| 64 | +two, three, four, five or six, respectively. |
| 65 | +For example: |
| 66 | + |
| 67 | +- 1,1,2,4,4 placed on "fours" scores 8 (4+4) |
| 68 | +- 2,3,2,5,1 placed on "twos" scores 4 (2+2) |
| 69 | +- 3,3,3,4,5 placed on "ones" scores 0 |
| 70 | + |
| 71 | +### Pair: |
| 72 | +The player scores the sum of the two highest matching dice. |
| 73 | +For example, when placed on "pair": |
| 74 | + |
| 75 | +- 3,3,3,4,4 scores 8 (4+4) |
| 76 | +- 1,1,6,2,6 scores 12 (6+6) |
| 77 | +- 3,3,3,4,1 scores 6 (3+3) |
| 78 | +- 3,3,3,3,1 scores 6 (3+3) |
| 79 | + |
| 80 | +### Two pairs: |
| 81 | +If there are two pairs of dice with the same number, the |
| 82 | +player scores the sum of these dice. |
| 83 | +For example, when placed on "two pairs": |
| 84 | + |
| 85 | +- 1,1,2,3,3 scores 8 (1+1+3+3) |
| 86 | +- 1,1,2,3,4 scores 0 |
| 87 | +- 1,1,2,2,2 scores 6 (1+1+2+2) |
| 88 | + |
| 89 | +### Three of a kind: |
| 90 | +If there are three dice with the same number, the player |
| 91 | +scores the sum of these dice. |
| 92 | +For example, when placed on "three of a kind": |
| 93 | + |
| 94 | +- 3,3,3,4,5 scores 9 (3+3+3) |
| 95 | +- 3,3,4,5,6 scores 0 |
| 96 | +- 3,3,3,3,1 scores 9 (3+3+3) |
| 97 | + |
| 98 | +### Four of a kind: |
| 99 | +If there are four dice with the same number, the player |
| 100 | +scores the sum of these dice. |
| 101 | +For example, when placed on "four of a kind": |
| 102 | + |
| 103 | +- 2,2,2,2,5 scores 8 (2+2+2+2) |
| 104 | +- 2,2,2,5,5 scores 0 |
| 105 | +- 2,2,2,2,2 scores 8 (2+2+2+2) |
| 106 | + |
| 107 | +### Small straight: |
| 108 | +When placed on "small straight", if the dice read |
| 109 | + |
| 110 | + 1,2,3,4,5, |
| 111 | + |
| 112 | +the player scores 15 (the sum of all the dice. |
| 113 | + |
| 114 | +### Large straight: |
| 115 | +When placed on "large straight", if the dice read |
| 116 | + |
| 117 | + 2,3,4,5,6, |
| 118 | + |
| 119 | +the player scores 20 (the sum of all the dice). |
| 120 | + |
| 121 | +### Full house: |
| 122 | +If the dice are two of a kind and three of a kind, the |
| 123 | +player scores the sum of all the dice. |
| 124 | +For example, when placed on "full house": |
| 125 | + |
| 126 | +- 1,1,2,2,2 scores 8 (1+1+2+2+2) |
| 127 | +- 2,2,3,3,4 scores 0 |
| 128 | +- 4,4,4,4,4 scores 0 |
0 commit comments