You are to write a program that mimics the game memory. You are to do this by having two "decks" of cards with values 1-10, randomly inserted into each deck (effectively, you will create two rows of 10 cards each, randomly ordered.) Then, prompt the user to pick a card form each row of cards. If there is a match, the two cards are discarded (an X will appear in the row for each matched pair). The user continues to play the game until all ten matches have been found. You are free to implement a solution however you see fit. However, you must design and make use of at least two functions in addition to your main (driver) function. A sample run is provided below. Be sure to pay attention to alignment, spacing, line breaks to ensure that your code's output matches the output below.
****************************
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
What number card would you like to check from the first row?
1
1 is a(n) 4
What number card would you like to check from the second row?
11
11 is a(n) 8
No match!
*****************************
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
What number card would you like to check from the first row?
1
1 is a(n) 4
What number card would you like to check from the second row?
1212 is a(n) 3
No match!
*******************************
1 2 3 4 5 6 7 8 9 10
11 12 13 14 15 16 17 18 19 20
What number card would you like to check from the first row?
1
1 is a(n) 4
What number card would you like to check from the second row?
20
20 is a(n) 4
Match!
**********************************
X X 3 4 5 6 7 8 9 10
11 X 13 14 15 16 17 18 19 X
What number card would you like to check from the first row?
3
3 is a(n) 9
What number card would you like to check from the second row?
19
19 is a(n) 9
Match!
********************************
X X X XX X X X 9 10
X X 13 X 15 X X X X X X
What number card would you like to check from the first row?
10
10 is a(n) 6
What number card would you like to check from the second row?
15
15 is a(n) 6
Match!
*******************************
X X X X X X X X X X
X X X X X X X X X X
Game Over!




SAMPLE INPUT OUTPUT :

CODE ( TEXT FORMAT ):
#include <iostream>
#include <cstdlib>
#define MAX 10
using namespace std;
void GenerateDeck(int D[]) {
int indx = 0;
int num;
for (int i = 0; i < MAX; i++) {
do {
num = rand() % MAX + 1;
for (int j = 0; j < MAX; j++) {
if (num == D[j]) {
num = 0;
break;
}
}
}while(num == 0);
D[indx] = num;
indx++;
}
}
int main() {
srand(time(NULL));
int deck1[MAX], deck2[MAX];
GenerateDeck(deck1);
GenerateDeck(deck2);
string stars = "****************************";
int matches = 0;
while (matches != 10) {
cout << stars << endl;
for (int i = 0; i < MAX; i++) {
if (deck1[i] == 0)
cout << "X ";
else
cout << i+1 << " ";
}
cout << endl;
for (int i = 0; i < MAX; i++) {
if (deck2[i] == 0)
cout << "X ";
else
cout << MAX+i+1 << " ";
}
cout << endl;
int first, second, card1, card2;
cout << "What number card would you like to check from the first row?\n";
cin >> first;
card1 = first - 1;
cout << first << " is a(n) " << deck1[card1] << endl;
cout << "What number card would you like to check from the second row?\n";
cin >> second;
card2 = second - MAX - 1;
cout << second << " is a(n) " << deck2[card2] << endl;
if (deck1[card1] == deck2[card2]) {
cout << "Match!\n";
matches++;
deck1[card1] = deck2[card2] = 0;
}
else {
cout << "No match!\n";
}
}
}
PS : FEEL FREE TO ASK ANY DOUBTS IN COMMENT SECTION AND DON'T FORGET TO RATE THE ANSWER
You are to write a program that mimics the game memory. You are to do this...
C++ program
This program involves writing a VERY simplified version of the card game War. You may know this game or not but my rules are these 1. Split the deck between player1 and player2. Only the face values matter (2-14) and not the suits 2. Each player puts a card down on the table. The higher face value wins that hand. If the card values match, you will simply indicate tie and neither player wins.The original rules would require...
In Java, Write a program in Java FX or Swing that sets up a game of concentration(Memory Matching Card Game), first shuffle the cards well and then place eachcard face down in 4 rows of 13 cards each. Each player takes a turn by turning two cards over. If the cards match, then the player picks up the cards and keeps them. If they don't match, the player turns the cards back over. I need the code! You have to...
Java programing Write a program that deals a deck of card into 4 hands – Each hand having 13 cards. The program should be doing the followings use an array to randomly select 52 cards and deal it into 4 hands. Print each hand unsorted Identify the face value of each hand and display it. You should create a class called Card, and all the methods should be defined within the card class. Hints – Import below java utility to...
Program 4: C++ The Game of War The game of war is a card game played by children and budding computer scientists. From Wikipedia: The objective of the game is to win all cards [Source: Wikipedia]. There are different interpretations on how to play The Game of War, so we will specify our SMU rules below: 1) 52 cards are shuffled and split evenly amongst two players (26 each) a. The 26 cards are placed into a “to play” pile...
The question is to make the game of war using Python. The information on how the cards will be represented and how the game will be played along with 2 sample runs is below. Representation of the deck of cards: The deck of cards will be simulated with integers of values from 1 to 13, where 1 represents the Ace, 11 the Jack, 12 the Queen, and 13 the King – these integers also represent the face values of the...
For this assignment you will create a one-player variation of the game BlackJack. The game will be divided into five rounds. The goal of each round is to accumulate a hand of cards that gets as close to 21 without going over. At the beginng of the game you will start with a score of 100 points. After each round, the difference between your hand and 21 will be subtracted from your total score. The object of the entire game...
The following program simulates shuffling a deck of cards. (The line numbers are not ) part of the code). Without changing its functionality, rewrite the program by replacing the 2D array card [52] [2] with a double pointer char **card and replacing the code between line 12 and line 26 with a function. The function prototype could be void shuffleCards (char **, char [, char [) 1 7/Shuffling cards 2 4 using namespace std; 6 main() #include #include <cstdlib> <iostream>...
2 A Game of UNO You are to develop an interactive game of UNO between a number of players. The gameplay for UNO is described at https://www.unorules.com/. Your program should operate as follows. 2.1 Setup 1. UNO cards are represented as variables of the following type: typedef struct card_s { char suit[7]; int value; char action[15]; struct card_s *pt; } card; You are allowed to add attributes to this definition, but not to remove any. You can represent colors by...
Python 3.7 Card Game: In this assignment you will be creating ‘card game’ with specific rules. Rules of the game are fairly simple. The game will be played with 3 players, two AI players and 1 Human player. Rules of the game: 1- Will have 3 players (2 AI, and 1 Human player). 2- The cards we have for this game is three ones (1), three twos (2), and three three’s (3). 3- Need to shuffle the cards randomly so...
Using Python 3.5.2 and IDLE Write the code for a modified game of the card game crazy eights (much like a game of UNO, where the card played is now on top of the deck and its number or face value is now what is playable for the next player). Write the code to be a 2 player game with any 8 card being able to input a new face value to play on the discard pile. Rules: Use a...