Karel J Robot - Chapter 1: Karel's World               BACK TO KAREL MAIN


Karel's World consists of a grid of streets and avenues. Streets run East-West and avenues run North-South (see Figure 1 below). Since there is no 0 Street or 0 Avenue, the origin is defined as the point (1, 1).

Karel has the ability to move along streets and avenues and stop only at intersections of streets and avenues. His current location is denoted by the coordinate (Street, Avenue). Note that this is opposite from what we are used to in Algebra where we give the horizontal coordinate before the vertical coordinate. See the example coordinated below in Figure 2.
             
Program 1-1: The StairClimber Class
Karel must learn to climb stairs, picking up a beeper from each step. See the initial and final situations below.

World File: fig3-1.kwld                                                                BACK TO KAREL MAIN

Program 3-2: The ShelfStocker Class
Karel just got a new job stocking grocery store shelves. He has to take the items off of the floor and place them on the shelf. He should begin and end the task at (1,1). See the initial and final situations below.

         

Initial Situation                                Final Situation

World File: Shelf.kwld                                                                      BACK TO KAREL MAIN

Program 3-3: The Harvester Class
Karel must “harvest” a field of beepers. Each row of will consist of 5 beepers, and the number of rows will always be an even number. See the initial and final situations below.

               

World File: fig3-2.kwld                                                                     BACK TO KAREL MAIN

Program 3-4: The Pinsetter Class
Karel just got a job as a pinsetter at the local bowling alley. His job requires him to set up 10 pins in the normal configuration. See the initial and final situations below.

World File: blank.kwld                                                                     BACK TO KAREL MAIN

Program 3-5: The Mover Class
Karel is rearranging office furniture. he needs to move employees desks from one cubicle to the one adjacent to it. He will then move on and do the next desk, etc... . Beginning and ending situations are as shown below. Karel begins the task at (1, 3) facing East.

          

World File: mover.kwld                                                                         BACK TO KAREL MAIN

Program 3-6: The Planter Class
Karel will be planting flowers in planter boxes. He will pick up 3 plants at the bottom of each planter box and then place them in a column in the boxes as shown in the example task below. Karel begins the task at (1, 1) facing East.

           

World File: planter.kwld                                                                       BACK TO KAREL MAIN