Question: Problem 01: Memory Game (30 points) Children often play a memory game in which a deck of cards containing matching pairs is us The cards
Problem 01: Memory Game (30 points) Children often play a memory game in which a deck of cards containing matching pairs is us The cards are shuffled and placed face down on a table. The players then take tums two cards at a time. If both cards match, they are left face up; otherwise, the cards are placed face ed down at the same match, then they can memorize The the players see the selected pair of cards and if the cards do not the cards and use their memory to select the next pair of cards match, then theye o game continues until all the cards are face up. Write a program to play the memory game Use a two-dimensional array of 4 rows and 4 columns for a deck of 16 cards with 8 maiching pairs. You can use numbers 1 to 8 to mark the cards. Use random number generators to randomty store the pairs in the array. Use appropriate functions in your program, and the main program should be merely a call to functions Sample Output for Problem 01 of the oi nter the row (1 to 4) and ee>(1 to 4).position of the pair (1 to 4) position of the pair: 3 Pair match Enter the row (1 to 4) and col C1 to 4) position of the pair: 1 2 nter the row C1 to 4) and col C1 to 4) position of the pair: 44 Pair do not match. select again Enter the row (1 to 4) and col (l to position of the pair: 73 nvalid position nter the row to 4 and col (1 to position of the pair: 2 2 ard at, this position already faced up. Select position again nter the row (i to 4) and col (i to 4) position of the pair: 7 166 2 8 S 3 385 air match 7 166 28S 3 385 ress any key to continue
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
