In this assignment you will build a card game where the player has to guess whether the next card is higher or lower. To keep things simple you may work with only one suit of cards instead of the complete deck.
In this game, a player is shown two playing cards side by side. The left card is face up and the right card is face down (only the back is visible). The player starts with $500 and can bet any amount of money up to his or her current score but only in multiples of $10 (e.g., $10, $20, $30, etc.) The player must bet an amount greater than zero. After placing a bet, the player decides whether the right hand card (the “next” card) is higher or lower than the face up card. If correct, the player wins double the bet. If incorrect, the player loses the money bet.
The ordering of cards from least to greatest is as follows: 2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A.
Part I: Play Game Form
When the game first loads, it shows the following: two playing cards face down, current score, and instructions. The player has a place to enter a bet, which is disabled until the game begins. Until the game begins, the player can only choose to start the game or exit.
Beginning the game enables a place to bet and a way to enter the bet. Once the bet is entered, the player must choose higher or lower (disabled but visible until the player enters a bet). After player decides higher or lower, the game displays the second card’s face to the player and updates the current score.
When the player enters a new bet, the card pictures reset to only show the left card face up and the right card face down. The player then guesses again whether the face down card is higher or lower. The game repeats until the player has zero money left.
Everything with which the player interacts in the game should always be visible to the player, to prevent confusion. To help the player understand what to do, enable and disable controls as necessary as game play progresses.
The game has 6 commands available at different times during game play: Begin Game, Reset, Exit, Place Bet, Higher, Lower, and Next Card.
On each draw, the cards are played without replacement, but in one game, cards may repeat. The game ensures that the next card is not exactly the same as the previous card, but the game does not count cards. In other words, on one guess, it may show the Ace and 2. The next guess could be 2 and Ace, but it would not be 2 and 2 or Ace and Ace. (Note: In the multiple suits version, the game does not repeat cards but it could repeat numbers – just of a different suit.) The cards’ image size is 50x70.
Choosing Reset returns the game to its initial condition.
Also, the game keeps track of the player’s highest score earned, but does not display the number to the player. The player’s highest score during the game is added to a text file when the game ends.
Your program will have one class called Card that returns a random number when it is called. Similar to the Coin class given in section 9.1, it will have a method that will generate a random number to simulate the drawing of a card.
Your program must have at least 2 methods. All of this functionality must be in your program, and it is suggested to use methods. Write the high score to a file during game play, switch right card to left card, check if the bet placed is valid (a valid bet is an integer which is a multiple of 10 without spaces before or after).
Part II: Admin Form
The Admin Form works with the text file of high scores created by the player’s repeated game play. This form could be useful for casinos who want to use your game.
When the Admin Form loads, it loads the contents of the scores text file into a List or Array (your choice).
The form displays in a list box the highest score, average score, and lowest score when the user selects Load Scores.
It is not our intention to break the school's academic policy. Projects posted are only used as a reference
and should not be submitted as is. We are not held liable for any misuse of the solutions.
Please see the frequently asked questions page
for further questions and inquiries.
Kindly fill out the form.
Please provide a valid email address and we'll get back to you in less than 24 hours.
We will be sending an invoice through PayPal upon confirmation.
We are a non profit organization however we need an amount to keep this organization running,
and to be able to complete our research and development.