[Top] - [Next] - [Previous]

The Screen

  1. Displaying Karel's World
  2. The Top Four Lines on the Screen

After the simulator reads the description of Karel's initial situation from your file, it will display a picture of Karel and his initial situation on your screen. For the initial situation in STAIR.WOL, the following picture of Karel's world will appear on your screen:

Enter Execution Mode([A]utomatic, [M]onitor, or [E]xplain)[M]:
Defined Instruction      Corner    Facing    Beep-Bag  Beep-Corner  Executed
BEGINNING-OF-EXECUTION    (1,2)      East       Empty         None         0
St.!
  9! .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
   !
  8! .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
   !
  7! .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
   !
  6! .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
   !
  5! .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
   !
  4! .   .   .   .   1   .   .   .   .   .   .   .   .   .   .   .   .
   !               +---+
  3! .   .   .   1 ! . ! .   .   .   .   .   .   .   .   .   .   .   .
   !           +---+   !
  2! .   .   1 ! .   . ! .   .   .   .   .   .   .   .   .   .   .   .
   !       +---+       !
  1! .   > ! .   .   . ! .   .   .   .   .   .   .   .   .   .   .   .
   +-------+-----------+------------------------------------------------
     1   2   3   4   5   6   7   8   9  10  11  12  13  14  15  16  17 Ave.

Displaying Karel's World

The left side of the screen shows the street numbers in Karel's world, and the bottom line shows the avenue numbers. The West and South boundaries are drawn with the "|" and "-" characters respectively. Karel is represented by a V-shaped figure (either "^" "V", ">", or "<"), with the vertex of the V-shape showing in which direction he is facing (north, south, east, or west).

Only one character can be printed on each corner, so the following rules are used to determine which character should be printed there: If Karel is on a corner, his shape is printed. Otherwise, empty corners are represented by dots ("."); corners with one through nine beepers are represented by the numbers 1 through 9; corners with more than nine beepers are represented by hashes ("#"); and corners with an infinite number of beepers are represented by "I"s. Note that if Karel is on a corner that also contains any beepers, only Karel is visible (the number of beepers on Karel's corner is printed on his status line).

Horizontal wall sections are represented by horizontal lines and vertical wall sections are represented by vertical lines. A special symbol appears wherever a horizontal and vertical wall intersect (there are many possible combinations).

The Top Four Lines on the Screen

The simulator reserves the top four lines on the screen for special nformation. This section discusses the meanings of these four lines.

The top line of the screen is the place where all the simulator's messages appear.
The second line from the top of the screen is a header line, labeling Karel's status.
The third line actually displays Karel's status, which consists of the following information:
Defined Instruction: The defined instruction that Karel is currently executing. At the start of Karel's execution, the defined instruction always is BEGINNING-OF-EXECUTION.
Corner: Karel's current location. Karel's location is always displayed in the form of "(Street Number, Avenue Number)". In this example he starts at 1st St. & 2nd Ave., which is displayed as (1,2).
Facing: The direction that Karel is facing (either North, South, East, or West).
Beep-Bag: The number of beepers that Karel has in his beeper-bag.
Beep-Corner: The number of beepers that are on the corner Karel is standing at. As we have seen, only one character can be printed on Karel's corner: the simulator prints only the character representing Karel in the direction he is facing. Instead of printing the number of beepers here, that information is displayed on the status line. When Karel moves off his corner, the correct number of beepers is redisplayed there.
Executed: The number of instructions that Karel has executed. Of course, this number is zero at the beginning of Karel's program.
4. The fourth line from the top of the screen is used by the simulator when it is executing Karel's program at Slow Speed or in Explain Execution Mode. These special options are discussed later, mostly in Chapters 4 & 6.

The entire screen actually represents only one window looking in on Karel's infinite world. Whenever Karel wanders off the edge of the screen, the screen will be erased and redrawn, automatically shifting the window to display Karel centered on the screen in his new position. The streets and avenues will be numbered accordingly.

Anti-Panic Note: Some combinations of computer/monitors accidentally erase the picture of Karel's world on your screen. To force the simulator to redraw the world, include the character * in your next command to the simulator (either as a prefix or suffix to the next command that you issue).

[Top] - [Next] - [Previous]