Class Robota
In: karel/robota.rb
Parent: Object

A general framework in which robots of various kinds may be defined. It does not, however, define any instantiable robots. The actions of robots are declared, but not defined here. Also defined is an assertion API that the programmer may use to make assertions about the state of a robot. the requires (above) determine whether the world is graphical or text based.

Methods

Included Modules

Assertions

Constants

NORTH = NorthDirection.instance
WEST = WestDirection.instance
SOUTH = SouthDirection.instance
EAST = EastDirection.instance
INFINITY = $INFINITY
World = RobotWorld.instance()
NextDirection = {NORTH => WEST, WEST => SOUTH, SOUTH => EAST, EAST => NORTH}

Public Class methods

Place a robot at a given corner (street, avenue) facing a given direction, with an initial number of beepers in its beeper bag

Return the next counter-clockwise direction from the one specified

Public Instance methods

Move one block in the current direction (provided the front is clear)

Pick a beeper from the current corner (provided there is one to pick)

Put a beeper on the current corner (provided the robot has one in the beeper bag)

Implement this as the robot task in a subclass for use with the thread subsystem

Turn 90 degrees to the left from the current direction

Turn off, making further actions impossible

[Validate]