Written By TheVBProgramer.
Write a VB application that implements a game of Concentration. In a game of Concentration, the player is presented with a board containing some number (24 in my implementation) of "covered" images. The player clicks on the covered pictures in sets of two to reveal the randomly assigned pictures beneath. If the two pictures match, they remain displayed; if not, they are flipped back over. The goal of the game is to reveal all matches (12 in my implementation) in as short a time as possible.
The program must maintain (in a file) the best time and display it on the screen as the "time to beat". Whenever the best score is beat, the new time becomes the best score and should be written out to the file.
My implementation also tracks the number of turns it took to reveal all matches (the fewer the better). A perfect score would be 12 in my implementation (but a score of 12 turns would be nearly impossible, as the player would have make 12 correct guesses in a row).
My implementation of the game is shown below. I am using playing cards as the pictures.
When the game first starts, all cards are shown face down. The "Best Scores" area shows the previous best time and number of turns, read in from a file. (Note: The "Reset" button effectively clears the best scores â€“ it sets the best time to 99:99 and the number of turns to 9999.) The clock for "This Game" has started ticking.
In the middle of game play, the pairs that have been matched remain face up, those yet to be matched remain face down. The clock is still ticking (one minute, 20 seconds â€“ looks like we're not going beat the best time of one minute, 14 seconds!).
At the end of the game, all cards will be face up and the clock will stop ticking.
Download the solution for this project here.