15-100
Lab 2: Karel Problems



Lab 2 Due Date: Wednesday September 12 at midnight


Background:

Using the software design and problem-solving techniques we have been exploring in Karel, do one of the following two problems. Your solution must be able to solve general examples of the situations, not just the specific task contained in the template files. You will be able to download the template files for each problem
  • A robot named Karel likes to take long, meandering walks in the woods in the world, and even though it has a built-in compass the robot sometimes cannot find its way home. To alleviate the problem, before Karel walks in the woods the robot fills its beeper bag and then it leaves a trail of beepers. Program Karel to follow the path back home. Ignore the possibility that any wall boundaries or wall sections interfere with the path, and assume that two beepers on the same corner mark the end of the path. Each beeper will be reachable from the previous beeper by the execution of one move. Also, the path will never cross over itself. (See the figure below as an example of the path Karel must follow.) Hint: Karel must probe each possible next corner in the path finding the correct one. It might prove useful to have Karel pick up the beepers as it follows the path.
    1.  
      Download Template PathFinder.zip
  • A Robot named Karel is building a fence. The fence will be made of beepers and will surround a rectangular-shaped wall segment. The size of the wall-segment is unknown. Karel is at the origin facing an unknown direction. The fences (beepers) are stacked somewhere next to the western boundary wall. There are exactly enough beepers in the stack to build the fence. The beeper pile is on the street that is adjacent to the southern edge of the wall segment, as shown in the figure below. The distances to the beeper pile and to the wall segment are unknown. Program Karel to build the fence and return to origin. Assume that there are no beepers in Karel’s beeper-bag at the start of the program.
    1.  
      Download Template FenceBuilder.zip

Handing in your Solution

Your solutions should be in the form of .zip files. Take the directories of your two solutions and place them inside a parent directory called Lab1. Zip up this lab1 directory for submission. When we grade your solution we will unzip the folder and execute the project. If your project does not run you will lose the execution points for that lab.

Your Solution zip file must contain all the files in your projects

Your teaching assistants will show you how to zip up the files for submission. Instructions are also in the Tutorial document that is available
 

Click on this link to Submit your zip file