1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
|
\chapter{Work progression}
\section{Zuul bad}
\section{Zuul better v1}
\subsection{printLocationInfo}
This code duplication has been previously avoided with the printRoomInfo()
method.
It has been renamed to printLocationInfo(), as part of the commit e52a34789, to
match the exercise.
\subsection{getExit}
The exit attributes have been made private and a getter was added in commit
53c427ff3. A switch statement has been used instead of multiple if statements.
\subsection{getExitString}
This method has been added as part of commit ca65af2e2.
\subsection{HashMap, setExit}
Room exits are now stored in an HashMap since commit c9d890b9b. The setExits()
method has been replaced by setExit() which takes advantages of the HashMap.
\subsection{Vertical direction}
In commit 4145a5e8c, the getExitString() method has been modified to be able to
print the availability of the new exits, used in the stairwell at wing 3. Due
to the architecture of these rooms, the side exits that were previously settled
to link them have been kept.
\subsection{keySet ?}
The keySet() method of the class HashMap returns a Set of the keys contained in
the map.
\subsection{getExitString ?}
The getExitString() method returns a String listing the room's exits.
To achieve that, it iterates through the exits Map's keys, that is a Set of
Strings, appending each one to the String that it returns.
\subsection{getLongDescription}
The Room class now uses the previously explained getExitString() method and
includes the getLongDescription() method that returns the full description of
the room since commit e510b08d0.
\subsection{Object diagram}
%TODO
\subsubsection{Changes on execution}
%TODO
\section{Zuul with features}
\subsection{look}
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}
\subsection{showAll, showCommands}
This modifications are part of the commit 79d33230b.
\subsection{Adding commands}
Adding new commands would not require modifying the printHelp() method anymore.
However, adding new commands and related functions would still require editing
the Game class and its processCommand() method.
\subsection{getCommandList}
The command list is not printed in the CommandWords class anymore. Instead, this
class returns a String, forwarded by the Parser class, that is then printed in
the Game class, thanks to commit 5f1d0ada2.
\subsection{Comparison with reference}
The printLocationInfo() method, used only twice, has been trimmed by the commit
590a932e5 and has been replaced by a call to the getLongDescription() method of
the Room class.
A missing getter for the Room description has been added as part of the commit
f84606424.
The loop building the command list String has been modified to use an Iterator
with the commit 0c5793abf.
\subsection{StringBuilder}
The command list and the exit list are now created using a StringBuilder since
commit ee5ec33aa. This avoids the creation of a new String object at each
concatenation, and thus allows better performances.
\subsection{Room objects}
Rooms are now stored in an HashMap since commit f64f1ffb0, so they can be
passed to any method in any class.
\section{Zuul with images}
\subsection{Game, GameEngine, UserInterface}
The following methods was implemented as part of commit 54e102463.
\subsubsection{Game}
The constructor of this class instantiates the GameEngine and the UserInterface,
and set the output of the first to the second.
\subsubsection{GameEngine}
This class contains the attributes and methods previously contained in the Game
class.
Instead of printing to the standard console output, it prints to the GUI.
\subsubsection{UserInterface}
This class implements the graphical user interface of the game. It basically
creates the different window components and provides methods to
interact with them.
\subsection{Parser/Scanner}
Since commands are entered through a text field instead of the console, the
use of Scanner that read from the standard system input is not required anymore.
\subsection{addActionListener() and actionPerformed()}
The addActionListener() of an object x takes as parameter an object y that have
a actionPerformed() method. When an action event occurs on x, this method on y
is called and an ActionEvent is passed as parameter.
The actionPerformed() method then does the appropriate action according to the
event that happened.
\subsection{Add a button}
A help button was added with commit 7f153a4c1. The processCommand() method was
modified to take the command String as parameter instead of reading it only from
the text field, and the actionPerformed() method was modified accordingly to
forward the command.
\section{Zuul MVC}
\subsection{Structure}
Three packages were made to help matching this architecture: model, view and
controller.
The model package contains the objects storing the game state and various
elements representing a data, that is to say the Game, Room and Command classes.
The view package contains the user interfaces, rich and console, that displays
the game state to the user and enable him to interact with the game by firing events to the
controller.
The controller consists of several classes and represents the logic part of the
program, which are the GameEngine, the Interpret, the Parser and the Performer.
They handle the events created by the user's actions and modify the Game model
accordingly, refreshing the view to display the new game state.
Several internal modifications in the existing classes were made in order to
separate the logic from the data storage as part of commit bd639caa0.
\section{Zuul with items v1}
\subsection{Item}
Item support was added as part of commit 3fc06f393.
\subsection{item description}
In order to respect the MVC pattern, the Performer controller should get the
description from the Item model and ask the View to display it.
\subsection{items}
A Room can contain multiple items since commit 04f03d128.
\subsection{Collection choice}
The collection chosen to implement the multiple items support was the HashMap in
order to associate an item name (String) to an Item, so that the user is able
to perform actions on a particular one (take, drop, use, etc\ldots).
\section{Zuul with history}
\subsection{back}
The back command was implemented as part of commit f218bf5fa.
\subsection{back test}
The back command works even with any parameter. We will check this later with
"zuul-with-enums".
\subsection{back back}
When the user enters back twice, he goes two rooms backward. This is working
correctly.
\subsection{Stack}
The Stack class represents a last-in-first-out (LIFO) stack of objects. The push()
method allows to add and element at the top of the stack and the pop() method
allows to retrieve the top item and removes it.
A condition checks whether the Stack is empty before calling the pop() method,
so that the program does not throw an Exception. This resolve the case when the
player is at the starting point.
\section{Zuul with tests}
\subsection{tests}
In the current version of the game, the outputs of commands such as help or quit
might be easily tested. Furthermore, movement from rooms to rooms, and arising
modifications on the model, can also be candidates for testing.
\subsubsection{Automatic tests}
Functionalities of the program can be tested automatically using unit testing
for classes and methods, and interactive testing to simulate the user's
interactions.
Unit tests will later be implemented using the JUnit testing framework.
User interactions like command input can be simulated by reading and
interpreting commands from a text file.
\subsection{test command}
The test command was implemented by modifying the Console view with commit
967f40d71. Instead of reading commands from the user's input from the console,
the Scanner reads the commands from a text file.
This functionnality was not implemented as a command inside the game, but as a
command line flag that can be used by executing the program from a terminal with
``--file <file path>''.
\subsubsection{test files}
Three test files were created. The first one tests simple commands such as help
and quit, the second one explores all rooms, and the last one executes all actions
to win the game.
\section{Zuul with items v2}
\subsection{Player}
The current room and the previous rooms were moved from Game to Player with
commit 92f671b84.
\subsection{take, drop}
The take and drop commands were implemented as part of the commit number
5ddb6df63. An Inventory interface, used by the Room and Player classes, was
added. Items are stored using HashMaps, and a moveItem procedure was added to
the Performer.
\subsection{Carry several items}
Multiple items carrying was already implemented in the commit number 5ddb6df63.
\subsection{ItemList}
The ItemList was implemented as the Inventory class in commit number db2c22c9b.
The Inventory is no longer an interface.
\subsection{Maximum weight}
The maximum carryable weight was implement with the commit number b8771ccb2.
In order to achieve this, a getTotalWeight() function was added to the Inventory
class.
\subsection{Inventory}
The player's inventory items listing was implemented with the commit number
a3f6ce16e, using the recently added listing utility class.
\subsection{Magic cookie}
Since there are already too many commands, the carryable weight
expansion was implemented in a smarter way using a negative weight
item in the commit number 35ee3b1ee.
We could have instead increased the maximum carryable weight with a setter on
the Player class, called by the Performer with the ``eat'' command.
\subsection{Tests}
The commands test file was updated in the commit number 7b610fc05.
\section{Zuul with enums}
\subsection{switch}
The String switch statement was replaced by an enum switch with the
commit number d24dd6cc9. Instead of using an HashMap to match entered Strings to
the corresponding enum value, the valueOf() method was used.
\subsection{help with enum}
The help command now generates the list of the available commands from the enum
with the commit number 159b168b2.
\section{Zuul extended}
\subsection{Time limit}
The time limit was implemented as a steps limit for the player. When this limit
is reached, the game quits with a message. The argument --challenge is necessary
to enable this game mode. Commit number 2fee72805.
\subsection{GUI}
The actuel GUI will be improved at the end of the project, when all new
functionnalities will be implemented.
\subsection{Trap door}
A TrapDoor was added to link the main map to the off-script map, and all Rooms
are linked through Doors since the commit number 6e388ec78. When crossing a
TrapDoor, the Performer clears the Player's previous Rooms Stack.
\subsection{Beamer}
A Beamer was added with the commit number 6a154d2fe. It can be used once picked
up via the ``use'' command. It alternatively memorises the player's current room
and teleports him back.
\subsection{Locked door}
A locked door was implement with the commit number e9c61548b. To pass through,
the player needs to pick up a corresponding key.
\subsection{Tests}
The test files were updated to fit the last modifications.
\subsection{Transporter room}
The transporter was implemented as a sub-type of Door instead of Room, since the
Player has to be transported when he crosses the Door. This is part of the
commit number c5a766345.
\subsubsection{alea}
\subsection{Inheritance}
\subsection{Abstract Command}
\subsection{Packages}
\subsection{Character}
\subsubsection{Moving character}
\section{Zuul without BlueJ}
\subsection{main}
\subsection{jar}
\subsection{JApplet}
\section{Zuul awesome}
\subsection{Non-droppable items}
Non-droppable items were added with the commit number ef51d5137.
\subsection{Hidden doors}
Hidden Doors that are not shown as exits were added with the commit number
20c9b8b28.
\subsection{Room sides}
\subsection{Quests}
\subsection{Better GUI}
As applets were designated as deprecated a long time ago, and because newer
versions of the Oracle Java Runtime Environment are requiring a mandatory code
signing certificate that we can not affors, a new graphical interface using the
Google Web Toolkit was implemented.
This set of tools enabled translating the game code from Java to Javascript,
allowing its execution directly in the user's browser, without the need of
having the Java Runtime Environment installed.
This addition made in commit 12a0686cb was facilitated by the use of the MVC
model and required a few changes in the core classes.
\subsection{Music}
\subsection{Scenes}
\subsection{Save/load game}
\subsubsection{save}
\subsubsection{load}
\subsection{More tests}
\section{Not Zuul}
\subsection{maximum}
\subsection{static}
\subsubsection{Properties}
\subsubsection{numberOfInstances}
\subsection{currentTimeMillis}
|