COM S 229 - Project 1
Deadlines
Project 1: Project 1.A Specification Project 1.B Specification

These are individual projects spanning several weeks. Start Early! Starting on a project the weekend before the due date is a common way to fail (or drop) this course.

Your code will be tested on one of the department's Linux machines, probably pyrite.cs.iastate.edu. Your code must compile and run correctly on this machine. Code that does not compile may receive a grade of zero points! The projects will require one or two thousand of lines of code to implement (give or take; your mileage may vary). These should be organized into more than one source file, with the appropriate supporting documentation (a README file). Part of your grade will be on programming style: code should be legible and well-documented.

You must use a Makefile, so that all your executables may be built by simply typing make in the shell.

You are responsible for understanding the project specifications. These are written in natural language (English), and may be vague or contradictory (it is not easy to describe what a thousand lines of code should do). There will be an online discussion forum for the course, where students may clarify any questions about the specifications. (This is another reason to start early.)

Utilities

There are two utilities that should be used to help with your project.

The example files used by the commands above are given here: tank.bmp, tank.simp, and tank2.bmp.

Creating Good BMP Files
To create suitable BMP files with the correct alpha channel, use the following steps:
  1. Load an image into GIMP.
  2. Select Layer -> Transparency -> Add Alpha Layer. (If this is disabled, then there is already an alpha channel.)
  3. Select FILE -> Export...
  4. Change the filename to end with ".bmp" and click "Export".
  5. Click "Compatibility Options"
  6. Check the box for "Do not write color space information".
  7. Click "Advanced Options"
  8. Select the radio button under "32 bits" for "A8 R8 G8 B8".
  9. Click "Export"

The final options should look like the following:

Examples for 1.A

This section will be filled in with example SIMP files to be tested by your executables.

crop Consider the files insanity.bmp, insanity.simp, c_insanity.simp, and c_insanity.bmp. The following commands perform a crop:

./bmp2simp insanity.bmp insanity.simp
./crop insanity.simp c_insanity.simp 150 112 220 290
./simp2bmp c_insanity.simp c_insanity.bmp
And here are the effects (images are scaled in HTML only):

bw Consider the files attached.bmp, attached.simp, bw_attached.simp, and bw_attached.bmp. The following commands perform a black and white transform:

./bmp2simp attached.bmp attached.simp
./bw attached.simp bw_attached.simp
./simp2bmp bw_attached.simp bw_attached.bmp
And here are the effects:

colorshift Consider the files

The following commands perform colorshifts:
./bmp2simp keanu.bmp keanu.simp
./colorshift keanu.simp keanurgb.simp RGB
./colorshift keanu.simp keanurbg.simp RBG
./colorshift keanu.simp keanurg.simp RG
./colorshift keanu.simp keanurb.simp RB
./colorshift keanu.simp keanugb.simp GB
./simp2bmp keanurgb.simp keanurgb.bmp
./simp2bmp keanurbg.simp keanurbg.bmp
./simp2bmp keanurg.simp keanurg.bmp
./simp2bmp keanurb.simp keanurb.bmp
./simp2bmp keanugb.simp keanugb.bmp

overlay Consider the files doge.bmp, doge.simp, insanedoge.simp, and insanedoge.bmp. The following commands perform an overlay:

./bmp2simp doge.bmp doge.simp
./overlay insanity.simp doge.simp insanedoge.simp 150 120
./simp2bmp insanedoge.simp insanedoge.bmp
And here are the effects:

Test Cases for 1.A

More Test Cases: A TA from 229 Section 3 created the following test cases, if you want to further check your code.

Grading Test Cases: We use the following process to grade your executables.

  1. tar czf netid.tar.gz
  2. Compile and grade Makefile.
    1. make clean
    2. make
  3. Download the grading test cases.
    1. wget http://orion.math.iastate.edu/dstolee/229/project1/grading.tar.gz
    2. tar czf grading.tar.gz
  4. Add the test cases to the makefile
    1. cat tests.txt >> Makefile
  5. Run the make targets to help with grading
    1. make grade

