diff options
author | Pacien TRAN-GIRARD | 2014-02-23 20:56:53 +0000 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-02-23 20:56:53 +0000 |
commit | 3eb6c5630800038ae7d2f7eadfd4f705a6c22f6f (patch) | |
tree | 323da4802fa96ff223d29dc2058cfd70350b0701 /src | |
parent | fbd27a3d7ababe27ef15ba2f10b55bc723de0dc5 (diff) | |
parent | c08b6b9e4eebbdeb941803aa50200162d4b77924 (diff) | |
download | esieequest-3eb6c5630800038ae7d2f7eadfd4f705a6c22f6f.tar.gz |
Merge branch 'zuul-with-features' into 'master'
Zuul With Features
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/CommandWords.java | 2 | ||||
-rw-r--r-- | src/esieequest/Game.java | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index 3a77015..3d8855d 100644 --- a/src/esieequest/CommandWords.java +++ b/src/esieequest/CommandWords.java | |||
@@ -12,7 +12,7 @@ package esieequest; | |||
12 | */ | 12 | */ |
13 | public class CommandWords { | 13 | public 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" }; | 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 638c9b8..350fa15 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java | |||
@@ -222,6 +222,14 @@ public class Game { | |||
222 | System.out.println(" go quit help"); | 222 | System.out.println(" go quit help"); |
223 | } | 223 | } |
224 | 224 | ||
225 | private void look() { | ||
226 | System.out.println(aCurrentRoom.getLongDescription()); | ||
227 | } | ||
228 | |||
229 | private void eat() { | ||
230 | System.out.println("You have eaten now and you are not hungry any more."); | ||
231 | } | ||
232 | |||
225 | /** | 233 | /** |
226 | * "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 |
227 | * really quit the game. | 235 | * really quit the game. |
@@ -249,6 +257,12 @@ public class Game { | |||
249 | case "go": | 257 | case "go": |
250 | this.goRoom(pCommand); | 258 | this.goRoom(pCommand); |
251 | return false; | 259 | return false; |
260 | case "look": | ||
261 | this.look(); | ||
262 | return false; | ||
263 | case "eat": | ||
264 | this.eat(); | ||
265 | return false; | ||
252 | case "help": | 266 | case "help": |
253 | this.printHelp(); | 267 | this.printHelp(); |
254 | return false; | 268 | return false; |