uk.ac.nott.cs.g54dia.library
Class Tanker

java.lang.Object
  extended by uk.ac.nott.cs.g54dia.library.Tanker
Direct Known Subclasses:
DemoTanker

public abstract class Tanker
extends java.lang.Object

An abstract base class for Tankers in the standard Environment.


Field Summary
(package private)  int completedCount
          The initial number of tasks completed
static Point FUEL_PUMP_LOCATION
          Location of fuel pump
(package private)  int fuelLevel
          The initial level of fuel in the tanker
static int MAX_FUEL
          The maximum amount of fuel a Tanker can have.
static int MAX_WATER
          The maximum amount of water a Tanker can have.
(package private)  Point position
          The Tanker's current position in the environment.
static int VIEW_RANGE
          The distance a Tanker can "see".
(package private)  int waterDelivered
          The total amount of water delivered (completed tasks only)
(package private)  int waterLevel
          The initial level of water in the tanker
 
Constructor Summary
Tanker()
           
 
Method Summary
 int getCompletedCount()
          Get the number of tasks completed
 Cell getCurrentCell(Cell[][] view)
          Get the cell currently occupied by the Tanker.
 int getFuelLevel()
          How much fuel does this tanker have?
 Point getPosition()
          Get the Tanker's current position in the environment.
protected  int getScore()
           
 int getWaterLevel()
          How much water does this tanker have?
protected  void incCompleted()
          Increment Completed count
abstract  Action senseAndAct(Cell[][] view, long timestep)
          Sub-classes must implement this method to provide the "brains" for the Tanker.
 void useFuel(int amount)
          Use fuel - used by move actions/
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fuelLevel

int fuelLevel
The initial level of fuel in the tanker


waterLevel

int waterLevel
The initial level of water in the tanker


completedCount

int completedCount
The initial number of tasks completed


waterDelivered

int waterDelivered
The total amount of water delivered (completed tasks only)


MAX_FUEL

public static final int MAX_FUEL
The maximum amount of fuel a Tanker can have.

See Also:
Constant Field Values

MAX_WATER

public static final int MAX_WATER
The maximum amount of water a Tanker can have.

See Also:
Constant Field Values

VIEW_RANGE

public static final int VIEW_RANGE
The distance a Tanker can "see".

See Also:
Constant Field Values

FUEL_PUMP_LOCATION

public static final Point FUEL_PUMP_LOCATION
Location of fuel pump


position

Point position
The Tanker's current position in the environment.

Constructor Detail

Tanker

public Tanker()
Method Detail

senseAndAct

public abstract Action senseAndAct(Cell[][] view,
                                   long timestep)
Sub-classes must implement this method to provide the "brains" for the Tanker.

Parameters:
view - the cells the Tanker can currently see
timestep - The current timestep
Returns:
an action to perform

useFuel

public void useFuel(int amount)
             throws ActionFailedException
Use fuel - used by move actions/

Throws:
ActionFailedException

getFuelLevel

public int getFuelLevel()
How much fuel does this tanker have?


getWaterLevel

public int getWaterLevel()
How much water does this tanker have?


getPosition

public Point getPosition()
Get the Tanker's current position in the environment.


getCurrentCell

public Cell getCurrentCell(Cell[][] view)
Get the cell currently occupied by the Tanker.

Parameters:
view - the cells the Tanker can currently see
Returns:
a reference to the cell currently occupied by this Tanker

getCompletedCount

public int getCompletedCount()
Get the number of tasks completed


incCompleted

protected void incCompleted()
Increment Completed count


getScore

protected int getScore()