Create code which takes the user through their own adventure through a Treasure Island. Allow the user to make their own choices and lead them to their own fate! Note that for any input given by the user, it should only be for the prompts provided (e.g. if we ask the user if they want to swim or walk, if they input ‘jog’ the game should end because they should listen to the rules). This is just a basic template of how your code should be structured, so you don’t have to follow this exactly! Get creative! Note: What I will write is essentially what should be in the console. For multiple choices, I will provide both pathways (but you should only have one pathway for the user) Input is in blue.
You are exploring a rainforest in search of treasure.
Legend has it that there are some buried on a nearby island.
You come across a lake. Do you want to swim across, or wait for a boat? (swim/wait):
User: swim
You get eaten by a hungry shark. Game over. Code ends here
User: wait
A boat arrives and you arrive at the island safely.
You come to a cave.
Do you want to venture inside or walk on? (venture/walk):
User: venture
You are squished by boulders never to be seen again. Game over. Code ends here
User: walk
Tell the user what happens based on their decision. One way should mean they find the treasure.
You’re at a crossroads.
Do you go left, right, or straight? (left/right/straight)
User: left
You are trampled by a herd of wildebeest. Game over. Code ends here.
User: straight
You get stung by a poisonous wasp. Game over. Code ends here.
User: right
You march on and find the buried treasure! Yippee!! Code ends here