C. Code Representation (Algorithm, Flowchart, or Pseudocode)

Algorithm for Sweet Tooth

  1. Create a menu with a PLAY, HOW TO PLAY, STATISTICS, CREDITS, and QUIT buttons

  2. Print the menu to the Proteus screen

  3. If user presses the PLAY button go to step 4

  4. Randomly generate two numbers that correspond to either ice cream or milkshake dessert

  5. Randomly generate 6 numbers that correspond to 6 flavors

  6. Randomly generate 3 numbers that correspond to toppings – cherry, oreos, or sprinkles

  7. Using the randomly generated numbers, display to the screen a randomly generated ice cream cone or a milkshake with one flavor (color of the ice cream scoop or milkshake) and one topping

  8. Display the dessert for 3 seconds

  9. Clear the screen

  10. Instruct user to recreate the order

  11. Create two buttons with a an ice cream on one button and a milkshake on the other

  12. Display the two buttons

  13. Allow user to touch one button

  14. Clear the screen

  15. Create 6 buttons for flavors of ice cream/milkshake with a color on each button

  16. Display the 6 buttons

  17. Allow user to touch one button

  18. Clear the screen

  19. Create 3 buttons for toppings, with a topping on each button (cherry, oreos, sprinkles)

  20. Display the 3 buttons

  21. Allow user to touch one button

  22. Clear the screen

  23. If the three user responses match with the randomly generated dessert from the order, assign a point to this round

  24. Move points earned in this round to total point counter

  25. If the sum of points earned in one round = 3 go to step 26, if not go to step 27

  26. Add one to the number of perfect orders

  27. Add one to the number of imperfect orders

  28. Reset points for this round

  29. Repeat steps 2-28 for 10 orders

  30. Go to step 2

  31. If user presses the HOW TO PLAY BUTTON go to step 32

  32. Display instructions to the Proteus screen

  33. Go to step 2

  34. If user presses the STATS button, go to step 32

  35. Display the number of total points

  36. Display the number of perfect orders

  37. Display the number of imperfect orders

  38. Display the menu

  39. If the CREDITS button is pressed, go to step 40

  40. Display the credits to the screen

  41. If the QUIT button is pressed, go to step 42

  42. Exit the game and leave a message to the Proteus screen