CPE/CSC 101
Spring 2007
Programming Project #2

Due Date

Test Plan due Monday Tuesday 8 May at class time.
Completed program due Friday 11 May  11:59pm.

You must turn in your source electronically on Hornet using the handin command by this deadline.   Instructions are provided below.
No late submittals will be accepted!  

Objectives

Resources

Ground Rules


1.0 Problem Description


2.0 Constraints

You must use this header file that defines the enumerated types for playing cards:   cardlib.h
You must use the instructor's implementation of the cardlib functions:  
Object file for Hornet:     cardlib.o  (available on Hornet as ~cs101-1/www/cardlib.o)
Object file for Windows: cardlib.o  (available on Hornet as ~cs101-1/www/win/cardlib.o)
Do not write your own implementation of show_rank() and show_suit(). You must use the instructor's object files.
Your program must use the enumerated type values whenever appropriate and not integer values.

You must use this header file that defines the hobknob game utility functions:  hobknoblib.h
Your program must use the defined constants for messages the program displays.
You must write your own implementation for these utility functions in a a separate source file named hobknoblib.c
Do not include a main function in this file. Compile this file separately without linking it using the icon of the single green plus in jGRASP.

The game logic is to be implemented in the main function of a separate driver file named hobknob.c
Compile this file separately without linking it using the icon of the single green plus in jGRASP.
Link all the object files (.o) together into an executable (a.out) by issuing the following command at the DOS/UNIX prompt:
gcc cardlib.o hobknoblib.o hobknob.o
Sorry this command isn't part of jGRASP, you have to issue it from a command window (in Windows) or the UNIX prompt on hornet. Issue the command in the directory where you compiled your source files.

The display_card_values() procedure must be implemented as a nested for loop that iterates over all the values in the enumerated types for rank and suit.

Do not use fflush() in your program. 

3.0 Testing

You are required to write a test plan for your program.  Use the Test Plan form that we have used in class to describe the input data and expected outputs of your program.  (You do not need to show the expected output from the display_card_values() functions since that is given in the problem description).  Your test plan should include enough test cases to demonstrate minimum complete coverage.  That is, your test data must cause every statement in the program to be executed, and produce correct results. 

The instructor has provided a working implementation of his hobknoblib utility functions.  You can write a test driver for these functions to see how they behave.  While developing your driver, you may link it with the instructor's utility library until you get yours implemented.
Object file for Hornet:     hobknoblib.o  (available on Hornet as ~cs101-1/www/hobknoblib.o)
Object file for Windows: hobknoblib.o  (available on Hornet as ~cs101-1/www/win/hobknoblib.o)

There is a data file that contains the input data that produces the output shown in the Sample Execution:  hobtest1.dat
When you run your program with this sample data, it should produce exactly the same results as the model solution provided above.
The best way to verify this is with the unix diff command.

4.0 Grading

5% Test Plan provides minimum complete coverage
10% display_card_values()  produces correct output.
10% get_num_players() returns the correct value for both valid and invalid inputs.
10% value_of_card() passes minimum complete coverage test
10%
Game driver produces correct results for 1,2,3 & 4 player games.
5% Game driver properly handles invalid inputs for rank and suit.
5%
Program uses messages defined in header file when needed.
10%
All components integrate properly.
15% Algorithm design uses structured logic for decisions and loops.
15% Coding standards are followed.
5% Clean compile (no warnings using the required compiler flags).

Remember, your program will be tested on Hornet.  Code that does not compile will receive a grade of zero.

5.0 Submitting Your Work

You need to submit your source code electronically using the   handin   utility:

  1. You will submit two source code files, named as follows:
      hobknoblib.c contains the implementation of the functions defined in hobknoblib.h.
       hobknob.c    contains the game driver main program.
    Do not submit any other files.
  2. Move the necessary file(s) to your hornet account using your favorite secure file transfer program.
  3. Log on to hornet using your favorite Secure Shell client program.
  4. Change directory (cd) to the directory containing your source file to hand in.  
  5. Be sure to compile and test your code on hornet using the required compiler flags ( -Wall –ansi – pedantic) one last time just before turning the files in.
  6. Submit your code using handin:
    handin cs101-7 Program1 hobknoblib.c  hobknob.c

  7. You should see messages that indicate handin occurred without error. You can (and should) always verify what has been handed in by executing the following command:
    handin cs101-7 Program2
  8. Determine the number of lines of code in your files:
    ~cs101-1/bin/countloc hobknob.c
    ~cs101-1/bin/countloc hobknoblib.c
  9. Complete the programmer productivity summary form for this project.