Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

********In JAVA*************** Memory Game Overview In this portion of the project you will write a progam that simluates a card-matching game between two players. For

********In JAVA***************

Memory Game

Overview

In this portion of the project you will write a progam that simluates a card-matching game between two players. For each game, a standard deck of 52 playing cards will be laid out in 4 rows of 13 columns, in random fashion. The two players then alternate picking two cards to flip over, to see if they match. A matching pair is made up of two cards that have the same number as well as color, thus hearts matches diamonds, and spades matches clubs.

If a match is found, the player who found the match gets to pick again, continuing until they pick two cards that don't match.

The game ends when all the cards are matched, and the winner is the player with the most matches.

Details

All printing below should be done to a file, whose name is up to you.

Your two players must use different guessing stratigies. The layout of the game must be hidden from them, but they are allowed to remember cards that have been placed face up. Some possible stratigies are:

Completely Random

First card something unseen, second card random

First card random, second card based off memory

Both cards based off memory

Any other variations of these

Note: The card number 10 requires 2 characters just to print the number. You can use a three character code for cards with a 10 on them, or use a single character, such as 'T'. I recommend using a single character, as it will keep the grid neater when printed.

After each guess, the table of cards should be printed out, with the two cards guessed "face-up". You can print your game setup using the following abbreviations:

A card facedown can be printed with an "OO" (two capital o's).

A card faceup can be pritned using the two character code.

The number/face value of the card.

The suite of the card: (D)iamonds, (H)earts, (S)pades, and (C)lubs.

An empty space where a match has already been found can be printed as "XX".

If a match is found, print out a sentence similar to:

Congrats! You matched the cards 4D and 4H! 

After all the matches have been found, print the winner of the game (Player 1 or Player 2), along with how many matches they found. In the event of a tie, you can just print "It was a tie." or something similar.

The program will continue to play multiple games. The number of games played in each execution should be a random integer from 1 to 40.

***************in LUA ******************

Part II: Analyzing the games

Your previous program should output the results of each simulation to a file that is both human readible as well as processible by the program you will write for part II. The program you will write for part II will take the results of the simulations, and calculate numerous statistics. These calculations must be calculated in part II, and cannnot be part of the output produced by the program for part I.

You can hardcode the name of the file to expect the results in into your program for this part.

Your program should determine the following and output it to the screen:

The total number of games played

The average number of matches found by player 1 and player 2

The game that took the most guesses (just the number of guesses is fine)

The game that took the least guesses (just the number of guesses is fine)

The average number of guesses per game

The longest streak any player went on, that is consecutive correct guesses in a single turn

The player that won the most

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago