Assignemnt #77 Adventure 2

Code

    /// Name: Drew Boxold
    /// Period: 5
    /// Program Name: Adventure 2
    /// File Name: Adventure2.java
    /// Date Finished: 2/23/2016
    
    import java.util.Scanner;

    public class Adventure2o
    {
	   public static void main( String[] args )
	   {
		  Scanner keyboard = new Scanner(System.in);
		
		  int nextroom = 1;
		  String choice = "";

		  while ( nextroom != 0 )
		  {
			 if ( nextroom == 1 )
			 {
				    System.out.println( "You are in a dark hallway. There is a \"left\" path and a \"right\" path." );
				    System.out.print( "> " );
				    choice = keyboard.nextLine();
				    if ( choice.equals("left") )
					   nextroom = 2;
				    else if ( choice.equals("right") )
					   nextroom = 3;
				    else
					   System.out.println( choice + " wasn't one of the options. Try again." );
			}
			if ( nextroom == 2 )
			{
				    System.out.println( "You reach a dead end. There's nothing to do here except go \"back\"." );
				    System.out.print( "> " );
				    choice = keyboard.nextLine();
				    if ( choice.equals("back") )
					   nextroom = 1;
				    else
					   System.out.println( choice + " wasn't one of the options. Try again." );
			}
			if ( nextroom == 3 )
			{
				    System.out.println( "You find yourself in a large dark room. There is only a single \"door\" at the other end of the room. All around there are bodies on the floor. There is a \"crate\" in the center." );
				    choice = keyboard.nextLine();
				    System.out.print( "> " );
				    if ( choice.equals("door") )
					   nextroom = 1;
				    else if ( choice.equals("crate") )
					   nextroom = 4;
				    else
					   System.out.println( choice + " wasn't one of the options. Try again." );
			}
			if ( nextroom == 4 )
			{
				    System.out.println( "The crate is opened, and you notice a knife. You hear a dragging noise behind you. One of the bodies have risen! The bloody corpse begins move toward you. You can pull out your \"knife\" or try to use your \"fists\"." );
				    choice = keyboard.nextLine();
				    System.out.print( "> " );
				    if ( choice.equals("knife") )
					   nextroom = 5;
				    else if ( choice.equals("fists") )
					   nextroom = 6;
				    else
					   System.out.println( choice + " wasn't one of the options. Try again." );
			}
            if ( nextroom == 5 )
			{
				    System.out.println( "You pick up the knife and attempt to stab the corpse. You stab his arm and realize that the knife is useless. You realize that you can only slow it down. You stab its leg, but during the process it hits you. You escape but slowly turn into one of them..." );
				    nextroom = 0;
			}
            if ( nextroom == 6 )
			{
				    System.out.println( "You turn around and punch it in the face. You win and get hungry so you leave." );
				    nextroom = 0;
            }
				
        }

		  System.out.println( "\nThe game is over!" );
	   }
	
    }
    

Picture of the output

Assignment 77