blob: 30976501a094f9b0a4d37596e0ffc712615fae39 (
plain)
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
|
CS-107 - Project 2: Maze
========================
My JAVAmazing Maze.
Maze and Daedalus entities implementation
-----------------------------------------
### Use of Sets
The choices arrays have been replaced by Sets of Direction in order to guarantee the uniqueness of each possibility and
directly provide common collection methods, avoiding costly systematic conversions from array to Collection and vice
versa.
The old methods returning and taking as parameter arrays of Direction have been kept and deprecated to keep the
compatibility with the provided and hidden classes and tests.
### Strategies
Choices elimination and picking strategies have been implemented as "traits" (interfaces with default method in Java)
enabling a better modularization, avoiding code duplication between animals sharing identical behaviours pieces in their
decision making process.
### DaedalusAware interface
Some code shared by the Predator and the Prey classes has been factored in the DaedalusAware interface as default
methods.
### Ghosts
An intermediate Ghost class has been inserted between ghosts and the Predator class in the inheritance chain in order to
implement common behaviours such as the chase mode and the common prey selection and targeting.
### PacMan
The strategy implemented for PacMan to live as long as possible is to simply navigating by maximizing the distance to
the closest Predator.
"Utilities" additions and modifications
---------------------------------------
### Direction
A set of the possible moving directions (excluding the NONE Direction) has been added the the Direction enum class.
### Vector2D
A zero vector constructor has been added the the Vector2D class.
### SimulationGenerator
The simulation generating functions have been moved from the main programs to this utility class.
### Trail
A Trail class handling the Panda's marking has been added.
|