D. Final Algorithm, Flowchart, or Pseudocode

The Quest for Chegg –

Algorithm

  1. Start.
  2. The player is prompted to input their desired name. Go to line 3.
  3. Once the input is satisfied, the introduction scene dialogue plays. The player wakes up in a dungeon. Go to line 4.
  4. The player is asked if they were crossing the border, if yes go to line 5, if no go to line 6.
  5. The player proceeds (No health is taken). Go to line 7 .
  6. The player is caught lying (-1 health). The player proceeds. Go to line 7.
  7. The player must “pick a lock” to escape from their cell, a random number between 1 and 6 is generated with the randi function. Go to line 8.
  8. If the random number is less than or equal to 3 go to line 9. If the random number is greater than 3 go to line 10.
  9. The player’s lock pick attempt failed and must bust the lock with a rock. (-1 health) Go to line 11.
  10. The player’s lock pick attempt succeeded and they proceed as normal. Go to line 11.
  11. The player discovers a split in the dungeon and can go left or right. Go to line 12.
  12. If the player goes left go to line 13. If the player goes right go to line 14.
  13. The player discovers a healing fountain (+4 health) and proceeds. Go to line 20.
  14. The player discovers an armory and finds three weapons. The player is prompted to choose a Zweihander, a Scimitar, or a Mace. Go to line 15.
  15. If the player chooses the Zweihander go to line 16. If the player chooses the Scimitar go to line 17. If the player chooses the Mace go to line 18.
  16. The player picks up the Zweihander. Go to line 19.
  17. The player picks up the Scimitar. Go to line 19.
  18. The player picks up the Mace. Go to line 19.
  19. The player heads back to the split in the dungeon and sees what was down the left path. Go to line 13.
  20. The player encounters a guard! In the game the player will be able to choose to attack or defend until either the guard is defeated or until the player runs out of health. If the guard is defeated go to line 21. If the player runs out of health go to line 32.
  21. The player loots the guard, receives 25 gold, and a health potion (+4 Health). In order to win the game the player needs 50 gold to buy chegg so that they can complete their endless homework! At this point the player continues on. Go to line 22.
  22. The player encounters a second guard and is given the option to wait for the guard to pass or to attack. If the player attacks go to line 23. If the player decides to wait go to line 25.
  23. The player enters a battle sequence like earlier. If the player survives go to line 24. If the player dies go to line 32.
  24. The player has defeated the guard and loots him for a random amount of gold. If the player now has more gold. Go to line 26.
  25. The player waits for the guard to move and loses no health, but does not get the guard’s gold. Go to line 26.
  26. The player finds the exit to the dungeon. The player heads to the nearest town to speak with the merchant. The merchant explains that you need 50 gold to buy chegg. If the player has 50 gold go to line 31. If the player does not have 50 gold go to line 27.
  27. The player continues for more gold. They encounter a goblin and a battle sequence starts. If the player survives go to line 28. If the player dies go to line 32.
  28. The player loots the goblin for a random amount of gold. If the player now has 50 gold go to line 31. If the player does not have 50 gold go to line 29.
  29. The player continues their search for more gold. The player encounters a bandit and a battle sequence is started. If the player survives go to line 30. If the player dies go to line 32.
  30. The player loots the bandit for a random amount of gold. This is the last enemy so the player will now have at least 50 gold. Go to line 31.
  31. The player has enough gold to buy chegg and complete their homework! “You Win!!” is displayed. Go to line 33.
  32. The player has died. “Game Over” is displayed. Go to line 33.
  33. End

 

 

Connect Four –

Algorithm

1. Start / Display empty board.

2. If it is the player’s turn go to line 3.  If it is the computer’s turn go to line 5.

3. Get the player input from mouse.

4. Place the players piece wherever the player clicks skip to line 6.

5. Calculate best row to place piece.

6. Continue moving the piece down until there is no empty space below it.

7. Check if the piece has 3 of the same color to the left, right, down, or diagonals of the piece that was just placed.  If there is not 3 pieces in any of those direction skip to line 9.

8. Change from player’s turn to computer’s turn or change from computer’s turn to player’s turn and go back to line 2.

9. If it is the players turn display player wins.  If it is the computer’s turn display computer wins.