If you want to grade the different commands separately, then use these targets:

  1. make gradebw
    1. BW grade 00: Standard Example, 5 points for 0 bytes different ONLY!
    2. BW grade 01: Doge Example, 10 points, +2 for same file size, +8 for correctness
    3. BW grade 02: Confession Example, 10 points, +2 for same file size, +8 for correctness
    4. BW grade 03: 10 points, +2 for same file size, +8 for correctness
    5. BW grade 04: No Arguments, 5 points for no failure
    6. BW grade 05: File Does Not Exist, 5 points for no failure
  2. make gradecolorshift
    1. COLORSHIFT grade 00: Standard Example, 10 points (2 points for 5 cases, ALL OR NOTHING)
    2. COLORSHIFT grade 01: Alternate Patterns, 10 points (2 points each for 5 cases)
    3. COLORSHIFT grade 02: Alternate Patterns, Big, 10 points (5 each for two cases)
    4. COLORSHIFT grade 03: No arguments 5 points for no failure.
    5. COLORSHIFT grade 04: Invalid pattern, 5 points for no failure.
    6. COLORSHIFT grade 05: No incoming file, 5 points for no failure.
  3. make gradecrop
    1. Crop grade 00: Standard Example, 5 points (ALL OR NOTHING).
    2. Crop grade 01: 1-by-1 10 points, +2 for same file size, +8 for correctness
    3. Crop grade 02: BIG, 10 points, +2 for same file size, +8 for correctness
    4. Crop grade 03: Tall, 10 points, +2 for same file size, +8 for correctness
    5. Crop grade 04: No arguments, 3 points for stopping with no failure.
    6. Crop grade 05: Zero-valued arguments, 4 points for stopping with no failure.
    7. Crop grade 06: Bigger crop than original, 4 points for stopping with no failure, +1 point for 0 bytes different.
    8. Crop grade 07: Negative x,y, 4 points for stopping with no failure. +1 point for 0 bytes different.
  4. make gradeoverlay
    1. overlay grade 00: Standard example, 5 points (ALL OR NOTHING)
    2. overlay grade 01: Attached Insane, 10 points possible, 2 points for same filesize, 8 points for agreement.
    3. overlay grade 02: Attached Confession Big, 10 points possible, 2 points for same filesize, 8 points for agreement.
    4. overlay grade 03: Doge Attached 10 points possible. 2 points for same filesize, 8 points for agreement.
    5. overlay grade 04: No arguments, 5 points for stopping with no failure.
    6. overlay grade 05: Negative x,y. 5 points for stopping with no failure. +1 point for 0 bytes different.
    7. overlay grade 06: Bigger overlay than original 5 points for stopping with no failure. +1 point for 0 bytes different.
Examples for 1.B

meme This command has several parts, so I will break down the necessary files into a few parts.

The Impact Font One possible font to use is called "Impact" and is defined by the files

Here is what the font looks like:


The impact font.


The letters framed by blue boxes.

Of course, other fonts are possible and will be used for testing.

The Memes There will be several memes available for each call to meme. Here are some files:

Here is what the meme pictures look like:

Of course, other memes are possible and will be used for testing.

The Actions Every call to meme will execute some action. Here are some files:

To execute these actions, use the following commands:

./bmp2simp impact.bmp impact.simp

./bmp2simp insanity.bmp impact.simp
./meme memes.mem insaneproject.act
./simp2bmp insane_project.simp insane_project.bmp

./bmp2simp confession.bmp confession.simp
./meme memes.mem confessproject.act
./simp2bmp confess_project.simp confess_project.bmp

And here is what is output.

Grading Test Cases: We use the following process to grade your executables.

  1. tar czf netid.tar.gz
  2. Compile and grade Makefile.
    1. make clean
    2. make
  3. Download the grading test cases.
    1. wget http://orion.math.iastate.edu/dstolee/229/project1/gradingb.tar.gz
    2. tar xvf gradingb.tar.gz
  4. Add the test cases to the makefile
    1. cat testsB.txt >> Makefile
  5. Run the make targets to help with grading. (There are only 140 points for meme, so you get +10 points for compiling.)
    1. make gradememe
    1. make memcheck
Testing Output

To test your output, download compare and run the command as follows:

./compare img1.simp img2.simp

This will determine how many bytes are significantly different between the files, and also will tell if the files are not the same length. If your code works correctly, it should read "0 bytes significantly different."