Can Computers Think?
Introduction to Computer Science

CSC 106
Union College
Winter 2010

Programming Project 1 - due Friday, January 15, at the end of the day

Working in teams

You can work on this project in teams of at most two people. If you do decide to work on this project with somebody else, please let me know by Thursday in class that you are working together. Then submit a joint solution.

If you work with a partner, please use pair-programming techniques similar to what we do in the lab. That way you ensure that both partners are contributing and that both partners understand your solution and why and how it works. Do not split up work.

You should not collaborate with anybody outside of your team. Plagiarism of code is equally bad as plagiarism of other written material. And as with other written material, you have to credit any source that you use. You are welcome to discuss the problems with other people and to talk about general solution strategies. However, to be safe, you should never look at somebody else's code or let anybody else see your code. And you should never write down any code in those discussions. If you get completely stuck, please come to see me and I will point you in the right direction.

And that means: start early! So that you have time to come for help, if you need it.

Problem 1: repairing columns

The robot has to repair some damage done to buildings. In particular, it is to repair arches where some of the stones (represented by beepers) are missing from the columns supporting the arches. Here is an example of what these buildings may look like:

Your program should work on the world shown above, but it should be general enough to handle any world that meets certain basic conditions as outlined at the end of this problem. Here are some example worlds, and your program should work correctly with all of them: repair_columns_world_1.wld, repair_columns_world_2.wld, repair_columns_world_3.wld.

When the robot is done, the missing stones in the columns should be replaced by beepers, so that the final picture resulting from the world shown above would look like this:

Your robot may count on the following facts about the world:

Save your solution in a file called "project1_repair.rur".

Problem 2: making a checker board

In this exercise, your job is to get the robot to create a checkerboard pattern of beepers inside an empty rectangular world, as illustrated in the following before-and-after diagram:

You only have to make your solution work for even-sized grids, such as 2x2 or 10x10 or 4x10. But it should work for all kinds of even-sized grids. Here is a 2x2 world file that you can use for testing your program: two_by_two.wld.

If you need more challenge, try to make your solution also work for odd-sized checker boards.

Save your solution in a file called "project1_checker.rur".

Submitting your solution

Submit your .rur files on Blackboard. There is a link in the "Assignments" section.


Both of these problems are originally from Mehran Sahami for the course "Programming Methodology" at Stanford University. The materials of this course were made available under the Creative Commons Attribution License, version 3.0.