KarelIntro

Karel - introduction

There is the same page on karelNB page http://karelnb.sourceforge.net/introduction.html.

Do you know robot Karel? It was created by Richard E. Pattis

at Stanford University to teach basic programming skills. Karel was named after Karel Čapek, 
a Czech writer who introduced the word robot. (from Wikipedia). 

Other information see on Wikipedia on (or Czech Wikipedie) or

google. 

Karel was very popular in Czechoslovakia on 8-bit computers. Most of programmers 

began their playing with Karel and QBasic. This pages deal about this version. Other informations on internet.

Robot Karel lives in his Town. The Town is a square (generally a rectangle) of squared fields in which wall or signs can be placed. There are walls around the Town also.

Karel has some basic skills.

  • He can execute atomic commands:
  • STEP Karel moves to next square according his direction
  • LEFT Karel turns left
  • RIGHT Karel turns right (in some implementations must be defined by LEFT)
  • PUT Karel puts a sign under himself (if field is not full)
  • PICK Karel picks a sign from his field (if some sign is there.)
  • STOP Karel stops executing
  • He can identify in which direction is turned
  • NORTH
  • EAST
  • SOUTH
  • WEST
  • (in some implementations only NORTH)
  • He can recognize if there is a wall in his direction
  • He can recognize if there is some sign under him
  • He is angry if he crashes into the wall
  • He is angry if he can't to pick or put a sign
  • He can define new commands by construction
 DEFINE newcommand AS  
   commands
END
commands can be block of atomic commands or structural commands or previously defined commands.
Structural commands are
  • branching :
 IF condition   
  commands
ELSE:
  commands
END
where ELSE part is not mandatory
  • while cycle:
 WHILE condition   
  commands
END:
  • repeat cycle:
 REPEAT # TIMES   
  commands
END
where condition can be
IS WALL, NOT WALL,
IS SIGN, NOT SIGN,
IS NORTH, NOT NORTH , IS EAST, NOT EAST , IS SOUTH, NOT SOUTH , IS WEST, NOT WEST
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo