CS-240 Data Structures
Project 1

Objective: To introduce the student to the concepts of:
1. Class implementation and packaging
2. Array based manipulations
3. Dynamic Storage Allocation

Write a program that will simulate a four hand (house and 3 players) game of blackjack. Design and implement appropriate Classes to represent a card and a pile of cards. The program should not be user interactive (i.e.the program shall not interactively play the game with the user but rather play the entire game). Output, in an easily understood format, the status of the game after each play. If you have questions about game rules...ask.

Develop classes for the following real world objects:

1. Card with operations of (at a minimum, other operations may be added to this set as determined by your design): The attributes of a card value, suit and status (face up/face down).

  a. Constructor(S:Suit,V:value,F:Status)
     pre - C does not exist
     post - C exists with attributes S,V,F

  b. void FaceUp()
     pre - C exists
     post - C.status := FaceUp
 
  c. void FaceDown()
     pre - C exists
     post - C.status := FaceDown

  d. Status CardStatus(C)
     pre - C exists
     post - C is unchanged; current status value of C is returned to user

  e. value CardValue()
     pre - C exists
     post - C is unchanged; current value of C is returned to user

  f. Suit CardSuit()
     pre - C exists
     post - C is unchanged; Suit of C is returned to user 

2. PileOfCards with operations of (at a minimum, other operations may be added as required by your design):

  a. Constructor()
     pre - PileOfCards does not exist
     post - PileOfCards exists but contains no cards

  b. MakeDeck(Game:DeckType)
     pre - N exists
     post - N exists and has been set up for Game := Blackjack

  c. Card TakeTopCard(C:Card)
     pre - C:Card and N:PileOfCards exist
     post - the top card in N is removed from N and its S,V,F attributes are assigned to C

  e. void AddCardToPile(C:Card)
     pre - C:Card and N:PileOfCards exist
     post - C is added to the top of N; C loses its own identity

These data types should be designed generically enough to be easily used for any common card game, this will require that you take into account the uses of "pileofcards" and "card" in other commonly played card games.

A simple pseudo random number generator will be supplied to you so that you can more easily debug your program.

Hand In:

Source Files (.cpp and .h).

makefile

Last updated: 01/30/2006 - rvs