In the world of objectKarel and to be more specific in every corner there can be one or more robots that face in one of the four directions. The robots of the basic class havethe ability to respond to five messages. The five messages and the corresponding methods, or in other words the way that a robot acts when it receives each one of these messages are:
move() Therobot moves forward, without changing direction. In order to avoid damage the robot does not move if it realizes – with its camera – that there is a wall in front, either it is a boundary wall or awall section. On the contrary, the robot terminates its function with an action known as an error shutoff.
turnLeft() The robot turns left 90o without changing corner.
pickBeeper() Therobot picks up with its mechanical arm a beeper from the corner and places it in its insulated bag. If there is not any beeper in the corner the robot turns itself off, an action known as error shutoff.putBeeper() Τhe robot takes a beeper from its bag and places it on the current corner. If there is not any beeper in the bag the robot turns itself off, an action known as error shutoff.turnΟff() Τhe robot turns itself off and stops executing our commands. If a program does not contain the method turnOff() then the robot executes all the statements of the program. This method isneeded in very few situations and prevents robots from executing indefinitely some statements.
Each object (robot) is self-sufficient, in other words it has its own «natural» existence andidentity. Practically it means that even if we have two robots of the basic family/model that have the same attributes and the same abilities, these two robots are two independent objects. That is whywe always use the name of the object to who we send the message to. For example, if we want to send the message move() to an robot named Karel the message will have the following form: