Elmo is on a mission to collect three different rainbow cookies on Sesame Street! 🌈🍪 But be careful… Cookie Monster is lurking, and he might gobble up your precious cookies! 😱 Your job is to help Elmo collect his favorite cookies while avoiding Cookie Monster’s munchies.
By completing this lab, you will practice:
✅ Using lists to store and manage data.
✅ Writing functions with single return values.
✅ Using while loops to control the flow of the game.
✅ Applying if statements to handle choices and random events.
✅ Validating user input to ensure correct responses (no try/except).
✅ Using string formatting and ANSI color codes for a cool, colorful game! 🎨
Begin by displaying a colorful introduction message using ANSI colors.
Explain the game: Elmo wants three different cookies, but Cookie Monster might try to eat them first!
Set up a list of possible cookie colors that Elmo can collect.
Present a numbered menu of available cookies.
Allow the user to pick a cookie using input.
Validate the input to ensure it's a number between 1-5.
If the input is invalid, Elmo will complain and ask for a new choice.
Once a cookie is chosen, randomly determine if Cookie Monster appears.
There is a 25% chance he will gobble up the cookie!
If he doesn’t appear, Elmo successfully collects the cookie.
Add collected cookies to a list.
Prevent duplicate cookies (Elmo doesn’t want two of the same!).
Keep track of Elmo’s collection and display it after each round.
Once Elmo collects three different cookies, display a victory message using rotating ANSI colors.
Congratulate the player for completing Elmo’s Rainbow Cookie Quest! 🎉
🔹 Customize Cookie Monster's randomness: Change the chance of him appearing to make the game harder or easier!
🔹 Add more cookies: Expand the list to include new cookie flavors!
🔹 Use different ASCII art: Make Cookie Monster and Elmo say more funny things!
🔹 Make it multiplayer: Have two players take turns collecting cookies!