I was listening an undisclosed vinyl record when I was inspired to write this question. I changed the record player’s speed (angular speed) setting…
November 21, 2020
Frankenstein and Darwin, science homework help
November 21, 2020

Memory matching game in c++

Question description

Hi, I need help with this memory matching game that I am trying to program. here are the instructions:

Select a Theme and have 50 words associated with it:

Words must have a common theme – your choice

Examples: Like Periodic Table Elements, or Sports teams, or Types of cars…

Max number characters in each word is eight(8)

Have one Term describing category/theme you picked. This is the FACE term…

Menu:

Start Options

·  New Game Option

·  Exit Game Option

Level of Play – Use selects at start of game

4 x 4 grid (Easy)

6 x 6 grid (Moderate)

8 X 8 grid (Difficult)

Speed  of Play – At start of game, User selects time interval for clicked-on term-pair to display

1 seconds  (Difficult)

3 seconds (Moderate)

5 seconds (Easy)

Populate Grid with Term

  At start of game – program places the same face/theme term in all squares in the visible grid

If 4 x 4 grid, randomly pick 8 terms, place each image name twice in 2-Dim array.

If 6 x 6 grid, randomly pick 18 terns, place each image name twice in 2-Dim array.

If 8 x 8 grid, randomly pick 32 terms, place each image name twice in 2-Dim array.

The 2-Dim Array corresponds to grid on screen.

During the course of play, the face/theme term in the grid is replaced by a

  corresponding array  terms,  when user selects a grid square

Game Play

1)  User selects a FIRST square, the theme/face term  in the grid square is replace with correspond stored term, from the 2-dim array

2)  User selects a SECOND square, the term theme/face in the second grid square is replace with the corresponding stored term, from the 2-dim array

3)  The computer compares the terms for the two selected squares.

If they are the same, the terms remain on the screen and can no longer be selected.

If they are different, the term remain the screen for 1, 3 or 5 seconds, depending on user selection at the beginning of the game.  After that elapse time, those two grid terms are replaced with the face/theme term.

I’m not entirely sure how to make the gameboard itself or how to double the 50 words and randomize them.

And here is my code so far:

#include <string>

#include <ctime>

#include <cstdlib>

#include <iostream>

#include <algorithm>

#include <iomanip>

using namespace std;

void gridEasy(void);

void randomizeTheme(string theme[]);

int main()

{

string theme[16] = { “a”, “b”, “c”, “d”, “e”, “f”, “g”, “h”, “i”, “j”, “k”, “l”, “m”, “n”, “o”, “p” };

int playGame;

int grid;

bool firstRun = true;

cout << “Would you like to play a memory matching game?” << endl;

cout << “press 1 to play, press 0 to exit” << endl;

cin >> playGame;

if (playGame == 1)//if the player wants to play the game, run this line of code

{

cout << “Please choose your grid: ” << endl << endl;

cout << “1. 4 x 4 grid (Easy)” << endl;

cout << “2. 6 x 6 grid (Medium)” << endl;

cout << “3. 8 x 8 grid (Hard)” << endl << endl;

cin >> grid;

}

else if (playGame == 0) {//if the player wants to exit, run this line of code

return 0;

}

else{

return 0;

}

if (grid == 1)

{

return 16;

}

else if (grid == 2)

{

return 32;

}

else if (grid == 3)

{

return 64;

}

else

{

do

{

cout << “Please choose your grid: ” << endl << endl;

cout << “1. 4 x 4 grid (Easy)” << endl;

cout << “2. 6 x 6 grid (Medium)” << endl;

cout << “3. 8 x 8 grid (Hard)” << endl << endl;

if (!firstRun)

{

system(“CLS”);

cout << “Not a correct response, please try again.” << endl;

cin.clear();

cin.ignore(INT_MAX, ‘n’);

}

firstRun = false;

} while (!(cin >> grid));

gridEasy();

srand(time(0));

randomizeTheme(theme);

for (int i = 0; i < 16; i++)

{

cout << theme[i] << endl;

}

system(“Pause”);

return 0;

}

}

void gridEasy(void)

{

for (int r = 0; r < 4; r++)

{

for (int c = 0; c < 4; c++)

{

cout << “—————————–” << endl;

cout << “|” << setw(9) << r + 1 << setw(9) << “|” << endl;

cout << “—————————–” << endl;

}

}

cout << “——————————————————————————–“;

}

void randomizeTheme(string theme[])

{

random_shuffle(theme, theme + 16);

}

 

Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code “Newclient” for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.


 

"Are you looking for this answer? We can Help click Order Now"