diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/CommandWords.java | 2 | ||||
-rw-r--r-- | src/esieequest/Game.java | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index 3a77015..315fc0d 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" }; |
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..5fc2813 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java | |||
@@ -222,6 +222,10 @@ 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 | |||
225 | /** | 229 | /** |
226 | * "Quit" was entered. Check the rest of the command to see whether we | 230 | * "Quit" was entered. Check the rest of the command to see whether we |
227 | * really quit the game. | 231 | * really quit the game. |
@@ -249,6 +253,9 @@ public class Game { | |||
249 | case "go": | 253 | case "go": |
250 | this.goRoom(pCommand); | 254 | this.goRoom(pCommand); |
251 | return false; | 255 | return false; |
256 | case "look": | ||
257 | this.look(); | ||
258 | return false; | ||
252 | case "help": | 259 | case "help": |
253 | this.printHelp(); | 260 | this.printHelp(); |
254 | return false; | 261 | return false; |