Robot
A field entity that represents a robot on a graphical user interface.
Constructors
Link copied to clipboard
Constructs and initializes a robot at the specified
(x,y)
location in the coordinate space.Constructs and initializes a robot at the specified
(x,y)
location with the viewing direction UP
and 0 coins.Constructs and initializes a robot at the specified
(x,y)
location, viewing direction and number of coins.Constructs and initializes a robot at the specified
(x,y)
location, viewing direction and number of coins.Constructs and initializes a robot at the specified
(x,y)
location with the viewing direction UP
and 0 coins and places it on the given world.Constructs and initializes a robot at the specified
(x,y)
location with the viewing direction UP
and 0 coins and places it on the given world.Constructs and initializes a robot at the specified
(x,y)
location, viewing direction, number of coins and places it on the given world.public void Robot(KarelWorld world, int x, int y, Direction direction, int numberOfCoins, RobotFamily robotFamily)
Constructs and initializes a robot at the specified
(x,y)
location, viewing direction, number of coins and places it on the given world.Constructs and initializes a robot with the properties of the specified robot.
Constructs and initializes a robot at the specified
(x,y)
location, viewing direction and number of coins.Properties
Link copied to clipboard
public int numberOfCoins
The number of coins that this robot currently owns.
Link copied to clipboard
The image identification of this robot.
Functions
Link copied to clipboard
Returns the current viewing direction of this robot.
Link copied to clipboard
Returns the robot family of this robot.
Link copied to clipboard
Returns the current number of coins this robot has.
Link copied to clipboard
Returns the robot family of this robot.
Link copied to clipboard
Returns
true
if this robot has any coins.Link copied to clipboard
Returns
true
if the current viewing direction of this robot is down.Link copied to clipboard
Returns
true
if the current viewing direction of this robot is left.Link copied to clipboard
Returns
true
if the current viewing direction of this robot is right.Link copied to clipboard
Returns
true
if the current viewing direction of this robot is up.Link copied to clipboard
Returns
true
if there is no object in front of this robot, which can collide with it at the next step (e.g.Link copied to clipboard
Returns
true
if this robot is on a coin, more precisely if the current position of this robot is equal to the position of a coin.Link copied to clipboard
Returns
true
if this robot is on another robot, more precisely if the current position of this robot is equal to the position of the other robot.Link copied to clipboard
Returns
true
if this robot is on another robot, more precisely if the current position of this robot is equal to the position of the other robot.Link copied to clipboard
Returns
true
if robot tracing is enabled.Link copied to clipboard
Returns
true
if this robot is turned off.Link copied to clipboard
Returns
true
if this robot is turned on.Link copied to clipboard
Sets the robot family of this robot.
Link copied to clipboard
Sets the current number of coins this robot has.
Link copied to clipboard
Enables or disables robot tracing in the console.
Link copied to clipboard
Sets the robot family of this robot.