Due Wednesday, January 25th, 11:59pm

Goals for this Warmup

  • Practice programming with pointers (input and output function parameters).
  • Practice programming with 2-d arrays (images).

For this lab, you are welcome to get technical help from another pair on how to use or install any of the tools involved. You may also get syntax help on C. You may not, however, get help on the algorithmic portion of the exercise outside of your partner, office hours, piazza questions to TAs or instructors.

This lab is broken down into several steps:

Set up

You should have already created a hw3 directory and completed the pre-lab. This means everyone has a set of skeleton files that compile.

Meet up with your duet programming partner for today. Log on to adjacent computers and bring up your individual accounts.

You are being asked to write four functions. Go through all steps of the Duet Programming protocol for each function, trading roles each function. You can see the function descriptions in the prelab. Decide now who is going to be the first Strategist and who is going to be the first Implementer.

Writing Files

In this warmup, you are creating two types of image patterns - horizontal stripes and checker board. How are you going to verify they are correct? You could print them out and hand inspect them to see if they are what you expected.

Alternatively, you could print them in a format that is easy to see. In the file hw3_provided.c, with associated hw3_provided.h, I have written a number of functions for you. Two of them will be useful for your homework - reading and writing png files to and from arrays (provided_read_png & provided_write_png). The other is useful for both warmup3 and hw3 - write the image arrays as an html file. Then you can open it in an html browser easily. This only looks good for small images, so we are going to only work with small images in week3. We will restrict ourselves to 50x50 images. If you have not already done so, create files with those names in your directory, copy and paste the text, and svn add them to your repository.

Exercises

Follow the Duet Programming Protocol. Use your shared svn account.

You are not expected to write equality checkers for your image test cases. Instead, you should print out the result to an html file so you can check it visually. This is how we will test your code. The Strategist will write these tests.

Make sure you add everything to the compile line of your Makefile. Specifically, in order to compile your completed warmup, you'll need warmup3.c, warmup3_main.c, and hw3_provided.c. To use the provided functions for reading/writing PNGs:

	clang -c -Wall -o hw3_provided.o hw3_provided.c

To link this function correctly using the png library with your own solutions, we add the -lpng flag to clang:

	clang -Wall -lpng -o hw3 hw3_provided.o warmup3.c warmup2_main.c

Submit

At this point, you should have done the following:
  • Checked out your repository
  • Created a folder named hw3 in your repository and run svn add hw3
  • You should NOT have modified hw3_provided.* in any way.
  • Created four files and filled in the proper information: warmup3.h, warmup3.c, warmup3_main.c and Makefile inside your hw3 directory.
  • Add all of the new files to your repository.
  • Compiled your executable manually and with the Makefile
  • Executed your code to make sure it runs properly and inspected the results.
  • Copied your code from your duet programming svn repository to your personal svn repository.
  • $ svn commit -m "hw3 warmup complete"
Now you're ready to move on to hw3!! Remember that the homework is completed individually.