CS3157
Fall 2002
Homework #1
due Mon Sep 23, by 6AM (electronically)

goal.
The goal of this assignment is to make sure that you know how to write a simple program in C and that you know how to follow the submission procedures that we will be using for the rest of the semester:

  1. create/edit/compile/link/run a program in C,
  2. perform I/O in C,
  3. declare and use strings in C,
  4. write some basic design documentation,
  5. submit your program, electronically (by 6AM) and in hardcopy form (bring to class on Mon Sep 23).

As well, the goal of this assignment is to learn how to WRITE and READ instructions carefully.

This assignment is worth 10 points (out of 110 this semester). Distribution of points is indicated below.

As described in the first lecture, you will spend this semester writing an educational game. Throughout the semester, the game will get more sophisticated as you learn more. The first homework will be a simple prototype of the game, written in C. The last homework will be a complex multi-player version of the game, with a user-interface in Java that connects to a C or C++ server which is used for communication between players and for saving game data.

You will need a customer -- preferably a child, in order to minimize the amount of knowledge engineering you will need to do for the game. A simple example (which you CANNOT use) is a flashcard game. In a flashcard game, your program would prompt the user with a question and the computer would determine if the user got the right answer or not. Suppose our customer is studying states and capitals. Your program could say "What is the capital of Massachusetts?" and would then read an answer from the user and compare the user's answer to "Boston". The program would print a message indicating if the user got the answer right or not. You would need to decide things like what the messages would be when the user provides right and wrong answers, what the procedure would be if the user got the question wrong (i.e., would s/he get another chance? if so, how many more chances?), if there would be any scoring, how many questions the user would get in a game -- things like that.

FIRST, print out the timesheet and keep track of how much time you spend doing the tasks outlined below.

1. design.(3 points)
You need to begin by sketching out a design document. The information you need to include in the design document is:

  1. A profile of your customer and background with computers For example, is your customer familiar with computers? with video games? You will need to take these things into consideration when you get to writing a user-interface for your customer. (1 point)
  2. A description of the knowledge domain that your game will cover and some idea of how you will get the information for that knowledge domain (e.g., I'll look up my states and capitals in the encyclopedia). (1 point)
  3. An outline of the rules of the game -- how do you win the game? what are the rules of play? is there scoring? how does that work? (1 point)
I don't expect you to come up with a really complex game (like chess or Risk), but I do expect you to INVENT a game and make it a little more complex than my flashcard example.

This documentation should be about 1 page, 10-point font. It must be complete -- so you need to be CLEAR and CONCISE. You MUST print out the documentation and bring it to class on the due date.

2. build a prototype.(6 points)
Write a prototype for your game in C. You can represent a small subset of your knowledge domain -- in my states and capitals example, I'd just use the 6 New England states, for example. You need to prompt the user and do something intelligent based on the user's response. You don't need to write a complex computer player -- this isn't an AI class.

Your program must contain the following C elements:

Your program must fit in ONE source file. The source file MUST be named: hw1<yourCUNIXusername>.c
For example, mine would be called hw1eis2003.c.
BE SURE TO NAME YOUR FILE USING ALL lower case LETTERS!!!
(Note that this is necessary to help us grade homeworks automatically.)

3. submit.(1 point)
You need to submit your program in two ways: electronically and hard copy. This process will be the same for all homework assignments for this course, so master it NOW. Note that on this homework only, you'll get 1 point for completing the submission correctly -- 0.25 points for the timesheet, 0.25 points for the cover page, 0.25 points for the documentation hardcopy and 0.25 points for doing the electronic submission correctly.

  1. electronically
    Follow the submission instructions.
  2. hardcopy.
    (1) Print out the homework template cover page and fill it out.
    (2) Print out the timesheet and fill it out.
    (3) STAPLE the cover page, timesheet and hardcopy of your documentation together.
    (4) Make sure your name and CUNIX ID are on all the papers you hand in!
    (5) Bring all this to class on the day the assignment is due and deposit it in the homework box at the front of the classroom within the first 5 minutes of the class (by 1.15pm).