Command reference

Below are all commands available to students in the Robot simulator. Use from robot import * in your program, or import only the names you need.

Choosing a task or creating a field

task(task_id)
Starts the selected task.
field(width=8, height=6)
Opens a grid of the given size without tying it to a task. Width from 1 to 25, height from 1 to 15. Robot starts at the top-left; the goal is the bottom-right.

Action commands

move_right()
Moves the Robot one cell to the right.
move_left()
Moves the Robot one cell to the left.
move_up()
Moves the Robot one cell up.
move_down()
Moves the Robot one cell down.
paint()
Paints the current cell.
printn(value)
Prints an integer in the current cell.

Environment analysis

is_free_left()
Returns True if there is no wall on the left.
is_free_right()
Returns True if there is no wall on the right.
is_free_up()
Returns True if there is no wall above.
is_free_down()
Returns True if there is no wall below.
is_wall_left()
Returns True if there is a wall on the left.
is_wall_right()
Returns True if there is a wall on the right.
is_wall_up()
Returns True if there is a wall above.
is_wall_down()
Returns True if there is a wall below.
is_cell_painted()
Returns True if the current cell is painted.
is_cell_not_painted()
Returns True if the current cell is not painted.
pol()
Returns the pollution value of the current cell.