Question
I need help with this assignment due by this sunday All code to be done by cpp In this assignment, you are going to make
I need help with this assignment due by this sunday All code to be done by cpp
In this assignment, you are going to make the card game FreeCell. If you do not already know about the game, FreeCell is a solitaire card game played using the standard 52-card deck. It is fundamentally different from most solitaire games in that very few deals are unsolvable, and all cards are dealt face-up from the very beginning of the game. In FreeCell, there are eight tableau columns of cards, four Free Cells on the upper left corner and four Home slots on upper right corner. When a new game starts, each of the first four tableau piles (from the left side) has seven cards and remaining four tableau piles have six cards each. Cards should be in random order in tableau piles. There are four free cell slots and four home slots which are empty at the start of game. Each of free cell slots can contain one card at any given time. In each Home slot, a player has to pile up thirteen cards of each suit in ascending order starting from Ace to King (Ace, 2, 3, , 10, Jack, Queen, King). When player piles up all the cards to home positions, i.e. thirteen cards of each suit to each home slot, the player wins the game. The game is very simple to play and implement. You might want to play a couple of rounds of FreeCell yourself to get a feel for it. You can find several online versions of the game to play and understand its mechanics. Again, do not feel intimidated by the game, it is not that hard. Implementation Details: Cards: To represent a card in the game, you are recommended to make a struct for it. A card has two values: A rank and a suit. Ranks are numbers ranging from 1 to 13. The numbers 1, 11,12, and 13 have special names: Ace, Jack, Queen, and King, respectively. There are four suits: Hearts, Diamonds, Clubs, and Spades. Cards also have a third value of color: Heart and Diamonds are red while Club and Spades are black. The color can, however, be found out from the suit of the card so you do not need to store that separately. Structure of each card can be: struct Card { string suit; // D for Diamonds, C for Clubs, S for Spades, H for hearts. // you can have it as char (D, C, S, H) // or as char* string rank; // 1 to 13, or A, 2 to 9, J, Q, K // you can have it as int (1 to 13) // or as char* // you can declare an enum variable to store colour }; OR class Card // can be a class with its data members as public { public: string suit; // D for Diamonds, C for Clubs, S for Spades, H for hearts. // you can have it as char (D, C, S, H) // or as char* string rank; // 1 to 13, or A, 2 to 9, J, Q, K // you can have it as int (1 to 13) // or as char* // you can declare an enum variable to store colour }; The Freecell class will look like this: class Freecell { // private data members // private member functions, if any public: // constructors (default, parameterized, copy) // destructor // setters, getters // overloaded operator functions, if any // overloaded << operator // utility/helper functions // main operation functions }; Use dynamic memory to create an array. And make sure that this memory is returned to the heap by the destructor. Note that a tableau column can have at the most 52 cards i.e., all the cards of the deck are placed on one tableau column. Similarly, the home cells can have at the most 13 cards. Estimate yourself the maximum number of cards that can be placed in a free cell. Hint: You can have a counter for each of the tableau columns, home cells, and the free cells to keep track of number of cards at a given instant of time. A tableau column shows stack of all the cards in it, whereas home cells and free cells show only the top cards. Legal Moves: You can move only top-most/exposed card(s). You can move card(s) from: 1. A tableau pile to another tableau pile 2. A tableau pile to free cell slot 3. A free cell slot to a tableau pile 4. A tableau pile to home slot 5. A free cell slot to home slot 1. Tableau Pile to Tableau Pile Move: You can move a card from one tableau pile to another tableau pile if card of source tableau pile and card of destination tableau pile are of alternating color and source tableau card is immediate descendent in rank of destination tableau card [except for the Ace card, Ace card should be moved to Home slot]. You can also move multiple cards in one move if the source cards follow the above-mentioned rule i.e., after moving multiple cards from source tableau pile, resulting tableau will form a descending sequence of cards with alternating colors. 2. Tableau Pile to Free Cell Move: You can move any top-most/exposed card from any tableau pile to any available Free Cell slot except for Ace card. Ace card should be moved to Home slot. 3. Free Cell to Tableau Pile Move: A card from free cell slot can be moved to tableau card if it follows the condition mentioned in tableau to tableau move i.e., card of source Free Cell and card of destination tableau pile are of alternating color and source Free Cell card is immediate descendent in rank of destination tableau card. 4. Tableau pile to Home Move: The first card that will be moved to Home slot will be Ace card. After Ace card, cards will be piled up in Home slot in successive ascending order till King. Each home slot will contain pile of cards of a particular suit only. When all cards will be moved to home slots, player wins the game. 5. Free Cell to Home Move: A card from Free Cell can be moved to home slot if the suit of free cell card is same as that of cards (if present) in home slot and free cell card should be in successive ascending order. If any Home slot is empty, the first card that will be moved to Home slot should be Ace card. Requirements and Grading Breakdown: You cannot use vectors in any capacity in this assignment. Make dynamic arrays and use them instead. After each successful move, you need to show updated game state. In case of invalid move, show an error message. You must use OOP techniques in this assignment. Use the following as appropriate: overloaded functions and operators, friend functions, copy constructor, utility/helper functions, static members of a class, constants, enumerators, etc. Use destructor to release dynamic back to heap.
Breton Introduction: In het. You make the card come ou de ne kadar out Bar, Prato card game played in the standard card undermeny different from there weddiwedste from the very being of the game. Preteritable castore Call the upper landemer Implementation Details: Cards: To represent a card in the game, you are recommended to make a struct for it. A card has two values rank and a suit. Ranks are numbers ranging from 1 to 13. The numbers 1. 11.12 and 13 have special names: Ace, lack, Queen, and King, respectively. There are four suits: Hearts, Diamonds, Clubs, and Dod SW FreeCell WYN A card from Free can be moved to home of the set of free cel cards areas that of and present in home set and free call card should be in civescencing onder any Honetisamot, the stand that will be moved to home to Ace card -8 tableaus Where the festten pesimese essere itore perch Cesto beinanden orderinti ples. There are o focal and for home at which are the start game. Catholic ca Canne twee of player has to do home... Geen rel Weppes potion is the card school, the paper is the Requirements and Grading Breakdown: - You cannot be worn any capacity that. Make dynamic arrays and we them After each wow, you need to show updated genetic and more show me You must eneste the the following appropriate function and operation, friend function.com constructor functional membenface, contenen, Uwe destructor town back to the Spades. Cards also have a third value of color:Heart and Diamonds are red while Club and Spades are black. The color can, however, be found out from the suit of the card so you do not need to store that separately. . www. yurette for it. You can evenine version of the metaphy and understand its hiday that Breton Introduction: In het. You make the card come ou de ne kadar out Bar, Prato card game played in the standard card undermeny different from there weddiwedste from the very being of the game. Preteritable castore Call the upper landemer Implementation Details: Cards: To represent a card in the game, you are recommended to make a struct for it. A card has two values rank and a suit. Ranks are numbers ranging from 1 to 13. The numbers 1. 11.12 and 13 have special names: Ace, lack, Queen, and King, respectively. There are four suits: Hearts, Diamonds, Clubs, and Dod SW FreeCell WYN A card from Free can be moved to home of the set of free cel cards areas that of and present in home set and free call card should be in civescencing onder any Honetisamot, the stand that will be moved to home to Ace card -8 tableaus Where the festten pesimese essere itore perch Cesto beinanden orderinti ples. There are o focal and for home at which are the start game. Catholic ca Canne twee of player has to do home... Geen rel Weppes potion is the card school, the paper is the Requirements and Grading Breakdown: - You cannot be worn any capacity that. Make dynamic arrays and we them After each wow, you need to show updated genetic and more show me You must eneste the the following appropriate function and operation, friend function.com constructor functional membenface, contenen, Uwe destructor town back to the Spades. Cards also have a third value of color:Heart and Diamonds are red while Club and Spades are black. The color can, however, be found out from the suit of the card so you do not need to store that separately. . www. yurette for it. You can evenine version of the metaphy and understand its hiday thatStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started