D. Final Algorithm, Flowchart, or Pseudocode

Given/Assumptions:

Player starts with five dice.

Player is allowed 3 times to re-roll any of their dice.

 

Algorithm:

 

  1. Start
  2. Roll the dice.
  3. Observe the numbers on the side of the dice.
  4. Decide if you want to roll any dice again. If so, go to step #5. If not, go to step #6.
  5. Signify which dice you’d like to roll again. Go to step #2.
  6. 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).
  7. If you chose Aces, go to step #44.
  8. If you chose Twos, go to step #42.
  9. If you chose Threes, go to step #40.
  10. If you chose Fours, go to step #38.
  11. If you chose Fives, go to step #36.
  12. If you chose Sixes, go to step #34.
  13. If you chose Chance, go to step #32.
  14. If you chose Three of a Kind, go to step #30.
  15. If you chose Four of a Kind, go to step #28.
  16. If you chose Full House, go to step #26.
  17. If you chose Small Straight, go to step #24.
  18. If you chose Large Straight, go to step #22.
  19. If you chose Yahtzee, go to step #20.
  20. If you’ve already scored a Yahtzee, go to step #46. If not, go to step #21.
  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.
  22. If you’ve already scored a Large Straight, go to step #46. If not, go to step #23.
  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.
  24. If you’ve already scored a Small Straight, go to step #46. If not, go to step #25.
  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.
  26. If you’ve already scored a Full House, go to step #46. If not, go to step #27.
  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.
  28. If you’ve already scored a Four of a Kind, go to step #46. If not, go to step #29.
  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.
  30. If you’ve already scored a Three of a Kind, go to step #46. If not, go to step #31.
  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.
  32. If you’ve already scored a chance, go to step #46. If not, go to step #33.
  33. The score is a chance and your score is the sum of all of your dice. Go to step #46.
  34. If you’ve already scored in Sixes, go to step #46. If not, go to step #35.
  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.
  36. If you’ve already scored in Fives, go to step #46. If not, go to step #37.
  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.
  38. If you’ve already scored in Fours, go to step #46. If not, go to step #39.
  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.
  40. If you’ve already scored in Threes, go to step #46. If not, go to step #41.
  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.
  42. If you’ve already scored in Twos, go to step #46. If not, go to step #43.
  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.
  44. If you’ve already scored in Aces, go to step #46. If not, go to step #45.
  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.
  46. Add your score to the final score.
  47. Repeat steps 2-45 until all categories are scored in.
  48. Report final score.
  49. End