From 79d33230b556943c1067871e422ed50fd9afb111 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 23 Feb 2014 22:13:07 +0100 Subject: Implement commands listing --- src/esieequest/CommandWords.java | 10 ++++++++++ src/esieequest/Game.java | 2 +- src/esieequest/Parser.java | 7 +++++++ 3 files changed, 18 insertions(+), 1 deletion(-) (limited to 'src') 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 { } return false; } + + /** + * Print all valid commands to System.out. + */ + public void showAll() { + for (String vCommand : this.sValidCommands) { + System.out.print(vCommand + " "); + } + System.out.println(); + } } 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 { System.out.println("You wander around at the university."); System.out.println(""); System.out.println("Your command words are:"); - System.out.println(" go quit help"); + this.aParser.showCommands(); } 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 { return new Command(null, null); } } + + /** + * Print out a list of valid command words. + */ + public void showCommands() { + this.aValidCommands.showAll(); + } } -- cgit v1.2.3