All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class gpsys.cos.Robot

java.lang.Object
   |
   +----gpsys.cos.Robot

public class Robot
extends Object
implements Serializable
The terrain robot itself is a robot that moves around on a terrain, bumping in the lamps. Unfortunately it only has a limited number of energy units available. These are divided into a number of movements. The terrainrobot therefore stops when these units have run out. Lamps increase their energy at each turn, lose it when the robot bump in. The robot can gain "released" energy from the lamp for itself by going on the Charging Station

Author:
Emmanuel PIERRE
DEA IARFA,

Variable Index

 o direction
The current direction of the robot, can be one of NORTH, EAST, SOUTH or WEST.
 o EAST
The value of direction when the robot is pointing EAST.
 o movementAvailable
The ration of movement operations available.
 o NORTH
The value of direction when the robot is pointing NORTH.
 o ROBOT_SAFE
The energy meaning the robot is safe (for IFDIE op)
 o SOUTH
The value of direction when the robot is pointing SOUTH.
 o terrain
The terrain to be moveed.
 o WEST
The value of direction when the robot is pointing WEST.
 o x
The X corrdinate of the robot on the terrain.
 o y
The Y corrdinate of the robot on the terrain.

Constructor Index

 o Robot(Terrain)
Construct a new robot to terrain the specified terrain.

Method Index

 o back()
Movement energy permitting, moves the robot back by one square in the current direction.
 o forward()
Movement energy permitting, moves the robot forward by one square in the current direction.
 o halt()
Movement energy permitting, moves the robot back by one square in the current direction.
 o ifacs()
At the charging station.
 o ifal()
Lamp detection.
 o ifcharged()
At the charging station and full.
 o ifcsa()
Charging station ahead.
 o ifdie()
If dying.
 o iflgr()
Lamp Greater on Left than Right.
 o ifoba()
Obstacle detection.
 o ifsysunsafe()
System Unsafe !
 o left()
Movement energy permitting, moves the robot forward by one square in the current direction cutting the grass on that square.
 o reset()
Resets the robot state to default values (position = (3,5), direction = SOUTH, movementAvailable = 20*4.
 o right()
Movement energy permitting, moves the robot forward by one square in the current direction cutting the grass on that square.

Variables

 o terrain
 Terrain terrain
The terrain to be moveed.

 o x
 int x
The X corrdinate of the robot on the terrain.

 o y
 int y
The Y corrdinate of the robot on the terrain.

 o direction
 int direction
The current direction of the robot, can be one of NORTH, EAST, SOUTH or WEST.

 o movementAvailable
 int movementAvailable
The ration of movement operations available.

 o NORTH
 public static final int NORTH
The value of direction when the robot is pointing NORTH.

 o EAST
 public static final int EAST
The value of direction when the robot is pointing EAST.

 o SOUTH
 public static final int SOUTH
The value of direction when the robot is pointing SOUTH.

 o WEST
 public static final int WEST
The value of direction when the robot is pointing WEST.

 o ROBOT_SAFE
 public static final int ROBOT_SAFE
The energy meaning the robot is safe (for IFDIE op)

Constructors

 o Robot
 public Robot(Terrain terrain)
Construct a new robot to terrain the specified terrain. The robot starts at the default position and direction. The number of movement operations available are both initialised to 80.

Parameters:
terrain - The terrain.

Methods

 o reset
 public void reset()
Resets the robot state to default values (position = (3,5), direction = SOUTH, movementAvailable = 20*4.

 o ifacs
 public final boolean ifacs()
At the charging station.

 o ifcsa
 public final boolean ifcsa()
Charging station ahead.

 o iflgr
 public final boolean iflgr()
Lamp Greater on Left than Right.

 o ifcharged
 public final boolean ifcharged()
At the charging station and full.

 o ifdie
 public final boolean ifdie()
If dying.

 o ifsysunsafe
 public final boolean ifsysunsafe()
System Unsafe !

 o right
 public final void right()
Movement energy permitting, moves the robot forward by one square in the current direction cutting the grass on that square.

 o left
 public final void left()
Movement energy permitting, moves the robot forward by one square in the current direction cutting the grass on that square.

 o forward
 public final void forward()
Movement energy permitting, moves the robot forward by one square in the current direction.

 o ifoba
 public final boolean ifoba()
Obstacle detection.

 o ifal
 public final boolean ifal()
Lamp detection.

 o back
 public final void back()
Movement energy permitting, moves the robot back by one square in the current direction.

 o halt
 public final void halt()
Movement energy permitting, moves the robot back by one square in the current direction.


All Packages  Class Hierarchy  This Package  Previous  Next  Index