Problem 63
Short Adventure 2 With a Loop
Make another short “Choose Your Own Adventure” game. However, this time you need to use a loop so that they can freely move from room to room and back again.
There need to be at least six rooms or destinations, and at least two different ways for the game to end.
Files Needed:
- Adventure2.java - empty shell
- Adventure2Example.java - tiny sample game
MITCHELL'S TINY ADVENTURE 2! You are in a creepy house! Would you like to go "upstairs" or into the "kitchen"? > kitchen There is a long countertop with dirty dishes everywhere. Off to one side there is, as you'd expect, a refrigerator. You may open the "refrigerator" or go "back". > back You are in a creepy house! Would you like to go "upstairs" or into the "kitchen"? > upstairs Upstairs you see a hallway. At the end of the hallway is the master "bedroom". There is also a "bathroom" off the hallway. Or, you can go back "downstairs". Where would you like to go? > downstairs You are in a creepy house! Would you like to go "upstairs" or into the "kitchen"? > kitchen There is a long countertop with dirty dishes everywhere. Off to one side there is, as you'd expect, a refrigerator. You may open the "refrigerator" or go "back". > refrigerator Inside the refrigerator you see food and stuff. It looks pretty nasty. Would you like to eat some of the food? ("yes" or "no") > yes The food is slimy and foul, but you manage to choke it down. Your stomach starts jumping like a frog in hot water. You feel faint. Sliding to the floor, the darkness closes in. You have died. </pre?
◄ 62: Collatz Sequence 64: Counting with a For Loop ►
Adapted from ProgrammingByDoing.com
©2013 Graham Mitchell
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.