diff options
author | Pacien TRAN-GIRARD | 2014-02-23 22:13:07 +0100 |
---|---|---|
committer | Pacien TRAN-GIRARD | 2014-02-23 22:13:41 +0100 |
commit | 79d33230b556943c1067871e422ed50fd9afb111 (patch) | |
tree | 125002e0f2578f719c323f54f876f8d92b125517 /src | |
parent | 98ee109b4a3e61b879d07e818bb426d192b4422e (diff) | |
download | esieequest-79d33230b556943c1067871e422ed50fd9afb111.tar.gz |
Implement commands listing
Diffstat (limited to 'src')
-rw-r--r-- | src/esieequest/CommandWords.java | 10 | ||||
-rw-r--r-- | src/esieequest/Game.java | 2 | ||||
-rw-r--r-- | src/esieequest/Parser.java | 7 |
3 files changed, 18 insertions, 1 deletions
diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index de1d132..a0718e3 100644 --- a/src/esieequest/CommandWords.java +++ b/src/esieequest/CommandWords.java | |||
@@ -31,4 +31,14 @@ public class CommandWords { | |||
31 | } | 31 | } |
32 | return false; | 32 | return false; |
33 | } | 33 | } |
34 | |||
35 | /** | ||
36 | * Print all valid commands to System.out. | ||
37 | */ | ||
38 | public void showAll() { | ||
39 | for (String vCommand : this.sValidCommands) { | ||
40 | System.out.print(vCommand + " "); | ||
41 | } | ||
42 | System.out.println(); | ||
43 | } | ||
34 | } | 44 | } |
diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java index 49ff765..ece1bcc 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java | |||
@@ -219,7 +219,7 @@ public class Game { | |||
219 | System.out.println("You wander around at the university."); | 219 | System.out.println("You wander around at the university."); |
220 | System.out.println(""); | 220 | System.out.println(""); |
221 | System.out.println("Your command words are:"); | 221 | System.out.println("Your command words are:"); |
222 | System.out.println(" go quit help"); | 222 | this.aParser.showCommands(); |
223 | } | 223 | } |
224 | 224 | ||
225 | private void look() { | 225 | private void look() { |
diff --git a/src/esieequest/Parser.java b/src/esieequest/Parser.java index 08f2bca..cc3ff11 100644 --- a/src/esieequest/Parser.java +++ b/src/esieequest/Parser.java | |||
@@ -55,4 +55,11 @@ public class Parser { | |||
55 | return new Command(null, null); | 55 | return new Command(null, null); |
56 | } | 56 | } |
57 | } | 57 | } |
58 | |||
59 | /** | ||
60 | * Print out a list of valid command words. | ||
61 | */ | ||
62 | public void showCommands() { | ||
63 | this.aValidCommands.showAll(); | ||
64 | } | ||
58 | } | 65 | } |