kareltherobot
Class Robot

java.lang.Object
  extended byjava.util.Observable
      extended bykareltherobot.UrRobot
          extended bykareltherobot.Robot
All Implemented Interfaces:
Directions, java.lang.Runnable

public class Robot
extends UrRobot
implements Directions

Robot defines the sensing capabilities of Robot objects. Your class should extend this one * if you need these capabilities.


Nested Class Summary
 
Nested classes inherited from class kareltherobot.UrRobot
UrRobot.ConnectStrategy
 
Nested classes inherited from class kareltherobot.Directions
Directions.Direction
 
Field Summary
 
Fields inherited from interface kareltherobot.Directions
East, EastVal, infinity, North, NorthVal, South, SouthVal, West, WestVal
 
Constructor Summary
Robot(int street, int avenue, Directions.Direction direction, int beepers)
          Create a new Robot in a specified state.
Robot(int street, int avenue, Directions.Direction direction, int beepers, java.awt.Color badge)
           
 
Method Summary
 boolean anyBeepersInBeeperBag()
          Determine if the Robot has any beepers in its beeper bag.
 boolean facingEast()
          Determine if the Robot is facing East or not.
 boolean facingNorth()
          Determine if the Robot is facing North or not.
 boolean facingSouth()
          Determine if the Robot is facing South or not.
 boolean facingWest()
          Determine if the Robot is facing West or not.
 boolean frontIsClear()
          Determines if the Robot's front is clear or if it is facing a wall.
 boolean nextToABeeper()
          Determine if there is a beeper on the same corner as this Robot.
 boolean nextToARobot()
          Determine if there is a Robot on the same corner as this Robot.
 
Methods inherited from class kareltherobot.UrRobot
acceptConnection, acceptConnectionFrom, connectTo, getNextCommunication, isVisible, move, neighbors, pickBeeper, putBeeper, run, send, setPause, setUserPause, setVisible, showState, toString, turnLeft, turnOff, userPause, waitForCommunication, waitForNextCommunication
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Robot

public Robot(int street,
             int avenue,
             Directions.Direction direction,
             int beepers)
Create a new Robot in a specified state. * @param street The street on which the robot is created. * @param avenue The avenue on which the robot is created. * @param direction The Direction in which the robot faces, North... * @param beepers A non negative number or the value infinity. The number of beepers to be carried.


Robot

public Robot(int street,
             int avenue,
             Directions.Direction direction,
             int beepers,
             java.awt.Color badge)
Method Detail

frontIsClear

public boolean frontIsClear()
Determines if the Robot's front is clear or if it is facing a wall. * @return true if the robot is not facing a wall.


nextToABeeper

public boolean nextToABeeper()
Determine if there is a beeper on the same corner as this Robot. * @return true if there is at least one beeper on this same corner.


nextToARobot

public boolean nextToARobot()
Determine if there is a Robot on the same corner as this Robot. * @return true if there is at least one other robot on this same corner.


facingNorth

public boolean facingNorth()
Determine if the Robot is facing North or not. * return true if the Robot is facing North. Otherwise return false.


facingSouth

public boolean facingSouth()
Determine if the Robot is facing South or not. * return true if the Robot is facing South. Otherwise return false.


facingEast

public boolean facingEast()
Determine if the Robot is facing East or not. * return true if the Robot is facing East. Otherwise return false.


facingWest

public boolean facingWest()
Determine if the Robot is facing West or not. * return true if the Robot is facing West. Otherwise return false.


anyBeepersInBeeperBag

public boolean anyBeepersInBeeperBag()
Determine if the Robot has any beepers in its beeper bag. * return true if there is at least one beeper in the beeper bag.