CS 242 Fall 2009 : Assignment 1.1
CS 242 Fall 2009 : Assignment 1.1
This page last changed on Sep 09, 2009 by cemeyer2.
This is the first part of a three part assignment that will span over the course of three weeks. It is important that you complete this assignment on time because the next assignment will build on it. If you have questions, please post them on the newsgroup since there is a good chance that other people will have the same question as you. Also, look over this page frequently for Update markers with clarifications or changes to the assignment.
Update: A solution is available at https://csil-projects.cs.uiuc.edu/svn/fa09/cs242/_public/solutions/Assignment1.1/
Reading: (only if you have the book, but will be very helpful): Code Complete Chapter 6 – Working Classes
Language: C or C++
Goal: Read an ASCII input file and generate an output file representing a neighbour grid
As you will notice in this assignment and the ones that follow, they are indeed different ways for doing each one. This assignment does not list everything that you need to do to accomplish the task. When we do not specify a particular way of doing things, you can always do it in whatever way you see fit. We will ask for your justifications when you present your code in class. This is different from a regular machine problem where you have to follow rigid rules to facilitate grading.
Your program will read in input file such as (click here to download):
and generate an output file representing a neighbour grid. The format of the input file is as follows:
The row_count and column_count will both be positive integers, while the data will be a series of line with one line for each row and one character per line for each column. The data characters may be any of the following:
For this part of the assignment, we don’t care what each cell of the data portion of the map is, only its relation to its neighbours. Once you read in the input file, your program should generate an output file that has one byte per cell of data in the input file, which each bit of each byte representing that cell’s relation to its neighbours:
A 1 for a particular bit signifies that that cell has a neighbour that is different from it, a 0 signifies that that is the same type of cell. So, for the second input file shown above, the grass element in the middle of hte map would have the 8 bits be 11011010.
A graphical representation of how the cells relate to each other for the second given map is as follows:
Update: You can download what one implementation of this assignment would generate for the given input file here.
In summary, here is what you have to do:
Update: For extra credit, have your program create a visualization of the neighbour grid in a similar fashion to the one above, for an example of a larger version, click here.
Update: Here is a sample decomposition for your program:
input module (one class):
processor module (one class):
output module (one class):
and a controller module to coordinate all of the other modules together. Using this decomposition, none of the data structures are exposed outside of the modules in which they reside and any changes made would be local to that module.
Things to watch out for:
Update: This assignment is due by Wednesday, September 2nd at 8am in subversion at https://csil-projects.cs.uiuc.edu/svn/fa09/cs242/<netid>/Assignment1.1
Note: As is usual for CS242, only about 1/2 of the points will be given for having a program that accomplishes the given task. The rest will be for the style of your code and your participation in discussion section. That being said, you should still focus on completing all of the tasks you are given, but be aware that if you do not create good code, you will be heavily penalized.
|Document generated by Confluence on Feb 22, 2012 18:18|