Class RobotWorld
In: karel/robot_world.rb
karel/tk_robot_world.rb
Parent: RobotWorldBase

A graphical robot world based on tk graphics. Interacts with KarelWindow.

Methods

Public Class methods

Public Instance methods

Remove all features (walls, beepers) from the world. Robots are not affected

This two dimensional structure has the following properties. Every other row and every other column is initially blank. Each cell is a three char string. Odd numbered rows are initially blank, Even numbered columns are initially blank. The first row will be imaged at the bottom of the output. The first column at the left. The blank rows and columns will eventually hold symbols for walls. Only one symbol can appear in a cell. The entries for corners "." are added first with beepers next and finally robots. The last symbol added is the one shown when the display is printed.

Place a single beeper on a given corner

Place a given number of beepers on a given corner

Place a single wall segment east of a given corner, oriented North-South

Place a single wall segment North of a given corner, oriented East-West

Read a world from a text file with the given name

Read a world from a text file with the given name

Remove a single beeper from a given corner (if any are present)

Save (write) a world in a text file with a given name

Save (write) a world in a text file with a given name

Print a representation of the world (walls, corners, beepers) on std out

Print a representation of the world (walls, corners, beepers) on std out

 Print a representation of the world including robots to std out. Robots will hide beepers and only

one robot can be shown on a corner.

 Print a representation of the world including robots to std out. Robots will hide beepers and only

one robot can be shown on a corner.

Return true if (x,y) is in the visible part of the world delimited by (xBound, yBound)

Return true if there is a wall to the East of the given corner

Return true if there is a wall to the East of the given corner

Return true if there is a wall to the North of the given corner

Return true if there is a wall to the North of the given corner

Return true if there is a wall to the South of the given corner

Return true if there is a wall to the South of the given corner

Return true if there is a wall to the West of the given corner

Return true if there is a wall to the West of the given corner

[Validate]