C++ Question

Learning Goal: I’m working on a c++ question and need an explanation and answer to help me learn.

C++ source file name: Memory.cpp

File name must be Memory.cpp

Write a program that plays a memory game with cards containing upper-case letters. The cards are laid out in a 4×4 grid with row and column indices from 0 to 3, as follows (the left diagram with the dollar signs represent the back of the card, the right diagram represents the front of the card. Note that the letters on the cards should be randomly generated from uppercase A-Z each time the game is played from the start): Download Sample program)

 0 1 2 3 0 | \$ | \$ | \$ | \$ ——————- 1 | \$ | \$ | \$ | \$ ——————- 2 | \$ | \$ | \$ | \$ ——————- 3 | \$ | \$ | \$ | \$ ——————- 0 1 2 3 0 | K | M | T | P ——————- 1 | P | Y | K | X ——————- 2 | G | T | E | Y ——————- 3 | M | X | E | G ——————-

Note that each letter is represented exactly twice in the right diagram. The objective of the game is to find as many matching pairs as possible.

Each round of gameplay should do the following:

1. Print the board. Previously matched cards should show the matched letters.
2. Ask the player if they’d like to Find a match (F) or Quit (Q)
3. If the player chooses Find, ask for the two cards in row, column format. Make sure that the cards are not the same card(e.g., player chooses card 1,1 and 1,1) and that neither card has already been matched. If either of these cases is true, then prompt the player to choose new cards in row, column format.
4. After each choice, tell the player how many points they have. They get a point for every matching pair of cards.
5. Print the player’s final number of points if they choose to Quit (Q).

If there are no cards left to play (all matches have been found) the player wins and the game should print their final points and end. See the sample outputs for more details on gameplay.

Required Functions:

You code must have at least the following two functions. The parameters passed can be different than what is shown below. You may use any other functions you wish:

`void print_board(char in_board[][BOARD_SIZE]);`

This function prints the current board to the screen with matched cards flipped to show their letter and unmatched cards unflipped.

```void fill_board(char in_board[][BOARD_SIZE]);
```

This function fills the board with randomly selected uppercase letters in the range A-Z. Note that each letter generated must appear exactly twice on the board.

Your program’s output must match the output below as exactly as possible.

Scenario 1: One Round, Cards Match

(the matched cards stay flipped to their letter for the rest of the game):

```Welcome to Memory Game!

Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | \$
-----------------
2 | \$ | \$ | \$ | \$
-----------------
3 | \$ | \$ | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: F
Pick first card (row, column): 2,3
Pick second card (row, column): 1,3

Cards match! You get a point!

Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | A
-----------------
2 | \$ | \$ | \$ | A
-----------------
3 | \$ | \$ | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: Q

Goodbye!```

Scenario 2: One Round, Cards Don’t Match
(the chosen cards are flipped to their letter after the non-match is announced):

```Welcome to Memory Game!

Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | \$
-----------------
2 | \$ | \$ | \$ | \$
-----------------
3 | \$ | \$ | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: F
Pick first card (row, column): 2,2
Pick second card (row, column): 1,3

Cards do not match! Try again!
Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | X
-----------------
2 | \$ | \$ | B | \$
-----------------
3 | \$ | \$ | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: Q

Goodbye!```

Scenario 3: Multiple Rounds, Some Matches, Some Non-Matches:
(matched cards stay flipped to their letter, but non-matched go back to the \$ after they’re shown):

```Welcome to Memory Game!

Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | \$
-----------------
2 | \$ | \$ | \$ | \$
-----------------
3 | \$ | \$ | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: F
Pick first card (row, column): 3,1
Pick second card (row, column): 2,2

Cards match! You get a point!

Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | \$
-----------------
2 | \$ | \$ | W | \$
-----------------
3 | \$ | W | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: F
Pick first card (row, column): 0,2
Pick second card (row, column): 1,1

Cards do not match! Try again!
Here's the board:

0   1   2   3
0 | \$ | \$ | K | \$
-----------------
1 | \$ | Q | \$ | \$
-----------------
2 | \$ | \$ | W | \$
-----------------
3 | \$ | W | \$ | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: F
Pick first card (row, column): 3,2
Pick second card (row, column): 2,3

Cards do not match! Try again!
Here's the board:

0   1   2   3
0 | \$ | \$ | \$ | \$
-----------------
1 | \$ | \$ | \$ | \$
-----------------
2 | \$ | \$ | W | X
-----------------
3 | \$ | W | P | \$
-----------------
Choose an option:
(F) Find a match
(Q) Quit
Choice: Q

Goodbye!```

Submissions will be screened for plagiarism and other academically dishonest practices so you MUST do entirely your own work. You may help each other to understand and mathematically grasp the problems, but all submitted work must be unique and original. Please submit your assignment by the due date to the Assignment 3 location in Canvas.

Note: There are MANY solutions to this assignment online. Using these solutions too heavily, like copying and pasting parts or entire code solutions, is also considered Plagiarism.

Calculate the price of your order

550 words
We'll send you the first draft for approval by September 11, 2018 at 10:52 AM
Total price:
\$26
The price is based on these factors:
Number of pages
Urgency
Basic features
• Free title page and bibliography
• Unlimited revisions
• Plagiarism-free guarantee
• Money-back guarantee
On-demand options
• Writer’s samples
• Part-by-part delivery
• Overnight delivery
• Copies of used sources
Paper format
• 275 words per page
• 12 pt Arial/Times New Roman
• Double line spacing
• Any citation style (APA, MLA, Chicago/Turabian, Harvard)

Our guarantees

Delivering a high-quality product at a reasonable price is not enough anymore.
That’s why we have developed 5 beneficial guarantees that will make your experience with our service enjoyable, easy, and safe.

Money-back guarantee

You have to be 100% sure of the quality of your product to give a money-back guarantee. This describes us perfectly. Make sure that this guarantee is totally transparent.

Zero-plagiarism guarantee

Each paper is composed from scratch, according to your instructions. It is then checked by our plagiarism-detection software. There is no gap where plagiarism could squeeze in.

Free-revision policy

Thanks to our free revisions, there is no way for you to be unsatisfied. We will work on your paper until you are completely happy with the result.