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.