Alright, now it’s time to get into the nitty-gritty. Using your knowledge of the programming concepts seen previously, create your game following typical coding conventions. Below, you will find some of the steps that you will need to complete in order to have a fully functioning game:
1) What did the player choose?
Declare a variable to store the player’s choice between Bear, Hunter, and Princess.
2) What did the computer choose?
Use a random number generator to determine the computer’s choice and store the result in another variable.
3) Determine the winner using nested conditionals
Use the first level to type out the 3 different scenarios for the player’s choice using IF and ELSE IF statements.
Use the second level to add the 3 different computer choices under each value for player using IF and ELSE IF statements.
4) So…. who won? 🙂
Output the result to the screen and declare the winner. For clarity, explain the result in terms of the rules of the game. If the player chose bear and the computer selected hunter, the output could read: “Your bear is trapped by the computer’s hunter. You lose.”