Twenty-one: The dice game 21 is a variation of casino Blackjack. Consider a heads-up game between a solitary player and the dealer. In each round of the game the following sequence of events occurs:

  • The player rolls a die and accumulates "points" equal to the face value on the die.
  • The player continues to roll until either the player chooses to hold or the player has more than 21 points (busts).
  • If the player busts then the dealer automatically wins the round. If the player holds before reaching 22 points then their turn is done.
  • The dealer now rolls the dice accumulating points in the same way.
  • If the dealer busts (earns more than 21 points) then provided the player did not bust, the player wins.
  • If the dealer does not bust then whichever of the two is closer to 21 wins the round, or there is a tie in the case that they have the same score.

Part I

Your first job is to write an application in Java that allows a human user to play this game against a computer dealer. What I haven't told you is how the dealer will decide when to stop. This is called the "dealer's stopping rule". The deaeler's stopping rule is basically a point value threshold that once crossed forces the dealer to hold. That is, it's just a number (and it must be constant). For example, suppose the stopping rule is "hold on 17". Then, once the dealer has accumulated 17 or more points they hold, a winner is determined, and the round is over. For the first part of this project you can use any stopping rule you like.

Part II

Your second job is to determine what the best stopping rule is for the dealer. You will do this by writing a program that plays thousands of games of computer player against computer dealer. Your program will serve as an experiment that allows you to determine the optimal stopping rule via computer simulation.

Part III

Now do both parts again only with the rule that two dice must be rolled at a time in all situations. What is the dealer's optimal stopping rule for this variation of the game? Determine via simulation.

For each part of this assignment use the following naming convention for your test classes:

  • Part I use BlackJack1
  • Part II use BlackJack2
  • Part III use BlackJack3 and BlackJack4

Besides the test classes your solutions should include at least four other classes: A Player class, a Dealer class, a Game class, and a Die class. You may need more than these to answer all three parts. Include with your source a ReadMe.txt file that explains how to use your software, the rationale behind your experimental design, and the results of your experiments.

Academic Honesty!
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.