15-110 Principles of Computing, Summer 2015

Programming Assignment 1

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.

The Assignment

For this assignment, you will play the games from studio.code.org and solve five puzzles using the language Blockly. These five puzzles will range across the themes Artist and Farmer. Each of these puzzles presents a certain type of problem that must be solved by clicking and dragging blocks of code to "program" the solution. If you are not familiar enough with Blockly you should take the time to familiarize yourself with the first few puzzles in The Maze, The Artist, and The Farmer before proceeding.

Writing Your Solutions

When you solve the puzzle and receive the popup notifying you of your success, click the "Show Code" button to reveal the code version of your solution. You are not expected to write this code yourself, you simply need to copy and paste that code into a text file (a file with a .txt extension). Please follow this example to create the correctly formatted files necessary to receive credit for this assignment. Please make sure that your browser shows all the code that you need to copy. We recommend that you do not use Safari in this assignment since you may run into issues with copying all of your code.

The Puzzles

The Artist

For these puzzles, the goal is to command the artist to draw the pattern outlined on the screen using the commands available at your disposal. Again, keep in mind that the number of code blocks you use in your solution must be less than or equal to the maximum number of blocks designated at the top of each puzzle to receive credit as a correct solution. Please follow the same example to write your final solutions.

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


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


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


The Farmer

For these puzzles, the goal is to flatten the land so the farmer can use the land to plant crops. In order to flatten the land, there are holes in the land that must be filled and there are piles of dirt that need to be removed. Again, keep in mind that the number of code blocks you use in your solution must be less than or equal to the maximum number of blocks designated at the top of each puzzle to receive credit as a correct solution. Just as before, please follow the same example to write your final solutions.

  1. Play the fourth puzzle and write the solution in p4.txt.


  2. Play the fifth puzzle and write the solution in p5.txt. In this puzzle you will need to use a logic block (if-then or if-then-else). If you need to familiarize yourself with this kind of a block you may find it helpful to play with a few puzzles from the Maze theme.


Submit Your Assignment

Create a zip file called pa1.zip that contains the the text files with your solutions: p1.txt, p2.txt, p3.txt, p4.txt, and p5.txt.
Submit the zip file for grading using the handin instructions.