Interface IMazeService
- All Known Implementing Classes:
MazeService
public interface IMazeService
Interface for MazeService.
Specifies the methods that the MazeService should implement.
-
Method Summary
Modifier and TypeMethodDescriptiongetMaze()Gets the current maze model instance.List<int[]>getPath(int x, int y) Gets the path from the current position (x, y) to the goal as a list of coordinate pairs.booleanhasReachedGoal(IPlayerModel player) Checks if the player has reached the goal position in the maze.booleanisPath(int X, int Y) Checks if the specified coordinates (X, Y) are a path and not a wall.booleanisValidMove(IPlayerModel player, int dx, int dy) Checks if the player's move to the specified direction (dx, dy) is valid within the maze.booleanisWithinBounds(int x, int y) Checks if the specified coordinates (x, y) are within the maze boundaries.voidreset()Resets the maze to its initial state.
-
Method Details
-
isValidMove
Checks if the player's move to the specified direction (dx, dy) is valid within the maze.- Parameters:
player- The player model instance.dx- The delta x value for the move.dy- The delta y value for the move.- Returns:
- True if the move is valid, false otherwise.
-
isWithinBounds
boolean isWithinBounds(int x, int y) Checks if the specified coordinates (x, y) are within the maze boundaries.- Parameters:
x- The x coordinate to check.y- The y coordinate to check.- Returns:
- True if the coordinates are within bounds, false otherwise.
-
isPath
boolean isPath(int X, int Y) Checks if the specified coordinates (X, Y) are a path and not a wall.- Parameters:
X- The x coordinate to check.Y- The y coordinate to check.- Returns:
- True if the coordinates represent a path, false otherwise.
-
hasReachedGoal
Checks if the player has reached the goal position in the maze.- Parameters:
player- The player model instance.- Returns:
- True if the player has reached the goal, false otherwise.
-
reset
void reset()Resets the maze to its initial state. -
getMaze
IMazeModel getMaze()Gets the current maze model instance.- Returns:
- The maze model instance.
-
getPath
Gets the path from the current position (x, y) to the goal as a list of coordinate pairs.- Parameters:
x- The starting x coordinate.y- The starting y coordinate.- Returns:
- The list of coordinate pairs representing the path.
-