Question
Do not Advertise or Spam! Only comment if you have solution
In this assignment, you will need to generate random numbers from 0-9.
After each action, your program should state what happened and the values of all displayed cards to the user.
use vectors to implement each of the needed piles of cards and you must create a War class. You can use the following as a starting point for organizing the game
In this card game, we will use a modified deck of cards. Each of the cards in this special deck of cards has a number between 0 and 9 on its face, so the value of each card can be represented by an integer. This game uses piles of cards which will be represented by vectors. A card may only be added to or removed from the back of each pile using special functions of the vector class. Each player will have a playing pile of cards and a storage pile of cars, but both piles will start out empty. Prior to starting the rounds of play, 25 cards will be dealt to each player and kept face-down in their playing piles. This will be done by adding 25 randomly generated cards to each playing pile. They will be added one at a time to the back of the pile using a special member function of the vector class. Neither player may look at the cards in these playing piles. The storage piles remains empty after dealing. In each round of play, both players essentially simultaneously remove a card from the back of their playing piles, displaying them face-up on the table where they can be seen by both players. If one player has displayed a higher ranking card, he or she will collect both cards, adding both of them to the back of his or her storage pile. 'If both players display cards of the same value from their playing piles (eg. each player displays a 9 card), this will start a "War" in this round of play.When "War" breaks out, the following happens: A single loot pile is started in the middle of the table, and the two cards of the same value are added to the back of the loot pile. Both players then remove an additional card from the back of their playing pile and add them to the back of the loot pile without looking at them. Then each player removes one more card from his or her playing pile, and displays it face-up on the table. These two new displayed cards determine what happens next: If these newly displayed cards differ, the player who displayed the higher ranking card will win all six cards (the two displayed cards as well as the four cards currently in the loot pile). These six cards will be added one by one to the winner's storage pile, and the loot pile will be emptied. If these two newly displayed cards are two more identically numbered cards, the state of "War" continues (You will repeat starting at back at roman number I. i.e. These two cards will be added to the loot pile....) The loot pile will continue to grow until there is a winner who will take the two displayed cards as well as the entire loot pile, removing all of the cards from the loot pile one by one and adding all of these cards to his or her storage pile until the loot pile is empty. Whenever a player's playing pile becomes empty, her or she will immediately try to refill her playing pile by completely emptying his or her storage pile card by card by removing them from the back and adding each card which is removed to the back of his or her playing pile. If a player's playing pile and storage pile both become empty at the same time, he or she had run out of cards and immediately loses the game. In other words, rounds of play continue until one player has all 50 of the original cards.
Explanation / Answer
#include <iostream>
using namespace std;
#include <iostream>
02 #include "Card.h"