PrintGame
Class Robot

java.lang.Object
  extended byPrintGame.Robot

public class Robot
extends java.lang.Object

class representing a Robot.


Constructor Summary
Robot()
          standard constructor
 
Method Summary
 Direction getCurrentDirection()
           
 int getPosCol()
           
 int getPosRow()
           
 Direction getStartDirection()
           
 int getState()
          method returns the mark new_area_
 void goBack()
          method to move a robot one cell back (relative to his current direction)
 void goLeft()
          method to move a robot one cell left (relative to his current direction)
 void goRight()
          method to move a robot one cell right (relative to his current direction)
 void moveForward()
          method to move a robot one cell forward (relative to his current direction)
protected  void moveInDirection(Direction direction)
          internal method to move a robot one cell to the given direction.
 void setPos(int row, int col)
           
 void setStartDirection(Direction start_direction)
           
 void setState(int state)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Robot

public Robot()
standard constructor

Method Detail

getState

public int getState()
method returns the mark new_area_

Returns:
info about the way the robot has taken when it returns false the robot wasn't on this cell before

getPosRow

public int getPosRow()

getPosCol

public int getPosCol()

getStartDirection

public Direction getStartDirection()

getCurrentDirection

public Direction getCurrentDirection()

setState

public void setState(int state)
              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

setPos

public void setPos(int row,
                   int col)

setStartDirection

public void setStartDirection(Direction start_direction)
                       throws IllegalDirectionException
Throws:
IllegalDirectionException

moveInDirection

protected void moveInDirection(Direction direction)
                        throws IllegalDirectionException
internal method to move a robot one cell to the given direction.

Parameters:
direction -
Throws:
IllegalDirectionException - thrown if the direction isn't valid.

moveForward

public void moveForward()
                 throws IllegalDirectionException
method to move a robot one cell forward (relative to his current direction)

Throws:
IllegalDirectionException - thrown if the direction isn't valid.

goBack

public void goBack()
            throws IllegalDirectionException
method to move a robot one cell back (relative to his current direction)

Throws:
IllegalDirectionException - thrown if the direction isn't valid.

goLeft

public void goLeft()
            throws IllegalDirectionException
method to move a robot one cell left (relative to his current direction)

Throws:
IllegalDirectionException - thrown if the direction isn't valid.

goRight

public void goRight()
             throws IllegalDirectionException
method to move a robot one cell right (relative to his current direction)

Throws:
IllegalDirectionException - thrown if the direction isn't valid.