Skip to content

apocalyptikz/Solitaire

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

  • Program Objective:
  • Create the classes required to create a modified (simplified) version of the card game named Churchill Solitaire. It is a 2 deck solitaire that uses 9 card piles. You will only be creating the classes to be used in the game and a main program to deal the games initial setup.

    The classes include card (to store a standard playing card), deck (to store and manipulate a collection of card objects), seqDeck (which is a derived class of deck which only allows certain types of sequences of card objects) and sdPile (which manages a vector of seqDeck objects).

    card objects should do the following:

    • default to the first card of standard deck (Ace of Clubs)
    • have valid Value Semantics
    • provide constructor for (Integer value, String suit)
    • provide constructor for (card position in sorted deck)
    • set and return valid card suit
    • set and return valid card face value
    • return card's rank
    • return card's point value
    • provide full Order Semantics (by card rank)
    • return long card names (i.e. Ace of Diamonds)
    • return short card names (i.e. AD)
    • provide explicit type conversions
      • int (the card's rank)
      • double (the card's point value)
      • string (the card's long name)

    deck objects should do the following:

    • have a deep copy constructor
    • have a deep assignment operator
    • default to a standard deck of 52 cards (see Other section for sequence)
    • add a card to the top of the deck (at index 0)
    • add a card to the bottom of the deck (at index size())
    • insert a card into the deck at some index
    • remove a card from the top of the deck
    • remove a card from the bottom of the deck
    • remove a card from the deck at some index
    • return card at the top of the deck
    • return card at the bottom of the deck
    • reset the deck to a standard deck of 52 cards
    • clear the deck
    • shuffle the deck
    • test if the deck is empty
    • overload the sequence operator
    • overload the += operator (for deck and card objects)

    seqDeck objects should do the following:

    • inherit the deck class
    • remove the shuffle function
    • remove the reset function
    • remove the non-constant reference sequence operator function
    • default to an empty deck of cards
    • create a constructor to set sequence options
    • create tests for update functions based on sequence options
    • test all (add/remove/insert) functions for sequence
    • set sequence options
      • order (none/ascending/descending/constant)
      • value order (none/loose/strict)
      • color order (none/alternate/color/suit)
    • clear options (would clear options but not cards)
    • override the += operator (for seqDeck and card objects)

    sdPile objects should do the following:

    • is a collection of seqDeck class objects
    • have a deep copy constructor
    • have a deep assignment operator
    • default to an empty collection of seqDeck objects
    • add a seqDeck to the bottom of the sdPile
    • add a card to the bottom of the sdPile
    • remove and return the bottom seqDeck from the sdPile
    • remove and return a sub seqDeck from the sdPile
      • //to remove the last three cards from the bottom seqDeck of the sdPile[3]
      • sd[4].remCards(3) //returned as a new seqDeck
    • clear the sdPile
    • test if the sdPile is empty
    • overload the += operator (seqDeck and card objects)
    • validate all update functions
    Foundation:
    XX XX XX XX    XX XX XX XX
    

    Piles: 9D XX XX XX XX XX XX XX 4H KS XX XX XX XX XX AC 2S XX XX XX QC 4H XX TD 8C

    Stock: XX (79)

    From: p8 To: f1


    Foundation: AC XX XX XX XX XX XX XX

    Piles: 9D XX XX XX XX XX XX 3S 4H KS XX XX XX XX XX 2S XX XX XX QC 4H XX TD 8C

    Stock: XX (79)

    From: stock (a very bad decision!)


    Foundation: AC XX XX XX XX XX XX XX

    Piles: 9D XX XX XX XX XX XX 3S 4H JS KS XX XX XX XX XX 7D 9S 6C 2S XX XX XX QC 8C 4H XX TD AH AH 8C 4H TS

    Stock: XX (70)

    From:

  • Other:
  • const size_t card::STDVALUES = 13;
    const size_t card::STDSUITS = 4;
    const size_t card::STDPOINTS[13] = { 14, 2, 3, 4 , 5, 6, 7 , 8, 9, 10, 11, 12, 13 };
    const size_t card::STDRANK[13] = { 12, 0, 1, 2 , 3, 4, 5 , 6, 7, 8, 9, 10, 11 };
    const char card::STDVALUEABBRV[13] = { 'A', '2', '3', '4' , '5', '6', '7' , '8', '9', 'T', 'J', 'Q', 'K' };
    const std::string card::STDVALUESNAME[13] = { "Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"  };
    const char card::STDSUITABBRV[4] = {'C', 'D', 'H', 'S'};
    const std::string card::STDSUITNAME[4] = { "Clubs", "Diamonds", "Heart", "Spades" };