karel
Class Robot
java.lang.Object
|
+--karel.Robot
- public class Robot
- extends java.lang.Object
Constructor Summary |
Robot()
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NORTH
public static final int NORTH
WEST
public static final int WEST
SOUTH
public static final int SOUTH
EAST
public static final int EAST
LocationProperty
public static final java.lang.String LocationProperty
DirectionProperty
public static final java.lang.String DirectionProperty
BeepersProperty
public static final java.lang.String BeepersProperty
Robot
public Robot()
directionToString
public static java.lang.String directionToString(int d)
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
addPropertyChangeListener
public void addPropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
removePropertyChangeListener
public void removePropertyChangeListener(java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
setWorld
public void setWorld(World w)
setProgram
public void setProgram(Program p)
setStreet
public void setStreet(int s)
getStreet
public int getStreet()
setAvenue
public void setAvenue(int a)
getAvenue
public int getAvenue()
setDirection
public void setDirection(int d)
getDirection
public int getDirection()
getBeepers
public int getBeepers()
- Returns the number of beepers in the beeper bag
setBeepers
protected void setBeepers(int nBeepers)
start
public void start()
execute
public boolean execute(Program p)
throws KarelException
- For backward compatibility. Deprecate soon.
Used in Parser test code, and Trace test code.
turnleft
public void turnleft()
move
public void move()
throws KarelOutOfBoundsException,
KarelCrashedException
pickBeeper
public void pickBeeper()
throws KarelNoBeeperAtCornerException
putBeeper
public void putBeeper()
- TODO: bounds checking on putBeeper! Is beeper bag empty?
turnoff
public void turnoff()
isDirBlocked
public boolean isDirBlocked(int direction)
anyBeepersInBeeperBag
public boolean anyBeepersInBeeperBag()
facingEast
public boolean facingEast()
facingNorth
public boolean facingNorth()
facingSouth
public boolean facingSouth()
facingWest
public boolean facingWest()
frontIsBlocked
public boolean frontIsBlocked()
frontIsClear
public boolean frontIsClear()
leftIsBlocked
public boolean leftIsBlocked()
leftIsClear
public boolean leftIsClear()
nextToABeeper
public boolean nextToABeeper()
noBeepersInBeeperBag
public boolean noBeepersInBeeperBag()
notFacingEast
public boolean notFacingEast()
notFacingNorth
public boolean notFacingNorth()
notFacingSouth
public boolean notFacingSouth()
notFacingWest
public boolean notFacingWest()
notNextToABeeper
public boolean notNextToABeeper()
rightIsBlocked
public boolean rightIsBlocked()
rightIsClear
public boolean rightIsClear()