game
Class Detective
- Transport
Inherits the class AbstractPlayer to define a detective
boolean | canMove(TestBoard board) - Checks if the detective can make a move or not
|
void | change(Node n, int ticket) - This method is a "quick and dirty" way of changing the position of a detective.
|
void | changePosition(Node n, int ticket) - This method changes the position of the detective provided he has the
requisite tickets and the availability of that particular node
|
TreeSet | getPossibleMoves(TestBoard board) - This method returns the possible moves of the detective in a TreeSet
|
int | mobility() - This method calculates the mobility of the detective the mobility is a
parameter which depends on the number of tickets of the detectives and
on the ways the detective can go from his current position to adjacent
positions.
|
void | setStaticState() - This method is used to make the necessary changes in case the detective
cannot move i.e.
|
String | toString() - This method displays the current status of the detective
|
canMove
public boolean canMove(TestBoard board)
Checks if the detective can make a move or not
board
- the current board positions
- true if the detective can move,false if the detective is stranded
change
public void change(Node n,
int ticket)
This method is a "quick and dirty" way of changing the position of a detective.
It does not verify if the move is valid or not. This is supposed to be used in
the tree search algorithm for finding best moves.
n
- the new node position to which the detective will be moved toticket
- the ticket used for moving to the new position
changePosition
public void changePosition(Node n,
int ticket)
This method changes the position of the detective provided he has the
requisite tickets and the availability of that particular node
getPossibleMoves
public TreeSet getPossibleMoves(TestBoard board)
This method returns the possible moves of the detective in a TreeSet
board
- the board of which this detective is a part of
- all the possible moves in TreeSet
mobility
public int mobility()
This method calculates the mobility of the detective the mobility is a
parameter which depends on the number of tickets of the detectives and
on the ways the detective can go from his current position to adjacent
positions.
- the mobility of this detective
setStaticState
public void setStaticState()
This method is used to make the necessary changes in case the detective
cannot move i.e. when the detective is stranded either because it does
not have the required ticket, or all the neighbor nodes are occupied by
other detectives.
toString
public String toString()
This method displays the current status of the detective