Karel programming language
Encyclopedia
Karel is an educational programming language
Educational programming language
An educational programming language is a programming language that is designed primarily as a learning instrument and not so much as a tool for writing programs for real-world work.-Learning paths:...

 for beginners, created by Richard E. Pattis
Richard E. Pattis
Richard E. Pattis was a professor of Computer Science at Carnegie Mellon University. He is the author of the Karel programming language, and published Karel the Robot: A gentle introduction to the art of programming....

 in his book Karel The Robot: A Gentle Introduction to the Art of Programming. Pattis used the language in his courses at Stanford University
Stanford University
The Leland Stanford Junior University, commonly referred to as Stanford University or Stanford, is a private research university on an campus located near Palo Alto, California. It is situated in the northwestern Santa Clara Valley on the San Francisco Peninsula, approximately northwest of San...

. The language is named after Karel Čapek
Karel Capek
Karel Čapek was Czech writer of the 20th century.-Biography:Born in 1890 in the Bohemian mountain village of Malé Svatoňovice to an overbearing, emotional mother and a distant yet adored father, Čapek was the youngest of three siblings...

, a Czech
Czech people
Czechs, or Czech people are a western Slavic people of Central Europe, living predominantly in the Czech Republic. Small populations of Czechs also live in Slovakia, Austria, the United States, the United Kingdom, Chile, Argentina, Canada, Germany, Russia and other countries...

 writer who introduced the word robot
Robot
A robot is a mechanical or virtual intelligent agent that can perform tasks automatically or with guidance, typically by remote control. In practice a robot is usually an electro-mechanical machine that is guided by computer and electronic programming. Robots can be autonomous, semi-autonomous or...

.

Principles

A program in Karel is used to control a simple robot named Karel that lives in an environment consisting of a grid of streets (left-right) and avenues (up-down). Karel understands five basic instructions: move (Karel moves by one square in the direction he is facing), turnleft (Karel turns 90 ° left), putbeeper (Karel puts a beeper on the square he is standing at), pickbeeper (Karel lifts a beeper off the square he is standing at), and turnoff (Karel switches himself off, the program ends). Karel can also perform boolean queries about his immediate environment, asking whether there is a beeper where he is standing, whether there are barriers next to him, and about the direction he is facing. A programmer can create additional instructions by defining them in terms of the five basic instructions, and by using conditional control flow
Control flow
In computer science, control flow refers to the order in which the individual statements, instructions, or function calls of an imperative or a declarative program are executed or evaluated....

 statements if and while with environment queries, and by using the iterate construct.

Example

The following is a simple example of Karel syntax (a ";" indicates end of instruction, can be omitted if current instruction is followed by an END).
BEGINNING-OF-PROGRAM
 
DEFINE turnright AS
BEGIN
turnleft;
turnleft;
turnleft
END
 
BEGINNING-OF-EXECUTION
ITERATE 3 TIMES
turnright;
move;
turnoff
END-OF-EXECUTION
 
END-OF-PROGRAM

Variants and descendants

The language has inspired the development of various clones and similar educational languages. As the language is intended for beginners, localized variants exist in some languages, notably Czech
Czech language
Czech is a West Slavic language with about 12 million native speakers; it is the majority language in the Czech Republic and spoken by Czechs worldwide. The language was known as Bohemian in English until the late 19th century...

 (the programming language was quite popular in Czechoslovakia
Czechoslovakia
Czechoslovakia or Czecho-Slovakia was a sovereign state in Central Europe which existed from October 1918, when it declared its independence from the Austro-Hungarian Empire, until 1992...

). The Slovak
Slovak language
Slovak , is an Indo-European language that belongs to the West Slavic languages .Slovak is the official language of Slovakia, where it is spoken by 5 million people...

 version, called Robot Karol++, contains further enhancements and it has been itself translated to English, German and Czech.

The principles of Karel were updated to the object-oriented programming
Object-oriented programming
Object-oriented programming is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their interactions – to design applications and computer programs. Programming techniques may include features such as data abstraction,...

 paradigm in a new programming language called Karel++
Karel++
Karel++ is a didactic object-oriented programming language designed solely as an introduction to preliminary, object-oriented programming. It is conceptually based upon a separate programming language called Karel.-Nomenclature:...

. Karel++ is conceptually based on Karel, but uses a completely new syntax, similar to Java
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...

.

A language called Karel is a proprietary language used to program the robots of FANUC Robotics
FANUC Robotics
FANUC or is a Japanese electromechanical manufacturer specializing in robotics. It is one of the largest maker of industrial robots in the world. It is part of the Furukawa Group. FANUC had its beginnings as part of Fujitsu developing numerical control and servo systems...

. However, FANUC Karel is derived from the Pascal programming language1

A REALbasic implementation, rbKarel http://code.google.com/p/rbstuff/wiki/rbKarelOverview, provides the basic Karel commands within an RBScript environment with BASIC syntax being used for loops and conditionals. This teaching project provides a cross-platform GUI for Karel experiments including single-stepping and spoken output.

In 2008 appears also Educational program Robot Emil – interesting 3D free-variation of Robot Karel. Robot Emil operates inside 3D-room with optional dimension, visible through camera view - so it’s possible to watch scene from various angles and distances, rotate it, look robot’s activity in detail etc. Robot can place the bricks of selectable shape and color, paint the walls and floor with color mosaic, make the doors and tunnels through built walls, the windows (using transparent bricks), the roof (using roof-shaped bricks) the grass, paths, lakes (painting the floor-tiles') - so that provides a wide area for the children's creativity, supporting their algorithmic thinking and spatial imagination, together with learning a basics of computer programming.
Original version is Slovakian, since 2009 exists English
English language
English is a West Germanic language that arose in the Anglo-Saxon kingdoms of England and spread into what was to become south-east Scotland under the influence of the Anglian medieval kingdom of Northumbria...

, Czech
Czech language
Czech is a West Slavic language with about 12 million native speakers; it is the majority language in the Czech Republic and spoken by Czechs worldwide. The language was known as Bohemian in English until the late 19th century...

 and Slovak
Slovak language
Slovak , is an Indo-European language that belongs to the West Slavic languages .Slovak is the official language of Slovakia, where it is spoken by 5 million people...

 language version.

See also

  • Karel++
    Karel++
    Karel++ is a didactic object-oriented programming language designed solely as an introduction to preliminary, object-oriented programming. It is conceptually based upon a separate programming language called Karel.-Nomenclature:...

     - object oriented Karel environment
  • Guido van Robot
    Guido van Robot
    Guido van Robot is an educational tool to help students learn the Python programming language, named after the creator of Python, Guido van Rossum. GvR uses the idea behind Karel the Robot, making the learning of Python programming more interesting...

     - A tool based on Karel the Robot for learning Python
  • Educational programming language
    Educational programming language
    An educational programming language is a programming language that is designed primarily as a learning instrument and not so much as a tool for writing programs for real-world work.-Learning paths:...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK