This is a React implementation of the game Maxi Yatzy, which is a variation of Yatzy played with six dice. Yatzy is a public domain dice game similar to Yahtzee (trademarked by Hasbro in the US) or Yacht.
You can play the game at heurl.in/yatzy.
This project was created mainly to learn some React basics, as an experiment and something to enjoy after completion. Most of the UI is extremely minimal and bare-bones, and much of the code could probably be vastly improved.
This project was bootstrapped with Create React App. See the original readme file for details.
- Players take turns rolling the six dice.
- Each turn, the player may roll the dice up to three times.
- On the second and third roll, the player chooses which dice to reroll. Click or tap on a die to "hold" it, which prevents it being rerolled.
- After the three rolls, the player picks a scoring category, and it becomes the next player's turn.
- The player may also pick a scoring category at any other point during their turn. If you get a Full Straight on the first roll, you can assign it right away.
- If you can't score in any category, you have to pick zero for one of them! To prevent misclicks with unfortunate consequences, you must doubleclick/doubletap the scoring category to confirm a score of zero.
- The game ends when all players have distributed scores in all categories.
- The player with the highest score wins.
This implementation of the game features these scoring categories:
- Ones: The sum of all dice showing ⚀ (1).
- Twos: The sum of all dice showing ⚁ (2).
- Threes: The sum of all dice showing ⚂ (3).
- Fours: The sum of all dice showing ⚃ (4).
- Fives: The sum of all dice showing ⚄ (5).
- Sixes: The sum of all dice showing ⚅ (6).
- Bonus: Awarded automatically if the sum of Ones thru Sixes is greater than or equal to 84 (equivalent to scoring four-of-a-kind in all those categories). The bonus is worth 100 points.
- One pair: A pair of dice with the same value.
- Two pairs: Two distinct pairs of dice with the same value.
- Three pairs: Three distinct pairs of dice with the same value.
- Three of a kind: Three dice with the same value.
- Four of a kind: Four dice with the same value.
- Five of a kind: Five dice with the same value.
- Small straight: ⚀⚁⚂⚃⚄ (1-2-3-4-5), worth 15 points (the sum of the dice).
- Large straight: ⚁⚂⚃⚄⚅ (2-3-4-5-6), worth 20 points (the sum of the dice).
- Full straight: ⚀⚁⚂⚃⚄⚅ (1-2-3-4-5-6), worth 25 points.
- Full house: One pair and one three-of-a-kind, with different values.
- Villa: Two distinct three-of-a-kinds.
- Tower: One pair and one four-of-a-kind, with different values.
- Chance: The sum of all dice.
- Yatzy: All dice showing the same value, worth 100 points.
Unless otherwise specified, the score for a particular category is calculated as the sum of the dice in the combo. So for example, ⚄⚀⚄⚅⚅⚄ (5-1-5-6-6-5) is worth 12 as a pair (⚅⚅, 6+6), 15 as a three-of-a-kind (⚄⚄⚄, 5+5+5), or 27 as a full house (⚄⚄⚄⚅⚅, 5+5+5+6+6). If a particular category can be scored multiple ways with the current dice, the game picks the highest possible score automatically. If you've rolled ⚄⚀⚄⚃⚂⚀ (5-1-5-4-3-1), One pair will be worth 10 (⚄⚄, 5+5), not 2 (⚀⚀, 1+1).
In the case of Two pairs, Three pairs, Full house, Villa, and Tower, the dice groups must have distinct values. Hence, ⚂⚂⚂⚂⚂ (3-3-3-3-3) is not a valid Two pairs or Full house.
The order of the dice does not matter.
- Full Straight (⚀⚁⚂⚃⚄⚅, 1-2-3-4-5-6) is awarded 25 points instead of 21.
- There is no ability to save unused rolls; you get three rolls per turn, no more, no less.