Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ code blocks ( write begginers program) 3. (Memory Game A common memory matching game played by young children is to start with a deck

image text in transcribed
image text in transcribedC++ code blocks ( write begginers program)
3. (Memory Game 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 shuffied 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 or the user chooses not to continue. Write a program that plays the memory matching game. Use sixteen cards that are laid out in a 4x4 square and are labeled with pairs of numbers from 1 to 8, respectively. Your program should allow the player to specify the cards that the user would like to select through a coordinate system. For example, in the following layout: 3 All ot the cards are face down except for the pair 6 which has been located at coordinates (1,1) and (2,3). Hint: Use a 2D array for the initial arrangement of cards Lint carda [LENCT) CLENCTE (1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8):) and another 2D array that indicates if a card is face up or face down (bool faceup[LENCTH] ILENGTE] (0)). Write a function that "shuffies" the cards in the array by repeatedly (say 10000 times) selecting two cards at random and swapping them. See the sample output. Use another function sbowBoardt show output board nter the size of the board 2 or 4:4 ind all the watching pairs on the boand. nter an x and y position of the Ast card to flip: 33 nter an x and y position of tho card to fup: 2 3 have s pairs to reveal. To continue enter (Y or y): m 1 234 could only find e matching pairs in 1 iterations need to look for exercises to boost your menory

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

Consider this article:...

Answered: 1 week ago

Question

2. Explain how the role of training is changing.

Answered: 1 week ago

Question

7. General Mills

Answered: 1 week ago