### Problems in Karel's World

Here are some problems that exist in Karel's world. You should write a program to enable Karel to solve each of the indicated tasks. If you click on the map of the world, you can download the world-file for that particular situation. Note that if beepers are distributed at random the world file may be different than the one in the depicted map.

### Harvesting Problems

Karel is to harvest the field of beepers. When he is finished, all beepers should be stored in his beeper bag, and Karel should come to rest at 7th Street, 1st Avenue, facing west.
```St.¦
8¦ .   .   .   .   .   .   .
¦
7¦ .   o   o   o   o   o   .
¦
6¦ .   o   o   o   o   o   .
¦
5¦ .   o   o   o   o   o   .
¦
4¦ .   o   o   o   o   o   .
¦
3¦ .   o   o   o   o   o   .
¦
2¦ >   o   o   o   o   o   .
¦
1¦ .   .   .   .   .   .   .
+---------------------------
1   2   3   4   5   6   7  Ave.
```

### Irregular Harvesting Problems

This time the beeper crop has been not very regular. At some random locations within the field beepers are missing. Karel is to harvest the field of beepers again. When he is finished, all beepers should be stored in his beeper bag, and Karel should come to rest at 7th Street, 1st Avenue, facing west.
```St.¦
8¦ .   .   .   .   .   .   .
¦
7¦ .   .   o   .   o   o   .
¦
6¦ .   o   .   .   o   o   .
¦
5¦ .   o   o   o   o   o   .
¦
4¦ .   .   o   o   .   .   .
¦
3¦ .   o   .   .   o   o   .
¦
2¦ >   o   o   o   .   o   .
¦
1¦ .   .   .   .   .   .   .
+---------------------------
1   2   3   4   5   6   7  Ave.
```

### Redistributing the Crop

This time the beeper crop is very irregular. At some random locations within the field beepers are missing, while at other locations more than one beeper has grown. The number of beepers at each corner is either 0 (a dot) or 1 (an o) or 2 (the number 2). Karel is to redistribute the beepers over the field. When he is finished, there should be exactly one beeper at each corner within the 5 by 6 grid, and Karel should come to rest at 7th Street, 1st Avenue, facing west. Initially he has an unlimited supply of beepers in his beeper-bag.
```St.¦
8¦ .   .   .   .   .   .   .
¦
7¦ .   o   o   o   .   2   .
¦
6¦ .   .   .   o   o   o   .
¦
5¦ .   2   2   o   o   o   .
¦
4¦ .   o   o   .   .   o   .
¦
3¦ .   o   2   o   2   o   .
¦
2¦ >   o   .   2   .   o   .
¦
1¦ .   .   .   .   .   .   .
+---------------------------
1   2   3   4   5   6   7  Ave.
```

### Big Harvest

Karel again has to havest a rectangular field of beepers. There is no gap in the beepers this time, but the actual size of the field is unknown. Initially, Karel stands at the south-west corner of the field, facing east towards the field of beepers.

### Hurdle Race

Karel is running a hurdle race. The hurdles are two blocks high and spaced out in regular intervals. There are 7 hurdles altogether, and Karel is supposed to stop after the last hurdle, facing east.

```St.¦
3¦ .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
¦
2¦ . ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .
¦   ¦       ¦       ¦       ¦       ¦       ¦       ¦
1¦ > ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .   . ¦ .
+------------------------------------------------------
1   2   3   4   5   6   7   8   9  10  11  12  13  14 Ave.
```

### Super Hurdle Race

Karel is running another hurdle race. This time the hurdles have random hight and are spaced at irregular intervals. There is always a gap of at least one street between hurdles. The number of hurdles is unknown, but the end of the race is marked by a single beeper. Karel is supposed to stop after the last hurdle, pick up the beeper, and turnoff.

```St.¦
3¦ .   . ¦ .   .   .   .   .   .   .   . ¦ .   .   .   .   .
¦       ¦                   ¦           ¦
2¦ .   . ¦ .   .   . ¦ .   . ¦ .   . ¦ . ¦ .   .   . ¦ .
¦   ¦   ¦           ¦       ¦       ¦   ¦   ¦       ¦
1¦ > ¦ . ¦ . ¦ .   . ¦ .   . ¦ .   . ¦ . ¦ . ¦ .   . ¦ o
+------------------------------------------------------
1   2   3   4   5   6   7   8   9  10  11  12  13  14 Ave.
```

### Incredible Hurdle Race

Karel is to run his final hurdle race. This time the hurdles can be any height and any width. They are irregularly spaced, with a gap of at least on street between. The end of the course is marked by a single beeper. Karel is supposed to run the track, pick up the finishing beeper, and turnoff.

```St.¦
6¦ .   .   .   .   .   .   .   .   .   .   .   .   .   .   .
¦                                           +---+
5¦ .   .   .   .   .   .   .   .   .   .   . ¦ . ¦ .   .   .
¦               +-----------+               ¦   ¦
4¦ .   .   .   . ¦ .   .   . ¦ .   .   .   . ¦ . ¦ .   .   .
¦               ¦           ¦               ¦   ¦
3¦ .   .   .   . ¦ .   .   . ¦ .   .   .   . ¦ . ¦ .   .   .
¦   +-------+   ¦           ¦               ¦   ¦
2¦ . ¦ .   . ¦ . ¦ .   .   . ¦ .   .   .   . ¦ . ¦ .   .   .
¦   ¦       ¦   ¦           ¦       +---+   ¦   ¦
1¦ > ¦ .   . ¦ . ¦ .   .   . ¦ .   . ¦ . ¦ . ¦ . ¦ .   .   o
+----------------------------------------------------------
1   2   3   4   5   6   7   8   9  10  11  12  13  14  15 Ave.
```

### Find that Beeper

Karel is in an enclosed, rectangular room with no openings. He is positioned in the north-west corner of the room There is a single beeper somewhere in the room, right near a wall. Program Karel to find that beeper.
```   ¦ . +-----------+ .
¦ . ¦ V   .O  . ¦ .
¦   ¦           ¦
¦ . ¦ .   .   . ¦ .
¦   ¦           ¦
¦ . ¦ .   .   . ¦ .
¦   ¦           ¦
¦  .------------  .
+--------------------
```

### Find another beeper

Karel is somewhere in an enclosed, rectangular room with no openings. Somewhere in that room is a single beeper. Program Karel to find that beeper.

### One-Beeper-World

Somewhere in Karel's world is a single pile of beepers. Instruct Karel to find and pick up those beepers. Karel starts out somewhere in his world.

### Treasure Hunt

Karel wants to go on a treasure hunt. The treasure is marked by a corner containing five beepers. Other corners (including the corner where Karel starts) contain clues: 1 beeper means go north, 2 beepers means west, 3 beepers means south, and 4 beepers means east. Karel should follow the clues until he reaches the treasure corner where he should turn himself off. Below is one possible treasure hunt map.
```St.¦
9¦ .   .   .   .   .   .   .   .   .
¦
8¦ .   4   .   .   .   3   .   .   .
¦
7¦ .   .   .   .   .   .   .   .   .
¦
6¦ .   .   .   .   .   .   .   .   .
¦
5¦ .   .   .   5   .   .   .   .   2
¦
4¦ .   .   .   .   .   .   .   .   .
¦
3¦ .   .   .   .   .   .   .   .   .
¦
2¦ .   ^   .   .   .   4   .   .   1
¦
1¦ .   .   .   .   .   .   .   .   .
+------------------------------------
1   2   3   4   5   6   7   8   9  Ave.
```