Blackjack

Basic Requirements

  • 1 deck of cards, shuffled after each hand.
  • The game will include 1 player and 1 dealer.
  • Cards should be distributed in the following fashion: player (face up), dealer (face down), player (face up), dealer (face up), [player], [player], [player], [dealer], [dealer], [dealer]. The cards in "[]" indicate optional cards based on whether or not the player or dealer hits. Both the player and dealer will receive a minimum and maximum of 2 and 5 cards respectively.
  • 5 card charlie will be used. If the player or dealer obtains 5 cards without busting, he automatically wins the hand.
  • Betting will be incorporated in this game and the player will start out with $500.. The player should bet BEFORE the cards are dealt. The player minimum bet is $5 and the maximum bet is the total player amount. If the player dips below $5, the game is over. * Special features such as splitting, doubling-down, obtaining insurance, etc. will NOT be incorporated in this game, however, you may add these features later once you get the core functionality working.
  • After the initial two cards are dealt out, the player has the option to HIT (receive another card) or STAND (not receive another card and move control over to the dealer).
  • If the player BUSTS (goes over 21), the player automatically looses and we move onto the next hand.
  • Dealer hits on anything less than 17. Dealer will stand on anything 17 or higher. If one of the first two cards of the dealer is an Ace it will have the value of an 11. However, if the dealer is dealt two aces to begin, the hand value will be 12. If the dealers hand value goes over 21 and he has a hard Ace (value of 11), that Ace will be converted to a Soft Ace (value of 1).
  • If the player gets natural blackjack and dealer does not, then player automatically wins and gets 1.5 times their bet back. If the dealer gets a natural blackjack and the player does not, then the dealer automatically wins. If both the player and dealer have a natural blackjack, it is a push. A natural blackjack (21 with just two cards) is the only hand that pays out 1.5, even if the player or dealer wins with a total card count of 21 (with more than two cards).
  • Graphics is not required but encouraged.
  • Testing functionality should be incorporated in your program to allow you and your team to easily and quickly test several scenarios in your program. Considering all the possibilities involved in the game of Blackjack, testing under normal random card distribution would be extremely tedious and time consuming.You should have TWO drivers, one for normal game playing and another for tesitng your classes. See below for details on the testing requirements.

Example Game Play

Player has $500.00
Player BETS $10
Player gets 10S (card face up)
Dealer gets 5S (card face down)
Player gets 3S (card face up)
Dealer gets 10H (card face up)
Player has a total of 13 and dealer is showing a 10.
Player decides to HIT.
Player gets 3C, bringing his total to 16.
Player decides to STAND.
Dealer shows his face down card. His total is 15 so he must HIT.
Dealer gets a 2D, bringing his total to 17. The dealer STANDS and WINS.
Player has $490.00

Testing Information

Your project should include a driver for testing purposes along with a text file called "TESTING.IN" which can hold testing scenarios. Here is an example of what the text file may look like:

#1 - Test Player Bust
10, p09H, d12S, p05C, d07S, p10D
#2 - Test Dealer/Player Push
20, p10C, d10H, p8H, d8S

The first line indicates the testing number ("#1") along with a test case description ("Test Player Bust"). The second line indicates the bet amount (10) and the cards to be dealt out (Player gets 9 of Hearts, Dealer gets 12 of Spades, Player gets 5 of Clubs, Dealer gets 7 of Spades, Player gets 10 of Diamonds). The order will always be player, dealer, player, dealer. Thereafter, the player may hit 0 to 3 times followed by the dealer who may hit 0 to 3 times. Additional test case scenarios can follow as desired.

The testing functionality should read from "TESTING.IN" to test the scenarios listed in the file and then output the results to a file called "TESTING.OUT". Below is an example of what the output file may look like:

#1-Dealer-10
#2-Push-0

The first line indicates the testing number ("#1"), the winner ("Dealer"), and winnings ("10"). The second line indicates the testing number ("#2"), the winner ("Push"), and winnings ("0"). The output should be formatted EXACTLY as shown above since your project will be graded, in part, by the number of test cases passed and test cases only pass if your output matches the expected output exactly.

As a quick refresher, here is sample code that demonstrates how to read from a file.

FileReader reader = new FileReader("test.dat");
Scanner in = new Scanner(reader);
 
while(in.hasNextLine())
{
    String s = in.nextLine();
    . . .
}
 
reader.close();

Design Requirements

Your Blackjack Designs should include the following:

  • Cover page with the date and team member names,
  • One to two pages explaining the rules of blackjack which are specific to the functionality of your game.
  • A walk-through that explains the execution of the game from start to finish. You should include screen shots in the walk-through to facilitate understanding. All aspects of the game should be addressed here, leaving no question as to how various conditions will be handled. This will require multiple pages.
  • A page that includes a UML diagram from Violet. This diagram should show all the classes along with their respective instance fields and methods.
  • On the last page, you should list the following: a) how you plan on dividing the workload of the project (if you are working on a team), b) any questions/concerns you have regarding how to implement the project.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License