game

Class Fugitive

Implemented Interfaces:
Transport

public class Fugitive
extends AbstractPlayer

Uses class Player to define the properties of a fugitive.
Version:
2.4 (19-APR-2010)
Author:
Shashi Mittal

Field Summary

Fields inherited from class game.AbstractPlayer

position, prevPositions

Fields inherited from interface game.Transport

BLACK, BUS, FERRY, INF, NONE, TAXI, UG

Method Summary

int
changePosition(Node n)
This method changes the position of the fugitive
int
getBlackTickets()
void
setBlackTickets(int n)
Set the number of black tickets the fugitive has initially.
boolean
useBlackTicket()
This is called when a black ticket is used to move the fugitive.

Methods inherited from class game.AbstractPlayer

change, getPosition, getPrevPos

Method Details

changePosition

public int changePosition(Node n)
This method changes the position of the fugitive
Parameters:
n - the node to where fugitive has to be shifted
Returns:
the type of the link connecting n and the previous position of fugitive

getBlackTickets

public int getBlackTickets()
Returns:
the number of black tickets this fugitive has.

setBlackTickets

public void setBlackTickets(int n)
Set the number of black tickets the fugitive has initially.

useBlackTicket

public boolean useBlackTicket()
This is called when a black ticket is used to move the fugitive. It decreases the number of black tickets by 1, if not already zero, and uses a black ticket for the move last made by the fugitive.
Returns:
true if the fugitive can use a black ticket, false otherwise