|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.util.Observable
kareltherobot.ur_Robot
kareltherobot.Robot
cs1705.Robot
cs1705.TestableRobot
cs1705.VPIRobot
A class that represents a robot. This code is based upon Begin's Karel J. Robot work, but has additional VPI functionality and better API documentation.
| Nested Class Summary |
| Nested classes inherited from class kareltherobot.ur_Robot |
kareltherobot.ur_Robot.ConnectStrategy |
| Nested classes inherited from class kareltherobot.Directions |
kareltherobot.Directions.Direction |
| Field Summary |
| Fields inherited from interface kareltherobot.Directions |
East, EastVal, infinity, North, NorthVal, South, SouthVal, West, WestVal |
| Constructor Summary | |
VPIRobot()
Default constructor which places Karel at the intersection of 1st street and 1st avenue, holding no beepers, and facing north. |
|
VPIRobot(int street,
int avenue,
kareltherobot.Directions.Direction direction,
int numberOfBeepers)
Constructor which supports the specific placement, orientation and setting the number of beepers for Karel. |
|
| Method Summary | |
boolean |
anyBeepersInBeeperBag()
Check whether the robot has any beepers in its bag. |
int |
countBeepersInPile()
Returns the number of beepers in the beeper pile (if any ) at the intersection where Karel is located. |
boolean |
facingEast()
Checks whether Karel is currently facing east. |
boolean |
facingNorth()
Checks whether Karel is currently facing north. |
boolean |
facingSouth()
Checks whether Karel is currently facing south. |
boolean |
facingWest()
Checks whether Karel is currently facing west. |
boolean |
frontIsClear()
Check to see if Karel is currently blocked by some obstacle directly in front. |
void |
move()
Moves the robot one space (intersection) forward in the direction the robot is currently facing. |
boolean |
nextToABeeper()
Checks whether Karel is currently at an intersection that also contains a beeper pile of one or more beepers. |
boolean |
nextToARobot()
Checks whether Karel is currently at an intersection that also contains another robot. |
void |
pickBeeper()
Attempts to pick up one beeper from the beeper pile at the intersection where the robot is currently located and place it in the robot's beeper bag. |
void |
putBeeper()
Attempts to place one beeper from the robot's beeper bag in the pile at the intersection where this robot is currently located. |
void |
turnLeft()
Turns this robot 90 degrees to the left. |
void |
turnOff()
Turns off this robot. |
| Methods inherited from class kareltherobot.ur_Robot |
acceptConnection, acceptConnectionFrom, areYouHere, avenue, connectTo, direction, getNextCommunication, isVisible, neighbors, restoreInitialState, run, running, send, setVisible, showState, street, toString, 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 |
public VPIRobot()
public VPIRobot(int street,
int avenue,
kareltherobot.Directions.Direction direction,
int numberOfBeepers)
street - street number of Karel's placementavenue - avenue number of Karel's placementdirection - the direction Karel is pointing in
(North, East, South, West)numberOfBeepers - number of beepers in the beeper bag (>= 0)| Method Detail |
public boolean anyBeepersInBeeperBag()
public int countBeepersInPile()
public boolean facingEast()
public boolean facingNorth()
public boolean facingSouth()
public boolean facingWest()
public boolean frontIsClear()
public void move()
public boolean nextToABeeper()
public boolean nextToARobot()
public void pickBeeper()
public void putBeeper()
public void turnLeft()
public void turnOff()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||