Karel the Robot

Your first assignment consists of four Karel programs.

Getting Started

There is a starter project including all of these problems that you can access using the link below. Since this is the first assignment, we will ask you a few questions about the Honor Code before you can download the starter project. Once you have the starter code set up, edit the program files so that the assignment actually does what it’s supposed to do (see the assignment handout), which will involve a cycle of coding, testing, and debugging until everything works. The final step is to submit your assignment.

You should write the code for your solution on your own. This assignment is not a pair assignment.

Note: You may only use concepts covered in the Karel coursereader to solve these problems. In particular, you may not use Java concepts you may have learned previously such as variables, parameters, return, break, etc. If you have any questions about what is ok/not ok to use, please feel free to ask.

Assignment Files

Other Resources

F.A.Q.

Q: When I run a program like CollectNewspaperKarel, the world that loads is not the correct one for the problem. Help!
A: Please redownload the starter project from here; this is a known issue that has been fixed. On your computer, you can copy the src/ folder in your current project into the new project, and then delete your existing project from Eclipse (right-click on the project and select "Delete") and import your new project.
Q: I'm having trouble getting Eclipse to work! Help!
A: Please make sure you followed the instructions in our Eclipse Guide above. If you are still having trouble, please come to Nick or Rishi's office hours, or stop by the LaIR.
Q: Eclipse is giving me a strange message about a file being "out of sync" with the file system. It says I can press F5 to refresh the file. What does this mean?
A: This happens if you edit/change your file outside of Eclipse. Just press F5 and Eclipse will show you the newest version of the file.
Q: I didn't like the program name, such as CollectNewspaperKarel, so I renamed it to my own name such as DaveIsGreat. That is okay, right?
A: No. For grading purposes, we need you to leave the program names the way we named them.
Q: How do I turn in the assignment? How do I know if my submission was successful?
A: Please see the Eclipse Guide link above for more information about submitting.
Q: Why doesn't my Karel program say "finished running" at the bottom when it is done?
A: This is often because your program contains an infinite loop. For example, the following loop walks Karel from (1,1) all the way to the right edge, but when he gets there, the loop doesn't stop:
while (leftIsClear()) {
    if (frontIsClear()) {
        move();
    }
}
Q: Will my solution get full credit? Is it written in the style you want? Will I get marked off for this code?
A: In general we cannot answer these kinds of questions. We call this "pre-grading." The section leader/TA/instructor can't look over your entire program for mistakes or tell you exactly what things you will get marked off for; we don't have the resources to provide such a service, and even if we did, we want you to learn how to gain these intuitions on your own. We'll grade you on the guidelines in the homework document and style guide, and we can help you with specific issues and questions about your code, but we cannot pre-evaluate your entire program for you or give you advance warning about every possible mistake or violation.