A common memory matching game played by young children is to start with a deck o
ID: 3527653 • Letter: A
Question
A common memory matching game played by young children is to start with a deck of cards that contains 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 facedown on the table. The player then selects two cards that are facedown, turns them faceup, and if they match they are left faceup. If the two cards do not match, they are returned to their original position facedown. The game continues in this fashion until all cards are faceup. Write a program that plays the memory matching game. Use 16 cards that are laid out in a 4 times 4 square and are labeled with pairs of numbers from 1 to 8. Your program should allow the player to specify the cards through a coordinate system. For example, in the following layout all of the cards are facedown except for the pair of 8's, which has been located at coordinates (1,1) and (2,3). To hide the cards that have been temporarily placed faceup, output a large number of newlines that force the old board off the screen. Hint: Use a 2D array for the arrangement of cards and another 2D array that indicates whether a card is faceup or facedown. Write a function that "shuffles" the cards in the array by repeatedly selecting two cards at random and swapping them. You have collected reviews from four movie reviewers where the reviewers are numbered 0-3. Each reviewer has rated six movies where the movies are numberedExplanation / Answer
A common memory matching game played by children is to start with a deck of identical pairs face down on a table. A player selects two cards and turns them face up. If they match they remain face up. If they don’t match they are flipped face down. The game continues until all of the cards are face up. Write a program that plays the memory game. Use 16 cards laid out in 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 he or 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 the player found by entering (1,1) and (2,3). To hide cards that have been placed temporarily up, output a large number of blank lines 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 of face down. Write a function that “shuffles” the cards in the array by repeatedly selecting two cards at random and swapping them. I wrote most of the program but for some reason nothing happens once the values for the selected card are entered. Here's my code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 #include #include #include using namespace std; int main() { char comma; int r1, c1, r2, c2, cards[4][4]; srand((unsigned)time(NULL)); //fill board for (int r=0; rRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.