Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A common memory matching game played by children is to start with adeck of ident

ID: 3615069 • Letter: A

Question

A common memory matching game played by children is to start with adeck of identical pairs face down on a table. A player selects twocards and turns them face up. If they match they remain face up. Ifthey don’t match they are flipped face down. The gamecontinues until all of the caA common memory matching game playedby children is to start with a deck of identical pairs face down ona table. A player selects two cards and turns them face up. If theymatch they remain face up. If they don’t match they areflipped face down. The game continues until all of the cards areface up.

Write a program that plays the memory game. Use 16 cards laid outin a 4 x 4 square and labeled with pairs of numbers from 1 to 8.Your program should allow the player to specify the cards that heor she would like to select through a coordinate system.

For example, suppose the cards are in the following layout:
1 2 3 4
-----------
1 | 8 * * *
2 | * * * *
3 | * 8 * *
4 | * * * *

All of the cards are face down except the pair of 8 which theplayer found by entering (1,1) and (2,3). To hide cards that havebeen placed temporarily up, output a large number of blank lines toforce the old board off the screen.

Hint: Use a two-dimensional array for the arrangement of cards andanother two-dimensional array that indicates if a card is face upof face down. Write a function that “shuffles” thecards in the array by repeatedly selecting two cards at random andswapping them.rds are face up.


Explanation / Answer

please rate - thanks #include #include #include using namespace std; void shuffle(int[]); void arrangedeck(int[],int[][4],bool[][4],int &,int &,int&,int &); void print (bool[][4],int[][4]); void getplay(int &,int &,int &,int&,bool[][4],int[][4]); int get(string); int main() { inti,j,row1,row2,col1,col2,prow1,prow2,pcol1,pcol2,deck[16],arr[4][4],show=2; bool face[4][4]={false}; srand(time(0)); shuffle(deck); /* cout
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote