aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--report/progression.tex4
-rw-r--r--src/esieequest/CommandWords.java2
-rw-r--r--src/esieequest/Game.java14
3 files changed, 19 insertions, 1 deletions
diff --git a/report/progression.tex b/report/progression.tex
index f31330a..2f25aea 100644
--- a/report/progression.tex
+++ b/report/progression.tex
@@ -62,8 +62,12 @@ the room since commit e510b08d0.
62 62
63\subsection{look} 63\subsection{look}
64 64
65The look command has been added with the commit 698e3cd25.
66
65\subsection{eat} 67\subsection{eat}
66 68
69The eat command has been added with the commit 40b9b4816.
70
67 71
68\section{Zuul better v2} 72\section{Zuul better v2}
69 73
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 */
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" }; 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;