CMSC 201
Programming Project Four

ASCII Art

Out: Wednesday 11/5/03
Due: Before Midnight, Sunday 11/16/03

The design document for this project, design4.txt ,
is due: Before Midnight, Sunday 11/23/03

Objectives

This project will give you practice

Background - ASCII Art

Manipulating character data is a common task performed by computer programs. So, it makes sense that there should be a standard format in which to store characters, just as there are standard formats for storing numeric data. ASCII (American Standard Code for Information Interchange), developed by the American National Standards Institute (ANSI), is one such format. It is also currently the most common character storage format. According to the ASCII standard, each character (number, letter, symbol, control character) is represented as a unique one-byte bit pattern. (See Appendix D of your textbook.) Text files, such as your program source code and data files, are simply sequences of ASCII characters.

Back in the "old days" (when I was your age?), computer monitors could not display graphics as we know them today. Pictures where simply displayed as lines of text. Well, people soon got creative, and ASCII art was born. Here is a sample of some ASCII artwork (a Cessna 150):

| ____________________|____________________ \ | | / `.#####.' /`#_#'\ O' O `O Pretty cool, huh? (OK, so it's not Soul Calibur II.) There are thousands of interesting, and quite impressive, pieces of ASCII art on the web. Just do a Google search on "ascii art" and you'll see.

The Task

You are to write a program that will read an ASCII art pattern from a file, display the pattern on the screen within a border, and allow the user to move the pattern up, down, left, and right within the border. If the user moves the pattern partially or totally out of the border, the pattern will be partially or totally lost, respectively.

More Details

The Data File

Here is a sample pattern file:

00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000.----.000000000000000000000000 00000000000000000_.'__0000`.0000000000000000000000 0000000000000.--(#)(##)---/#\000000000000000000000 00000000000.'0@0000000000/###\00000000000000000000 00000000000:000000000,000#####00000000000000000000 000000000000`-..__.-'0_.-\###/00000000000000000000 000000000000000000`;_:0000`"'000000000000000000000 0000000000000000.'"""""`.0000000000000000000000000 000000000000000/,00JOE00,\000000000000000000000000 00000000000000//00COOL!00\\00000000000000000000000 00000000000000`-._______.-'00000000000000000000000 00000000000000___`.0|0.'___00000000000000000000000 0000000000000(______|______)0000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 00000000000000000000000000000000000000000000000000 When you display the pattern, convert all zeros (0) to blanks.

Two sample pattern files are provided for you (snoopy.dat and whale.dat). Copy the files from my directory into the directory that you will be using to work on this project. Go to that directory and then issue the following commands:

cp /afs/umbc.edu/users/s/m/smitchel/pub/cs201/snoopy.dat . cp /afs/umbc.edu/users/s/m/smitchel/pub/cs201/whale.dat . Remember that the space and the period at the end of each command are part of the command.

Sample Output

Since the output file is large, instead of showing the output here, I am just providing a link to my output file, output.

Although your output may look different than mine, you should display the same information.

What to Turn In

You must use separate compilation for this project and should have a file called proj4.c that contains only the function main(). You should also have files called pattern.c (all other function definitions) and pattern.h (all corresponding function prototypes). If you wish to create other .c and corresponding .h files, you may.

Submit as follows:

submit cs201 Proj4 proj4.c pattern.c pattern.h The order in which the files are listed doesn't matter. However, you must make sure that all files necessary to compile your project are listed.