aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/esieequest/CommandWords.java2
-rw-r--r--src/esieequest/Game.java7
2 files changed, 8 insertions, 1 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java
index 315fc0d..3d8855d 100644
--- a/src/esieequest/CommandWords.java
+++ b/src/esieequest/CommandWords.java
@@ -12,7 +12,7 @@ package esieequest;
12 */ 12 */
13public class CommandWords { 13public class CommandWords {
14 // a constant array that holds all valid command words 14 // a constant array that holds all valid command words
15 private static final String[] sValidCommands = { "go", "quit", "help", "look" }; 15 private static final String[] sValidCommands = { "go", "quit", "help", "look", "eat" };
16 16
17 /** 17 /**
18 * Constructor - initialise the command words. 18 * Constructor - initialise the command words.
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java
index 5fc2813..350fa15 100644
--- a/src/esieequest/Game.java
+++ b/src/esieequest/Game.java
@@ -226,6 +226,10 @@ public class Game {
226 System.out.println(aCurrentRoom.getLongDescription()); 226 System.out.println(aCurrentRoom.getLongDescription());
227 } 227 }
228 228
229 private void eat() {
230 System.out.println("You have eaten now and you are not hungry any more.");
231 }
232
229 /** 233 /**
230 * "Quit" was entered. Check the rest of the command to see whether we 234 * "Quit" was entered. Check the rest of the command to see whether we
231 * really quit the game. 235 * really quit the game.
@@ -256,6 +260,9 @@ public class Game {
256 case "look": 260 case "look":
257 this.look(); 261 this.look();
258 return false; 262 return false;
263 case "eat":
264 this.eat();
265 return false;
259 case "help": 266 case "help":
260 this.printHelp(); 267 this.printHelp();
261 return false; 268 return false;