Assignment 45; Adventure
Code
// Donovan Rich
// Period 6
// Choose Your Own Adventure!
// Adventure.java
// 10/28/2015
import java.util.Scanner;
public class Adventure {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
String response;
System.out.println( "You wake up in a bathroom in a pool of blood (yours, presumably.)" );
System.out.println( "The mirror on the wall is shattered into several shards scattered across the sink and floor." );
System.out.println( "There is a sturdy wooden door in front of you. Next to the mirror, there is a window" );
System.out.println( "overlooking the outside. It is dark. Do you use the 'door' or try to open the 'window'?" );
System.out.print ( "==> " );
response = keyboard.next();
if (response.equals ( "door" ) )
{
System.out.println ( "You open the door. You are now in a hallway. Do you travel to the 'left' or 'right'?" );
System.out.print ( "==> " );
response = keyboard.next();
if (response.equals( "left" ) )
{
System.out.println ( "You proceed to the left. The front door is in front of you, aptly so." );
System.out.println ( "There is also another window slightly right of the door. Do you try to go" );
System.out.println ( "through the 'door' or through the 'window'?" );
System.out.print ( "==> " );
response = keyboard.next();
if ( response.equals( "door" ) )
{
System.out.println ( "Like a sane human being, you open the door and walk through it." );
System.out.println ( "You continue on down the porch. You continue walking. You walk into the street." );
System.out.println ( "It is spring. A buck trots towards you and impales you on its antlers. You die." );
}
else if ( response.equals( "window" ) )
{
System.out.println ( "Oh. You uh. You jump through the window." );
System.out.println ( "One of the shards of glass slits a vital artery in your neck." );
System.out.println ( "You writhe on the ground untli you bleed to death. You die." );
}
}
else if ( response.equals( "right" ) )
{
System.out.println ( "You proceed to the right. There are two marked doors ahead of you." );
System.out.println ( "One door leads to the 'bedroom'. The other leads to the 'murder_dungeon'." );
System.out.println ( "Proceed to 'bedroom' or 'murder_dungeon'?" );
System.out.print ( "==> " );
response = keyboard.next();
if ( response.equals( "bedroom" ) )
{
System.out.println ( "You enter the room. You trip over a pair of boots and break your neck." );
System.out.println ( "As you lose consciousness, you notice an army of gnomes march into the bedroom." );
System.out.println ( "You die." );
}
else if ( response.equals ( "murder_dungeon" ) )
{
System.out.println ( "You travel down the stairway into the murder dungeon." );
System.out.println ( "You are tortured. Then murdered. You die." );
}
}
}
else if ( response.equals( "window" ) )
{
System.out.println ( "You lunge through the window, scratching your arm on the way out." );
System.out.println ( "Despite this festering injury, you have managed to escape the bathroom." );
System.out.println ( "Congratulations. Do you 'contemplate' your existence or continue 'downtown'?" );
System.out.print ( "==> " );
response = keyboard.next();
if ( response.equals( "contemplate" ) )
{
System.out.println ( "You think about your life in a philosophical manner." );
System.out.println ( "While lost in transcendance, you are ambushed by an angry" );
System.out.println ( "cannibal. Do you 'run' or 'fight'?" );
System.out.print ( "==> " );
response = keyboard.next();
if ( response.equals( "run" ) )
{
System.out.println ( "You attempt to run. The cannibal throws a sharpened bone into your throat." );
System.out.println ( "While incapitated, he consumes your flesh. You die." );
}
else if ( response.equals( "fight" ) )
{
System.out.println ( "You stand your ground and fight him. After much trial and error, you murder him." );
System.out.println ( "The authorities arrest you. You are convicted of first degree homicide and put to death." );
System.out.println ( "You are placed in the electric chair and killed. You die." );
}
}
else if ( response.equals( "downtown" ) )
{
System.out.println ( "You travel downtown. Across the street is a Taco Bell. To your right is a hardware store." );
System.out.println ( "Do you cross the street to get a 'taco' or head to the 'hardware' store?" );
System.out.print ( "==> " );
response = keyboard.next();
if ( response.equals( "taco" ) )
{
System.out.println ( "You try to cross the street. You are hit by a semi-truck and are killed instantly.");
System.out.println ( "You die." );
}
else if ( response.equals( "hardware" ) )
{
System.out.println ( "You go to the hardware store. You hit yourself in the head with a hammer repeatedly.");
System.out.println ( "Because of blunt force trauma, you are knocked unconscious. You shatter your skull on the hard floor. You die.");
}
}
}
}
}
Picture of the output