Karel (programming language)

With Niki - the robot (often Niki or NIKI ) is called a group of programs that are based on the developed by Richard E. Pattis idea of ​​" Karel the Robot ". It is deliberately rudimentary held programming languages ​​( so-called mini- languages ​​) to facilitate entry into the algorithms. Programming is a virtual robot which moves on a field tile and pick up objects and can unload. The program gives beginners a first insight into the world of procedural programming.

Due to the ease of use and the limited instruction set Niki is well suited for the introduction to programming, especially for learning the programming language Pascal.

The robot

The robot is equipped with only the most necessary skills. He can turn left, move a step forward, pick up an object and release an object. More complex movements can be achieved by the combination of simple commands.

The language

The language is similar to Pascal, but language support have been greatly reduced by Niki to keep the initial difficulties in learning programming as low as possible.

The Niki language includes procedures, recursion, repetition instructions Repeat Until and WHILE DO, and the branching IF THEN ELSE. A great importance is the early introduction of the procedure concept. This permits above the few Niki statements drehe_links, nimm_auf and gib_ab be extended effectively.

The modes

There are two modes by which the little robot Niki can be controlled, the hand control and program control.

Program control

The structure of a program is the same as in Pascal:

Comments start with { and end with }.

PROGRAM ; PROCEDURE drehe_rechts;     BEGIN         drehe_links;         drehe_links;         drehe_links;     END; BEGIN     before;     drehe_rechts;     { etc. } END. The commands in order to address the robot:

Variations

Besides Niki - the robot, there are a variety of variations of the same idea. In addition to the ancestor of Karel, the robot especially hamsters, Kara, of beetles, Robi, the robot and Robot Karol are known. Much more complex is the Logo programming language, but based on the same principles ( " Turtle - control").

604404
de