import java.util.Scanner;
public class newSquare {
static Scanner input = new Scanner(System.in);
static String next, dir;
public static void main(String[] args){
intro();
}
public static void intro(){
System.out.println("Your job is to go in a sqaure. The commands are: right and left.");
System.out.println("If you go in the wrong way, you will be told and the character will not move.");
System.out.println("Once you have read these, type continue");
introCalculation();
}
public static void introCalculation(){
next = input.next();
if(next.equals("continue")){
first();
}else{intro();}
}
public static void first(){
System.out.println("You wake up and appear to be in a long corridor. You can't \n see where it leads, but will have to try to get out. Which way do you go?");
dir = input.next();
if(dir.equals("right")){
second();
}else if(dir.equals("left")){
System.out.println("Try again?");
first();
}else{System.out.println("Try again?");
first();}
}
public static void second(){
System.out.println("You successfully walked through without hitting any walls. \n Which way now?");
dir = input.next();
if(dir.equals("right")){
third();
}else if(dir.equals("left")){
System.out.println("Try Again");
second();
}else{System.out.println("BAD COMMAND! Try Again.");
second();}
}
public static void third(){
System.out.println("That's two so far. You still can't see much of anything except for \n some light coming in. Maybe try right again?");
dir = input.next();
if(dir.equals("right")){
fourth();
}else if(dir.equals("left")){
System.out.println("Try Again");
third();
}else{System.out.println("BAD COMMAND! Try Again.");
third();}
}
public static void fourth(){
System.out.println("You see a strong light coming from a certain direction. \n I wonder which one it is. Right or Left?");
dir = input.next();
if(dir.equals("right")){
completion();
}else if(dir.equals("left")){
System.out.println("Try Again");
fourth();
}else{System.out.println("BAD COMMAND! Try Again.");
fourth();}
}
public static void completion(){
System.out.println("You made it out! Horray for you!");
System.out.println("Type restart or finish to continue");
String end;
end = input.next();
if(end.equals("finish")){
System.exit(0);
}else if(end.equals("restart")){
intro();
}
}
}


Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.
Back to top








