Blackjack Assignment

From Knowledge Kitchen
Jump to navigation Jump to search


Details

You are to create a program whereby a single user can play a variation of blackjack against a virtual dealer robot.

About blackjack

Blackjack is a popular card game. At the end of the game, the player with highest value cards wins, but those cards cannot be worth more than 21 points, or the player loses.

The rules

Play progresses as follows:

  1. Two cards are given and displayed to the user.
  2. Two cards are given to the dealer, but these are secret and not displayed to the user.
  3. The user is prompted whether they would like an additional card. They can request as many additional cards as they would like, until they choose to "stop", "stand", or "pass". If the value of the cards exceeds 21 at any point during this process, the user has "busted" and lost, and the game ends.
  4. The robotic dealer decides whether to request as many additional cards as it wants. You can have the robot dealer do this at random if you like, or you can develop an artificial intelligence algorithm. If the robot dealer's cards exceed 21 points during this process, the dealer has busted and lost, and the user wins.
  5. At the end of the game, if the user's cards are higher in total value than the dealer's cards, the user wins. Otherwise, the dealer wins.
  6. Regardless of how the game ends, the program must show the user what cards the dealer has at the end of the game.

Notes

  • Do not worry about drawing the same card twice. Draw cards at random.
  • All "cards" are simply integer values from 2 thru 11.
  • These rules are slightly different from how blackjack is played in casinos.

Flow chart

The following is a rough flow chart showing the flow of this program. Blackjack assignment flow chart.png

Extra Credit

Extra 10%!

Create the program using Swing GUI components, including images of the cards that are dealt.

Hint: you may want to look up how to create image icons in your book's index. They can be used in JOptionPane dialogs.


What links here