public class Robot
extends java.lang.Object
Constructor and Description |
---|
Robot()
Constructs a robot at grid location (0, 0).
|
Robot(int x,
int y,
java.lang.String imageFile)
Constructs a robot at a given grid location.
|
Modifier and Type | Method and Description |
---|---|
void |
createHorizontalWall(double x,
double y)
Creates a horizontal wall at a given grid location.
|
void |
createHorizontalWindow(double x,
double y)
Creates a horizontal window at a given grid location.
|
void |
createVerticalWall(double x,
double y)
Creates a vertical wall at a given grid location.
|
void |
createVerticalWindow(double x,
double y)
Creates a vertical window at a given grid location.
|
boolean |
frontHasWallorWindow()
Checks whether there is a wall or window in front of this robot.
|
void |
moveForward()
Moves this robot one step in the direction that it is facing.
|
boolean |
rightHasWall()
Checks whether there is a wall to the right of this robot.
|
void |
say(java.lang.String message)
Makes this robot say something.
|
void |
setSnapshots(boolean snapshots)
Turns snapshots on or off.
|
void |
turnLeft()
Turns this robot 90 degrees left.
|
void |
turnRight()
Turns this robot 90 degrees right.
|
public Robot()
public Robot(int x, int y, java.lang.String imageFile)
x
- the horizontal grid location of the roboty
- the vertical grid location of the robotimageFile
- the Robot imagepublic void moveForward()
public void turnRight()
public void turnLeft()
public void say(java.lang.String message)
message
- the text that the robot sayspublic boolean frontHasWallorWindow()
public boolean rightHasWall()
public void createHorizontalWall(double x, double y)
x
- the horizontal grid location of the starting point of the wally
- the vertical grid location of the starting point of the wallpublic void createVerticalWall(double x, double y)
x
- the horizontal grid location of the starting point of the wally
- the vertical grid location of the starting point of the wallpublic void createHorizontalWindow(double x, double y)
x
- the horizontal grid location of the starting point of the windowy
- the vertical grid location of the starting point of the windowpublic void createVerticalWindow(double x, double y)
x
- the horizontal grid location of the starting point of the windowy
- the vertical grid location of the starting point of the windowpublic void setSnapshots(boolean snapshots)
snapshots
- true to take snapshots before every move and turn