Programming Project #3
- To demonstrate your mastery of writing programs with
- To demonstrate your mastery of linking multi-file programs.
- Your instructor or the designated department tutors in the
- Your textbook(s)
- Your own innate capabilities and resourcefulness!
- A working program exhibiting the behavior that your program
should exhibit when you finish it that you can run on Unix1 by
typing the command
- Your program must not use any
global variables. You may declare variables that are
local to the main function.
- Your program must implement the
required functions as specified in the header files.
- Your program must use the
required functions appropriately.
- Your program must mimic the
sample program's behavior exactly , letter for
letter (see Resources section above on how to
run the sample program).
- NOTE: This project is to
be an individual effort! DO
NOT collaborate with any of your classmates --
or anyone else on this project. Violating this rule may
result in being failed from the course.
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
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
Your program must use the defined constants for messages the
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
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:
Issue the command in the directory where you compiled your
gcc ~graderjd/Public/cardlib.o magpielib.o magpiefate.o
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.
You can run the instructor's tests of his cardlib: cardlib_test.c
You should create a test driver for your magpielib.c using
||display_card_values() produces correct
|| get_num_players() returns the correct value for
both valid and invalid inputs.
|| value_of_card() passes minimum complete
|Game driver produces correct results for
1,2,3 & 4 player games.
|Program uses messages defined in header file
|All components integrate properly.
||Algorithm design uses structured logic for decisions and
standards are followed.
||Clean compile (no warnings using the required compiler
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!
- You will submit two source code files, named as follows:
magpielib.c contains the implementation
of the functions defined in magpielib.h.
contains the game driver main program.
Do not submit any other files.
- Move the necessary file(s) to your Unix1 account using your
favorite secure file transfer program.
- Log on to Unix1 using your favorite Secure Shell client
- Change directory (cd) to the directory containing your source
file to hand in.
- Be sure to compile and test
your code on Unix1 using the required compiler flags (
one last time just before turning the files in.
- Submit your code using handin:
handin graderjd Project3 magpielib.c