Unfortunately, I do not have Visual Studio but I will provide you with a working c++ code that you can run either in Linux or any windows IDE. Also please forgive me but I have not used the sample code given by you to stop the execution time for some seconds if the selected cards do not match. I will post some screenshots of my console output and I think the game works in the same way and the output is also produced in the same manner as suggested in the question. I have not deviated from it. My code will contain all the required and important documentation so any explanation over here I think would not be much necessary. Here goes the code (with necessary documentation) and the output screenshots after that.
#include <bits/stdc++.h> // imports all the necessary header files
#define ll long long int // all data types are in 64bit just for being in the safe side.
using namespace std;
vector <char> v;
int main()
{
/*
here i am storing all the
characters from A to H in a vector twice because
you need two of them and then i
shuffled them randomly and also created a
puzzle matrix and a visited matrix.
The puzzle matrix stores the randomly
shuffed vector of characters and
visited marks the set of cards that are already
the same and the player has
selected. That is vis[i1][j1] = true and vis[i2][j2] = true
denotes that the player has found
out that the cards at (i1, j1) and (i2, j2) are the
same.
*/
for(char ch = 'A'; ch <= 'H'; ch++)
{
v.push_back(ch);
v.push_back(ch);
}
srand(time(0));
random_shuffle(v.begin(), v.end());
ll sz = v.size();
char puzzle[4][4];
ll vis[4][4];
for(ll i = 0; i < 4; i++)
for(ll j = 0; j < 4; j++)
vis[i][j] =
false;
ll r = -1, c = 0;
// here i am transferring the values from the vector v
to the puzzle matrix.
for(ll i = 0; i < sz; i++)
{
if(i % 4 == 0)
{
r++;
c = 0;
}
puzzle[r][c] = v[i];
c++;
}
// game starts from here
for(ll i = 0; i < 4; i++)
{
for(ll j = 0; j < 4; j++)
cout <<
"X";
cout << endl;
}
ll moves = 0;
while(1)
{
cout << "Choose two cards (or
'q' to quit the game):";
string inp;
getline(cin, inp); // space
separeted input is taken in the form a b c d.
if(inp == "q") // if only "q"
appears quit the game.
{
cout <<
"you have quitted the game" << endl;
break;
}
moves++;
ll x1 = inp[0] - '0'; // zeroth
element is the first row
ll y1 = inp[2] - '0'; // second
element is the first column
ll x2 = inp[4] - '0'; // fourth
element is the second row
ll y2 = inp[6] - '0'; // sixth
element is the second column
// 0 2 4 6 because it matches the
input like (a_b_c_d) -> (0123456)
if(puzzle[x1][y1] ==
puzzle[x2][y2]) // if the selected coordinates has the same
cards
{
vis[x1][y1] =
true;
vis[x2][y2] =
true; // mark them as true
for(ll i = 0; i
< 4; i++)
{
for(ll j = 0; j < 4; j++)
{
if(vis[i][j])
cout
<< puzzle[i][j]; // if it is visited means the player has
already discovered it
else
cout
<< "X"; // else it is undiscovered still.
}
cout << endl;
// And print it!!
}
}
else
{
// if the
coordinates does not match
for(ll i = 0; i
< 4; i++)
{
for(ll j = 0; j < 4; j++)
{
if(vis[i][j] || (i == x1
&& j == y1) || (i == x2 && j == y2))
cout
<< puzzle[i][j]; // we see if it has been discovered or is
the current index
else
cout
<< "X"; // else undiscovered
}
cout << " ";
}
cout <<
endl;
for(ll i = 0; i
< 4; i++)
{
for(ll j = 0; j < 4; j++)
{
if(vis[i][j])
cout
<< puzzle[i][j];
else
cout
<< "X";
}
cout << endl;
}
// Just Normal
printing after a round of the game.
}
bool ok = true;
for(ll i = 0; i < 4; i++)
for(ll j = 0; j
< 4; j++)
if(vis[i][j] == false)
ok = false;
// Now if the entire vis matrix has
been marked true means the player
// has discovered all the cards and
he has won the game and we exit the game.
if(ok)
{
cout <<
"Congratulations! You solved the puzzle in " << moves
<< " moves.";
break;
}
}
return 0;
}

