import words through file

This commit is contained in:
jslightham
2019-04-24 22:52:15 -04:00
parent 9805c8ea84
commit 14bd1aa83f
3 changed files with 44 additions and 57 deletions

View File

@@ -140,24 +140,22 @@ class Game {
}
String commandWord = command.getCommandWord();
switch(commandWord) {
case "n": case "s": case "e": case "w": case "north": case "south": case "west": case "east": case "up": case "down":
case "go": case "n": case "s": case "e": case "w": case "north": case "south": case "west": case "east": case "up": case "down":
goRoom(command);
break;
}
if (commandWord.equals("help"))
printHelp();
else if (commandWord.equals("go"))
goRoom(command);
else if (commandWord.equals("jump"))
System.out.println("Good Job!");
else if (commandWord.equals("quit")) {
if (command.hasSecondWord())
System.out.println("Quit what?");
else
return true; // signal that we want to quit
} else if (commandWord.equals("eat")) {
System.out.println("Do you really think you should be eating at a time like this?");
case "help":
printHelp();
break;
case "jump":
System.out.println("Good Job!");
break;
case "quit":
return true;
case "eat":
System.out.println("Do you really think you should be eating at a time like this?");
break;
default:
return false;
}
return false;
}