Programming Project #3



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 Unix1:     ~graderjd/Public/cardlib.o

Do not write your own implementation of cardlib. You must use the instructor's object file.
Your program must use the enumerated type values whenever appropriate and not integer values.

You must use this header file that defines the Magpie game utility functions:  magpielib.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 magpielib.c
Do not include a main function in this file.

The game logic is to be implemented in the main function of a separate driver file named magpiefate.c

In order to get random cards, your main program must include these libraries:
#include <time.h>
#include <stdlib.h>

Your main program must initialize the random number generator by calling this function once:

Link all the object files (.o) together into an executable (a.out) by issuing the following command at the UNIX prompt:
gcc ~graderjd/Public/cardlib.o magpielib.o magpiefate.o
  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 can run the instructor's tests of his cardlib: cardlib_test.c
You should create a test driver for your magpielib.c using checkit.

4.0 Grading

10% display_card_values()  produces correct output.
10% get_num_players() returns the correct value for both valid and invalid inputs.
15% value_of_card() passes minimum complete coverage test
Game driver produces correct results for 1,2,3 & 4 player games.

Program uses messages defined in header file when needed.
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 Unix1.  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: No late submittals will be accepted! 

  1. You will submit two source code files, named as follows:
      magpielib.c contains the implementation of the functions defined in magpielib.h.
       magpiefate.c    contains the game driver main program.
    Do not submit any other files.
  2. Move the necessary file(s) to your Unix1 account using your favorite secure file transfer program.
  3. Log on to Unix1 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 Unix1 using the required compiler flags ( -Wall -ansi -pedantic) one last time just before turning the files in.
  6. Submit your code using handin:
    handin graderjd Project3 magpielib.c  magpiefate.c