diff options
Diffstat (limited to 'src')
52 files changed, 3396 insertions, 101 deletions
diff --git a/src/esieequest/Main.java b/src/esieequest/Main.java index 6e7c0f2..f8b013f 100755 --- a/src/esieequest/Main.java +++ b/src/esieequest/Main.java | |||
@@ -6,7 +6,6 @@ import java.util.List; | |||
6 | import javax.swing.JApplet; | 6 | import javax.swing.JApplet; |
7 | 7 | ||
8 | import esieequest.controller.GameEngine; | 8 | import esieequest.controller.GameEngine; |
9 | import esieequest.model.Game; | ||
10 | import esieequest.view.Viewable; | 9 | import esieequest.view.Viewable; |
11 | import esieequest.view.app.Applet; | 10 | import esieequest.view.app.Applet; |
12 | import esieequest.view.app.Window; | 11 | import esieequest.view.app.Window; |
@@ -32,9 +31,8 @@ public class Main extends JApplet { | |||
32 | */ | 31 | */ |
33 | @Override | 32 | @Override |
34 | public void init() { | 33 | public void init() { |
35 | final Game game = new Game(); | ||
36 | final Applet applet = new Applet(this); | 34 | final Applet applet = new Applet(this); |
37 | new GameEngine(game, applet); | 35 | new GameEngine(applet); |
38 | } | 36 | } |
39 | 37 | ||
40 | /** | 38 | /** |
@@ -47,7 +45,6 @@ public class Main extends JApplet { | |||
47 | */ | 45 | */ |
48 | public static void main(final String[] args) { | 46 | public static void main(final String[] args) { |
49 | final List<String> arguments = Arrays.asList(args); | 47 | final List<String> arguments = Arrays.asList(args); |
50 | Game game; | ||
51 | Viewable view; | 48 | Viewable view; |
52 | 49 | ||
53 | if (arguments.contains("--file")) { | 50 | if (arguments.contains("--file")) { |
@@ -62,13 +59,7 @@ public class Main extends JApplet { | |||
62 | view = new Window(); | 59 | view = new Window(); |
63 | } | 60 | } |
64 | 61 | ||
65 | if (arguments.contains("--challenge")) { | 62 | new GameEngine(view); |
66 | game = new Game(true); | ||
67 | } else { | ||
68 | game = new Game(); | ||
69 | } | ||
70 | |||
71 | new GameEngine(game, view); | ||
72 | } | 63 | } |
73 | 64 | ||
74 | } | 65 | } |
diff --git a/src/esieequest/controller/GameEngine.java b/src/esieequest/controller/GameEngine.java index c3a8725..df83384 100644 --- a/src/esieequest/controller/GameEngine.java +++ b/src/esieequest/controller/GameEngine.java | |||
@@ -25,7 +25,7 @@ public class GameEngine { | |||
25 | * @param view | 25 | * @param view |
26 | * the view | 26 | * the view |
27 | */ | 27 | */ |
28 | public GameEngine(final Game game, final Viewable view) { | 28 | public GameEngine(final Viewable view, final Game game) { |
29 | this.game = game; | 29 | this.game = game; |
30 | this.view = view; | 30 | this.view = view; |
31 | 31 | ||
@@ -35,13 +35,35 @@ public class GameEngine { | |||
35 | } | 35 | } |
36 | 36 | ||
37 | /** | 37 | /** |
38 | * Instantiates a game with the given view and mode. | ||
39 | * | ||
40 | * @param view | ||
41 | * the view | ||
42 | * @param challengeMode | ||
43 | * the mode | ||
44 | */ | ||
45 | public GameEngine(final Viewable view, final boolean challengeMode) { | ||
46 | this(view, new Game(challengeMode)); | ||
47 | } | ||
48 | |||
49 | /** | ||
50 | * Instantiates a game with the given view. | ||
51 | * | ||
52 | * @param view | ||
53 | * the view | ||
54 | */ | ||
55 | public GameEngine(final Viewable view) { | ||
56 | this(view, false); | ||
57 | } | ||
58 | |||
59 | /** | ||
38 | * Interprets a command. | 60 | * Interprets a command. |
39 | * | 61 | * |
40 | * @param commandString | 62 | * @param commandString |
41 | * the command String | 63 | * the command String |
42 | */ | 64 | */ |
43 | public void interpret(final String inputString) { | 65 | public void interpret(final String inputString) { |
44 | final Input input = new Input(inputString.toLowerCase()); | 66 | final Input input = new Input(inputString/* .toLowerCase() */); |
45 | 67 | ||
46 | final Command command = input.getCommand(); | 68 | final Command command = input.getCommand(); |
47 | if (command == null) { | 69 | if (command == null) { |
@@ -56,7 +78,7 @@ public class GameEngine { | |||
56 | } | 78 | } |
57 | 79 | ||
58 | /** | 80 | /** |
59 | * Actions executed every time a Command is entered. | 81 | * Performs routine actions executed every time a Command is entered. |
60 | */ | 82 | */ |
61 | private void executeRoutines() { | 83 | private void executeRoutines() { |
62 | MovingCharacter.moveAll(); | 84 | MovingCharacter.moveAll(); |
diff --git a/src/esieequest/controller/commands/Command.java b/src/esieequest/controller/commands/Command.java index 7ab6961..094b0cf 100644 --- a/src/esieequest/controller/commands/Command.java +++ b/src/esieequest/controller/commands/Command.java | |||
@@ -3,7 +3,7 @@ package esieequest.controller.commands; | |||
3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
4 | import java.util.List; | 4 | import java.util.List; |
5 | 5 | ||
6 | import esieequest.controller.Utils; | 6 | import esieequest.controller.utils.ListUtils; |
7 | import esieequest.model.Game; | 7 | import esieequest.model.Game; |
8 | import esieequest.model.Text; | 8 | import esieequest.model.Text; |
9 | import esieequest.view.Viewable; | 9 | import esieequest.view.Viewable; |
@@ -94,7 +94,7 @@ public enum Command { | |||
94 | * @return a String listing all the names of the Command-s | 94 | * @return a String listing all the names of the Command-s |
95 | */ | 95 | */ |
96 | public static String listCommandsNamesString() { | 96 | public static String listCommandsNamesString() { |
97 | return Utils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.getText(), null, Text.HELP_SUFFIX.getText()); | 97 | return ListUtils.listToString(Command.listCommandsNames(), Text.HELP_PREFIX.getText(), null, Text.HELP_SUFFIX.getText()); |
98 | } | 98 | } |
99 | 99 | ||
100 | } | 100 | } |
diff --git a/src/esieequest/controller/commands/GoCommand.java b/src/esieequest/controller/commands/GoCommand.java index 9ebdf49..1c528fa 100644 --- a/src/esieequest/controller/commands/GoCommand.java +++ b/src/esieequest/controller/commands/GoCommand.java |