Package com.edu.xmum.CST210.Service
Class AiService
java.lang.Object
com.edu.xmum.CST210.Service.AiService
- All Implemented Interfaces:
IAiService
Implementation of the IAiService interface.
Provides methods to handle AI-related logic within the maze.
-
Constructor Summary
ConstructorsConstructorDescriptionAiService(IMazeService mazeService, IPlayerModel playerModel, IPlayerModel aiModel) Constructor for AiService. -
Method Summary
-
Constructor Details
-
AiService
Constructor for AiService. Uses dependency injection to initialize the maze service, player model, and AI model.- Parameters:
mazeService- The maze service instance.playerModel- The player model instance.aiModel- The AI model instance.
-
-
Method Details
-
moveAi
public void moveAi()Moves the AI towards the player using the A* algorithm.- Specified by:
moveAiin interfaceIAiService
-
isPlayerCaught
public boolean isPlayerCaught()Checks if the AI has caught the player.- Specified by:
isPlayerCaughtin interfaceIAiService- Returns:
- True if the AI has caught the player, false otherwise.
-
getAiModel
Gets the AI model instance.- Specified by:
getAiModelin interfaceIAiService- Returns:
- The AI model instance.
-
reset
public void reset()Resets the AI's position to its initial start position.- Specified by:
resetin interfaceIAiService
-