Given/Assumptions:
Player starts with five dice.
Player is allowed 3 times to re-roll any of their dice.
Algorithm:
- Start
- Roll the dice.
- Observe the numbers on the side of the dice.
- Decide if you want to roll any dice again. If so, go to step #5. If not, go to step #6.
- Signify which dice you’d like to roll again. Go to step #2.
- Choose what category you’d like to score in (Aces, Twos, Threes, Fours, Fives, Sixes, Chance, Three of a Kind, Four of a Kind, Full House, Small Straight, Large Straight, Yahtzee).
- If you chose Aces, go to step #44.
- If you chose Twos, go to step #42.
- If you chose Threes, go to step #40.
- If you chose Fours, go to step #38.
- If you chose Fives, go to step #36.
- If you chose Sixes, go to step #34.
- If you chose Chance, go to step #32.
- If you chose Three of a Kind, go to step #30.
- If you chose Four of a Kind, go to step #28.
- If you chose Full House, go to step #26.
- If you chose Small Straight, go to step #24.
- If you chose Large Straight, go to step #22.
- If you chose Yahtzee, go to step #20.
- If you’ve already scored a Yahtzee, go to step #46. If not, go to step #21.
- If all five dice have the same number, the score is a Yahtzee, you win fifty points, and move on to step #46. If not, go to step #46.
- If you’ve already scored a Large Straight, go to step #46. If not, go to step #23.
- If all five of the dice are all different from each other and are consecutive to one another, the score is a Large Straight, you win 40 points, and go to step #46. If not, go to step #46.
- If you’ve already scored a Small Straight, go to step #46. If not, go to step #25.
- If four of the dice are all different from each other and are consecutive to one another, the score is a Small Straight, you win 30 points, and move on to step #46. If not, go to step #46.
- If you’ve already scored a Full House, go to step #46. If not, go to step #27.
- If three of the dice have the same number and the other two dice both have the same number, the score is a Full House, you win 25 points, and move on to step #46. If not, go to step #46.
- If you’ve already scored a Four of a Kind, go to step #46. If not, go to step #29.
- If only four of the dice have the same number, the score is Four of a Kind, you win points worth the sum of all the dice and move on to step #46. If not, go to step #46.
- If you’ve already scored a Three of a Kind, go to step #46. If not, go to step #31.
- If only three of the dice have the same number and the other dice don’t have the same number as each other, the score is a Three of a Kind, you win points worth the sum of all the dice and go to step #46. If not, go to step #46.
- If you’ve already scored a chance, go to step #46. If not, go to step #33.
- The score is a chance and your score is the sum of all of your dice. Go to step #46.
- If you’ve already scored in Sixes, go to step #46. If not, go to step #35.
- If any of the dice have a six on them, your score is Sixes, your points are the sum of all the sixes, and go to step #46. If not, go to step #46.
- If you’ve already scored in Fives, go to step #46. If not, go to step #37.
- If any of the dice have a five on them, your score is Fives, your points are the sum of all the fives, and go to step #46. If not, go to step #46.
- If you’ve already scored in Fours, go to step #46. If not, go to step #39.
- If any of the dice have a four on them, your score is Fours, your points are the sum of all the fours, and go to step #46. If not, go to step #46.
- If you’ve already scored in Threes, go to step #46. If not, go to step #41.
- If any of the dice have a three on them, your score is Threes, your points are the sum of all the threes, and go to step #46. If not, go to step #46.
- If you’ve already scored in Twos, go to step #46. If not, go to step #43.
- If any of the dice have a two on them, your score is Twos, your points are the sum of all the twos, and go to step #46. If not, go to step #46.
- If you’ve already scored in Aces, go to step #46. If not, go to step #45.
- If any of the dice have a one on them, your score is Aces, your points are the sum of all the ones, and go to step #46. If not, go to step #46.
- Add your score to the final score.
- Repeat steps 2-45 until all categories are scored in.
- Report final score.
- End