CSC 101 Programming Assignment 6

CSC 101 Programming Assignment 6
A Card Game Program


Overview

This assignment continues the work of programming assignment 5. Here you will finish the design and implementation of a program to play the card game you chose in assignment 5.

Specification

The program begins by offering to display game instructions to the user. If the user chooses to view instructions, they are displayed on the terminal in successive "pages" of 20 lines each. The user can go to the next page of instructions, go to a previous page, or quit the instructions.

Once the instructions are completed, game play begins. At this point, the user's hand is displayed on the terminal and the user is prompted to enter a game-playing command. The specific playing commands depend on the game the program is playing.

In addition to game-specific commands, the following general commands must be available to the user:

The details of user interface design are up to you. To give you a rough idea of how game play would look, here is a very generic game play session. Output form the program is shown in normal typewriter font. Input from the user is show in bold typewriter font

-- Welcome to <your card game name goes here> --

Would you like to see instructions (y or n)? y <first 20-line page of instructions> Type p for previous page, n for next page, q to quit instructions: n <second 20-line page of instructions> Type p for previous page, n for next page, q to quit instructions: n . . . Shuffling. Beginning play. Your hand contains: AC AD AH AS Enter a command: ?

Command Meaning =========================================== h hit me with another card p pick a card from the top of the deck d C discard card C from my hand s show dealer's hand i display full instructions ? display short help q quit the game Enter a command:
h Your hand contains: AC AD AH AS KC The dealer takes a hit. Enter a command: d AH Your hand contains: AC AD AS KC The dealer discards 2C Enter a command: ... Congratulations, you win!

Here are some noteworthy features of this generic example:

Depending on the game, there are some potential convenience issues that the program should address. These include:

Program Design and Implementation Requirements

As always, most of the implementation details are up to you. Here are the specific design and implementation requirements you must meet:

  1. your program must following all CSC 101 conventions, including the 25-line/per function rule (no more than 25 lines per function body, excluding comments and variable declarations);
  2. you must hand in a concrete design diagram for the program, including input/output annotations;
  3. your program must be organized in at least four separate files:
    1. .h file(s) containing function declarations
    2. .cpp file(s) containing function definitions
    3. -main.cpp file containing the complete program main function
    4. -test.cpp file containing testing functions for at least four processing functions, plus a testing main function

Note carefully the requirement for at least four testing functions. This means that you must choose at least four program processing functions for which you write a separate testing function. These four functions must be other than the four functions you wrote for programming assignment 5.

If you want, you can organize your program using multiple .h files, but this is not required. You can name your files "program6..., or a more mnemonic name, like the name of the card game.

Turnin Details

The assignment is due no later than 9PM Wednesday, June 9. Note that this is the middle day of finals week. Turn in the program files electronically. Turn in the design diagram on paper to the CSC department office drop box.

The name of the assignment for electronic turnin is program6. Since your program consists of multiple files, use the turnin program to submit each of them.



index | lectures | labs | handouts | assignments | solutions | grades | help