CMPS-3350 Software Engineering
Lab-2

Elements of this lab:

Step 1:
Do your work on Odin server in your 3350/2/ folder.

Change now to your 2 folder and get the first lab file.

It is located here...

/home/fac/gordon/p/3350/code/lab2/donut.c

Attempt to compile and run the program.

Your job is to...

1. Get this program to build and run cleanly.

   You may neatly add code such as #include files.
   You must add a comment block at the top of the program.


2. Construct a Makefile to build the program.

   Name your finished program lab2.c
   You may leave the original donut.c program in-place.
   Your program should be compiled with gcc.
   You must use the -Wall flag.
   All compile warnings and errors must be eliminated. 


3. Refactor the source code applying perfect brace and indent style.

   You will follow the element of the Linux Kernel style guide.
   You may use a tabstop of 3 or 4.
   No line will wrap on 80-character terminal.
   K&R brace and indent styling please.

4. Rename several variables in the program code.

   Find at least two variables to rename.
   Choose names that add clarity to the code.
   Add a brief comment in the code near each variable.


5. Add at least one new function call to the code.

   Take some part of the code and place it in a function.
   Name the function whatever you like.
   Put the function below the main function.
   Call your function.


Step 2:
In your source code,
    give proper credit to the original program author: Andy Sloane

Your finished program will have perfect style and indenting.
Comment the code where you feel it is appropriate.

You may make some modification to the program such as...

1. Modify the speed of the program animation.
2. Change the ASCII character set (palette).
3. Add color.
4. etc.

You are scored on the following...

   . doing your own work
   . putting a nice Makefile together
   . beautiful program code
   . perfect K&R style 


Step 3:
Make some modifications to your lab1 Waterfall particle system.

1. Go to your Desktop and download the asteroids program framework.

   Location:
   /home/fac/gordon/p/3350/code/lab2/asteroids

   Bring the entire directory over.

2. Build and run the program.
   It is a game, but the feature you're looking for is text.

3. Look at the source code and figure out how text characters are
   drawn to the screen, and add the feature to your own lab1.cpp
   on github.

4. Add some text to your particle system program such as the
   word "Requirements" on the box. That will be the first phase
   of the Waterfall lifecycle model.


Step 4:
Sample of K&R style for a C function...

  = where a space belongs.

void foo(int *arr, int n)
{
    int i;
    for (i=0; i<n; i++) {
        if (i < n/2) {
            arr[i] = 25;
        } else {
            arr[i] = 35;
        }
    }
}

Step 5:
Whatever you don't finish during lab class is homework.

You are expected to finish steps 1 and 2 and get started on step 3
during the lab period.

Look back here for additional items of homework.


What to turn in for the lab...
Leave your donut.c, lab2.c, and Makefile in-place on Odin.
The files will be collected during class.

Your github lab1 repo will be viewed sometime after lab class.
You will be given an appropriate amount of time to finish the work.