From 698e3cd2591f6bf6f0fd21d6843ced267e0141bb Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 23 Feb 2014 21:49:57 +0100 Subject: Add the look command --- src/esieequest/CommandWords.java | 2 +- src/esieequest/Game.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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; */ public class CommandWords { // a constant array that holds all valid command words - private static final String[] sValidCommands = { "go", "quit", "help" }; + private static final String[] sValidCommands = { "go", "quit", "help", "look" }; /** * 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 { System.out.println(" go quit help"); } + private void look() { + System.out.println(aCurrentRoom.getLongDescription()); + } + /** * "Quit" was entered. Check the rest of the command to see whether we * really quit the game. @@ -249,6 +253,9 @@ public class Game { case "go": this.goRoom(pCommand); return false; + case "look": + this.look(); + return false; case "help": this.printHelp(); return false; -- cgit v1.2.3 From 76ace5863f2d355edae3d0d793f0dc8dbc9fa5b7 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 23 Feb 2014 21:51:48 +0100 Subject: Update report --- report/progression.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/report/progression.tex b/report/progression.tex index f31330a..d1bee91 100644 --- a/report/progression.tex +++ b/report/progression.tex @@ -62,6 +62,8 @@ the room since commit e510b08d0. \subsection{look} +The look command has been added with the commit 698e3cd25. + \subsection{eat} -- cgit v1.2.3 From 40b9b4816be90ccd514f5245716ec68c9f61277d Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 23 Feb 2014 21:53:35 +0100 Subject: Add the eat command --- src/esieequest/CommandWords.java | 2 +- src/esieequest/Game.java | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/esieequest/CommandWords.java b/src/esieequest/CommandWords.java index 315fc0d..3d8855d 100644 --- a/src/esieequest/CommandWords.java +++ b/src/esieequest/CommandWords.java @@ -12,7 +12,7 @@ package esieequest; */ public class CommandWords { // a constant array that holds all valid command words - private static final String[] sValidCommands = { "go", "quit", "help", "look" }; + private static final String[] sValidCommands = { "go", "quit", "help", "look", "eat" }; /** * Constructor - initialise the command words. diff --git a/src/esieequest/Game.java b/src/esieequest/Game.java index 5fc2813..350fa15 100644 --- a/src/esieequest/Game.java +++ b/src/esieequest/Game.java @@ -226,6 +226,10 @@ public class Game { System.out.println(aCurrentRoom.getLongDescription()); } + private void eat() { + System.out.println("You have eaten now and you are not hungry any more."); + } + /** * "Quit" was entered. Check the rest of the command to see whether we * really quit the game. @@ -256,6 +260,9 @@ public class Game { case "look": this.look(); return false; + case "eat": + this.eat(); + return false; case "help": this.printHelp(); return false; -- cgit v1.2.3 From c08b6b9e4eebbdeb941803aa50200162d4b77924 Mon Sep 17 00:00:00 2001 From: Pacien TRAN-GIRARD Date: Sun, 23 Feb 2014 21:54:14 +0100 Subject: Update report --- report/progression.tex | 2 ++ 1 file changed, 2 insertions(+) diff --git a/report/progression.tex b/report/progression.tex index d1bee91..2f25aea 100644 --- a/report/progression.tex +++ b/report/progression.tex @@ -66,6 +66,8 @@ The look command has been added with the commit 698e3cd25. \subsection{eat} +The eat command has been added with the commit 40b9b4816. + \section{Zuul better v2} -- cgit v1.2.3