public class Player
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
boolean |
canMove(Direction d)
Tells whether the player can move in direction d.
|
void |
checkIsInMaze()
Throws PlayerNotInMazeException if player is not in maze.
|
void |
exitMaze()
Get player out of the maze.
|
MazeSolvingAlgorithm |
getMazeSolvingAlgorithm()
Returns the solving algorithm associated with the player.
|
int |
getPlayerId()
Get player id.
|
int |
getPositionColumn()
Returns the current position of the player.
|
int |
getPositionLine()
Returns the current position of the player.
|
PlayerStateForMazeAlgo |
getStateForMazeAlgo() |
boolean |
isInMaze()
Tells whether the player is in the maze.
|
void |
move(Direction direction)
Move in the requested direction.
|
void |
setMazeSolvingAlgorithm(MazeSolvingAlgorithm mazeSolvingAlgorithm)
Associates a maze solving algorithm to that player.
|
void |
setPosition(int i,
int j)
Sets the current position of the player.
|
public Player(Maze maze, int i)
public int getPositionColumn() throws PlayerNotInMazeException
PlayerNotInMazeException
public int getPositionLine() throws PlayerNotInMazeException
PlayerNotInMazeException
public void setPosition(int i, int j) throws CellDoesNotExistException
i
- linej
- columnCellDoesNotExistException
- in case (i,j) does not existpublic void exitMaze()
public boolean canMove(Direction d)
d
- direction where we want to know if we can movepublic void move(Direction direction) throws PlayerCannotMoveException
direction
- PlayerCannotMoveException
- in case we cannot move in this directionpublic boolean isInMaze()
public void checkIsInMaze() throws PlayerNotInMazeException
PlayerNotInMazeException
- in case player is not in mazepublic int getPlayerId()
public PlayerStateForMazeAlgo getStateForMazeAlgo()
public MazeSolvingAlgorithm getMazeSolvingAlgorithm()
public void setMazeSolvingAlgorithm(MazeSolvingAlgorithm mazeSolvingAlgorithm) throws AchaMazeException
mazeSolvingAlgorithm
- a instance of maze solving algorithmAchaMazeException
- in case the algorithm is associated to another player