CS 105 (C++)

Assignment 3: ASCII Shading

I. Overview

In this assignment, you will write a program to perform a kind of image to ASCII conversion, a form of ASCII art.

Given a stream of image shading values and dimensions, the code you write will produce images shaded with ASCII text, like the one above.  The following are some important details of what your program must do.

In order for you to gain experience in some of the required topics for this assignment, your program's implementation must include the following features:
Note: Your program's input must match the background shade (dark or light) that the output will be viewed on.  To this end, I have provided two versions of the test input file (one for each background shade).  If your results will be viewed on a light background, use for_light_bg.txt as your input.  For results to be viewed on a dark background, use for_dark_bg.txt as your input.  Both of these input files should be used with values of 95 and 75 for the width and height respectively.  Note also that your results must be viewed in a constant-width font.

So, for example, assuming that your program is named a3, if you plan to view your results on a dark background (recommended), your code should be run on the given input file as follows.

cat for_dark_bg.txt | a3 95 75

Instead of simply viewing the results directly, you can use the following command to redirect your program's standard output to a new file called out.txt.

cat for_dark_bg.txt | a3 95 75 > out.txt

(Note that a simple way to view light-background results as if they were on a dark background is to highlight them.)

II. Grading

III. The More You Know

The following are some additional items that may be very important for you to know about this assignment.

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.