15110 Fall 2011 [Touretzky/Kaynar]

Programming Assignment 1 - due Tuesday, September 4

We recommend that you either use the machines in the Gates-Hillman Cluster or remotely access unix.andrew.cmu.edu to do your assignments for this semester. If, however, you use programs installed on your own machine to do the assignments, please, be aware that the default text editor of your operating system may not do the "right thing". In particular, the TextEdit utility on MacOS does not produce plain text files by default. You will probably find it easiest to produce valid text files if you install the gedit program that we use in lab instead. It is available for Windows, Mac OS X, and Linux .


For this assignment, you will play the Light-bot 2 game in order to solve five puzzles. In the Light-Bot game, puzzles are solved by programming the robot "Lightbot" so that when Lightbot is run, he lights up all of the pulsating blue tiles, turning them to yellow.

Light-Bot 2 contains a set of standard levels (puzzles) divided into four categories: basic, recursion, conditionals, and expert. If you have not already, you should go and play the first few levels in the basic, recursion, and conditionals categories of Light-Bot 2 before proceeding.

The Puzzles

Solve each of the following 5 puzzles and write your solution in the specified format. Make sure each file is stored as a plain text file with a ".txt" extension.

Even if you solved the puzzle correctly in the Light-bot game, you may have made a mistake translating your solution into textual form. Use the Lightbot format checker to find about "syntax errors," such as misspelled commands, in your program. It will not, however, check whether your program actually solves the puzzle.

  1. Play the first puzzle and write the solution in lb1.txt.

  2. Play the second puzzle and write the solution in lb2.txt.

  3. Play the third puzzle and write the solution in lb3.txt

  4. Play the fourth puzzle and write the solution in lb4.txt.

  5. Play the fifth puzzle and write the solution in lb5.txt.

If you have solved all the puzzles above and want to have a challenge, play the EXTRA CREDIT puzzle and write the solution in lbextra.txt. Note that you can get full credit for this assignment even if you do not do this one.

Submit Your Assignment

Create a zip file called pa1.zip that contains the the text files with your solutions: lb1.txt, lb2.txt, lb3.txt, lb4.txt, and lb5.txt. If you have done the extra credit puzzle include lbextra.txt in the zip file. Submit the zip file for grading using the handin instructions.