A common memory matching game played by young children is to start
with a deck of cards that contain identical pairs. For example, given six
cards in the deck, two might be labeled “1,” two might be labeled “2,”
and two might be labeled “3.” The cards are shuffled and placed face
down on the table. The player then selects two cards that are face down,
turns them face up, and if they match they are left face up. If the two cards
do not match, they are returned to their original position face down. The
game continues in this fashion until all cards are face up.
Write a program that plays the memory matching game. Use 16 cards that
are laid out in a 4x4 square and are labeled with pairs of numbers from 1
to 8. Your program should allow the player to specify the cards that she
would like to select through a coordinate system.
This is what the book shows for an expample
1 2 3 4
----------------------
1 8 * * *
2 * * * *
3 * 8 * *
4 * * * *
For example, suppose the cards are in the following layout:^^
All of the cards are face down except for the pair 8, which has been
located at coordinates (1, 1) and (2, 3). To hide the cards that have been
temporarily placed face up, output a large number of newlines to force
the old board off the screen.
Hint: Use a two-dimensional array for the arrangement of cards and
another two-dimensional array that indicates if a card is face up or face
down. Write a function that “shuffles” the cards in the array by repeatedly
selecting two cards at random and swapping them. .
The professor says "You dont need to sue a random number generator to shuffle. You can just place the cards in a random order"
// Memory2.cpp
//
#include <iostream>
using namespace std;
int card_face;
int card_value[4][4];
int card_value2;
//function declaration
int fill_values(card_value[4][4]);
void fill_values(int card_values[4][4]);
int main(void)
{
fill_values
{
card_value2
cout<< "Enter first coordinate."
}
int fill_values(int card_value[4][4]);
card_value[0][0]=5;
card_value[0][1]=3;
card_value[0][2]=2;
card_value[0][3]=7;
card_value[1][0]=4;
card_value[1][1]=8;
card_value[1][2]=1;
card_value[1][3]=6;
card_value[2][0]=7;
card_value[2][1]=3;
card_value[2][2]=4;
card_value[2][3]=6;
card_value[3][0]=1;
card_value[3][1]=2;
card_value[3][2]=8;
card_value[3][3]=5;
cout << fill_values << endl;
return 0;
}
//cardface [i][j]=0
//for(i=0; 1<4 ; i++)
//for(j=0; j<4; j++
This is what ive got but keep getting errors and i don't know where to go with this...frankly i just dont think I'm ready to write a program like this, but my proffessor thinks so...hellpppp me asap pleeaasseee....