I hope I explained the code clearly and the output is in the form suitable towards you. However if any kind of doubt still arises from your side regarding the code or the output, just leave a comment down below and I will be more than happy to help you out any time. Just ask me and I am there to help. If you think I did justice to your question give it a thumbs up. It means a lot. Thank you.
Problem Develop a simple C++ memory puzzle game. The description of the game is as follows: A board has 4 by 4 overturn...
Problem Develop a simple C++ memory puzzle game. The description of the game is as follows: A board has 4 by 4 overturned cards. There is a pair for each card. The player flips over two cards. If they match, then they stay overturned. Otherwise they flip back after 3 seconds. The player needs to overturn all the cards in the fewest moves to win. This is a console game. Use the alphabetical letters from A to H as cards....
For your Project, you will develop a simple battleship game. Battleship is a guessing game for two players. It is played on four grids. Two grids (one for each player) are used to mark each players' fleets of ships (including battleships). The locations of the fleet (these first two grids) are concealed from the other player so that they do not know the locations of the opponent’s ships. Players alternate turns by ‘firing torpedoes’ at the other player's ships. The...
Project 2 – Memory Match Game Purpose This Windows Classic Desktop application plays a simple matching game. The game simulates a card game where the cards a placed face down and the player flips over pairs of cards in an attempt to find matching cards. Program Procedure Display a 4x4 grid of “face down” cards. Assign the letters A through H randomly to the cards in pairs. Allow the user to click on a card to “flip” it over and...
"Blackjack 40" my teacher created this assignment and I need help. He is using c++ and has provided this template: Further instructions are below the template! #include <iostream> #include <cmath> #include <cstdlib> using namespace std; //Will return a number from 1 to 13, representing the face of a card int draw_card() { return rand() % 13 + 1; } int main() { const int BET = 10; //This will allow you to control chance, to make testing easier cout <<...
JAVA Program The Game This is a simple game played on a linear board with squares numbered from 0 to 100. The player starts at position 0, and the object of the game is to land on position 100 exactly. Objectives By the end of this program, the student will have demonstrated the ability to Write static methods Call a static method in another class Pass parameters to a method Return values from a method Write loops Write if statements...
you will implement the A* algorithm to solve the sliding tile puzzle game. Your goal is to return the instructions for solving the puzzle and show the configuration after each move. A majority of the code is written, I need help computing 3 functions in the PuzzleState class from the source code I provided below (see where comments ""TODO"" are). Also is this for Artificial Intelligence Requirements You are to create a program in Python 3 that performs the following:...
Missing multiple labeled functions. Card matching game in C. Shouldn't need any more functions. I am lost on how to complete the main function (play_card_match) without the sub functions complete. The program runs fine as is, but does not actually have a working turn system. It should display question marks on unflipped cards when the player is taking a turn and should also clear the screen so the player can't scroll up to cheat. Thank you #include "cardMatch.h" //main function /*...
can
someone solve this program using c++ (visual studio)?
You have a grid of 4x4 cells which is filled by numbers from 1 to 8. Each number appears twice in the grid. The purpose of the Memory Game is to find the matching numbers. To start the game, Player 1 chooses two cells to uncover the numbers behind them. If the numbers match, player 1 gets to go on and uncover two more numbers. If the numbers don't match, player...
This needs to be done in c++11 and be compatible with g++ compiling Project description: Write a C++ program to simulate a simple card game between two players. The game proceeds as follows: The 52 cards in a deck of cards are shuffled and each player draws three cards from the top of the deck. Remaining cards are placed in a pile face-down between the two players. Players then select a card from the three in their hand. The player...
Please help me
with this project by using Android Studio. I need to know the xml
and the java activities in both activities. Also the manifest
activity. I appreciate the effort and I'll rate you with 5
stars.
1. SUMMARY This project will simulate the card game Concentration for one player. In Concentration, all cards, or pictures in this case, are upside down. Two cards are chosen, and if they match they are taken out of the game. If they...