Skip to content

Latest commit

 

History

History
39 lines (39 loc) · 2.57 KB

File metadata and controls

39 lines (39 loc) · 2.57 KB

< Previous       Next >


Project

Your assignment is to use the die rolling function and an input loop together to make a magic 8-ball like game where players roll a die, and then get a corresponding fortune from the 8-ball.

Example Program Output:
Welcome to your fortune teller! I know how good your future will be, based on your own luck! If you’re lucky, you’ll have a lucky outcome.
Tell me to “roll” when you’re ready to roll the dice for your future.
  • if the player rolls a low amount, give them have a bad fortune.
  • if the player rolls a medium amount, give them a good fortune.
  • if the player rolls a high amount, give them a great fortune.
Extra Credit:
  • If someone rolls the highest amount possible, tell them they won the lottery


If you can, build the entire above program before continuing on, but after you click continue here there will be a few prompts that will help you figure out what code you'll need, and define the program more specifically!
Press continue for some prompts and additional information!
Come up with a solution to the following prompts. You can write it out in a regular sentence, and that will help you design your program. Check the boxes when you've come up with an answer.
  • Decide how many different fortunes you want to have. 3? 6? 100?
  • What should the range of the random number you create be?
  • How can you check if the user inputs "roll" so you can start?
  • What happens if the user says something, or misspells "roll"—how can you let them try again, or tell you they want to "exit".
  • You might want to use a function for something that could be done multiple times, like rolling a die, and getting a fortune.
  • What if the user wants to get multiple fortunes, without running the program again, what code feature would you use to solve that?
There's a lot of ways to build up the program. No one approach is correct, but after you get it working in a basic way, keep pushing to see what else you can get it to do.
Also you can use these same skills to create a game where the user guesses a random number, and if they're right you could give them a reward! If they're wrong you could charge them money, and then you've got the makings of a casino!