Need help with your Discussion

Get a timely done, PLAGIARISM-FREE paper
from our highly-qualified writers!

glass
pen
clip
papers
heaphones

C++ Programming Code

C++ Programming Code

C++ Programming Code

Description

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:

<strong>void print_board(char in_board[][BOARD_SIZE]);</strong>

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

<strong>void fill_board(char in_board[][BOARD_SIZE]);
</strong>

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: <strong>F</strong>
Pick first card (row, column): <strong>2,3</strong>
Pick second card (row, column): <strong>1,3</strong>

Cards match! You get a point!
Your current points: 1

Here's the board:

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

Your total points: 1 
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: <strong>F</strong>
Pick first card (row, column): <strong>2,2</strong>
Pick second card (row, column): <strong>1,3</strong>

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: <strong>Q</strong>

Your total points: 0 
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: <strong>F</strong>
Pick first card (row, column): <strong>3,1</strong>
Pick second card (row, column): <strong>2,2</strong>

Cards match! You get a point!
Your current points: 1

Here's the board:

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

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: <strong>F</strong>
Pick first card (row, column): <strong>3,2</strong>
Pick second card (row, column): <strong>2,3</strong>

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: <strong>Q</strong>

Your total points: 1
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.

Have a similar assignment? "Place an order for your assignment and have exceptional work written by our team of experts, guaranteeing you A results."

Order Solution Now

Our Service Charter


1. Professional & Expert Writers: Eminence Papers only hires the best. Our writers are specially selected and recruited, after which they undergo further training to perfect their skills for specialization purposes. Moreover, our writers are holders of masters and Ph.D. degrees. They have impressive academic records, besides being native English speakers.

2. Top Quality Papers: Our customers are always guaranteed of papers that exceed their expectations. All our writers have +5 years of experience. This implies that all papers are written by individuals who are experts in their fields. In addition, the quality team reviews all the papers before sending them to the customers.

3. Plagiarism-Free Papers: All papers provided by Eminence Papers are written from scratch. Appropriate referencing and citation of key information are followed. Plagiarism checkers are used by the Quality assurance team and our editors just to double-check that there are no instances of plagiarism.

4. Timely Delivery: Time wasted is equivalent to a failed dedication and commitment. Eminence Papers are known for the timely delivery of any pending customer orders. Customers are well informed of the progress of their papers to ensure they keep track of what the writer is providing before the final draft is sent for grading.

5. Affordable Prices: Our prices are fairly structured to fit in all groups. Any customer willing to place their assignments with us can do so at very affordable prices. In addition, our customers enjoy regular discounts and bonuses.

6. 24/7 Customer Support: At Eminence Papers, we have put in place a team of experts who answer all customer inquiries promptly. The best part is the ever-availability of the team. Customers can make inquiries anytime.

We Can Write It for You! Enjoy 20% OFF on This Order. Use Code SAVE20

Stuck with your Assignment?

Enjoy 20% OFF Today
Use code SAVE20