|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectKoalaRobot
alice.kareltherobot.UrRobot
alice.kareltherobot.Robot
public class Robot
The Robot subclass of UrRobot can also sense its world. Extend this class to solve some interesting problems. Note that robots in this class still respond to these messages even after the robot has turned off.
Constructor Summary | |
---|---|
Robot(int street,
int avenue,
Direction direction)
Create a robot on a specific street and avenue, facing a given direction with no beepers. |
|
Robot(int street,
int avenue,
Direction direction,
int beepers)
Create a robot on a specific street and avenue, facing a given direction with a given number of beepers. |
|
Robot(int street,
int avenue,
Direction direction,
int beepers,
Color color)
Create a robot on a specific street and avenue, facing a given direction with a given number of beepers and a given head color. |
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 alice.kareltherobot.UrRobot |
---|
assertFacingEast, assertFacingNorth, assertFacingSouth, assertFacingWest, assertFrontIsBlocked, assertFrontIsClear, assertHasBeepers, assertHasNoBeepers, assertNextToABeeper, assertNextToARobot, assertOnAvenue, assertOnStreet, currentState, getCamera, getWorld, move, pickBeeper, putBeeper, setSpeed, setTracing, turnLeft, turnOff |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Robot(int street, int avenue, Direction direction)
street
- the street on which to place the robotavenue
- the avenue on which to place the robotdirection
- the direction the robot will initially facepublic Robot(int street, int avenue, Direction direction, int beepers)
street
- the street on which to place the robotavenue
- the avenue on which to place the robotdirection
- the direction the robot will initially facebeepers
- the initial number of beepers in the beeper bagpublic Robot(int street, int avenue, Direction direction, int beepers, Color color)
street
- the street on which to place the robotavenue
- the avenue on which to place the robotdirection
- the direction the robot will initially facebeepers
- the initial number of beepers in the beeper bagcolor
- the color of this robot's headMethod Detail |
---|
public boolean frontIsClear()
public boolean nextToABeeper()
public boolean anyBeepersInBeeperBag()
public boolean facingNorth()
public boolean facingSouth()
public boolean facingEast()
public boolean facingWest()
public boolean nextToARobot()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |