I’m working on a java project and need a sample draft to help me study.For this final project, you are required to develop a casino Blackjack in Java, so that a user can play multiple hands against the computerised Casino. Blackjack, also known as twenty-one, is the most widely played casino banking game in the world. It is a card game between the dealer and one or more players in terms of a number of hands of cards.
There are variations in the Blackjack rules in different casinos, and we will adopt the following simplistic rules for the project:The game will be played out on one or more decks of 52 cards, shuffled together, and each deck of cards consists of 52 cards in 4 suits of spades, hearts, diamonds and clubs, as in the following tableSpades:A♠2♠3♠4♠5♠6♠7♠8♠9♠10♠J♠Q♠K♠Hearts:A♥2♥3♥4♥5♥6♥7♥8♥9♥10♥J♥Q♥K♥Diamonds:A♦2♦3♦4♦5♦6♦7♦8♦9♦10♦J♦Q♦K♦Clubs:A♣2♣3♣4♣5♣6♣7♣8♣9♣10♣J♣Q♣K♣
Each card can be counted for a value. Cards for Jack, Queen, and King will all have the value 10, an Ace can be counted either as 11 or as 1 up to the owner of that card, and the rest of cards will be counted according to their respective face value.
Before a game starts, all players must first place their bet or wager on their respective hands. Then 2 cards, all facing up, are dealt into each hand, and 2 more cards are finally dealt to the dealer as well, one card facing up and one card facing down.
The players will take turn, in the order of hands displayed on the table, deciding whether to “Hit”, which means to add another card to his hand, or to “Stand” or “Stay”, which means to stop taking more cards. A player can choose to hit repeatly until he either decides to stand or his hand has gone bust, i.e. the total of the card values of his hand has gone beyond 21.
Once all hands are finalised due to staying or gone bust, the dealer will show the value of hidden card dealt to him earlier on. Then depending on the total value of his cards, he has to carry on drawing another card if the total remains less than or equal to 16, and must stand if the total is 17 or more.
If the dealer has gone bust, then all the remaining hands on the table will all win.
Any hand whose total value is greater than the dealer’s, then that hand wins. If the total value of a hand is less than that of the dealer’s, then the dealer wins. If the dealer wins, he gets to keep the bet on the hand; if a hand wins, the player gets to keep his bet as well as an extra payment of equal amount from the dealer.
If a hand’s total value is equal to the dealer, then there is no win or loss between the dealer and the hand.
We note that our game rules exclude doubling-down, splitting or any other features not listed above, but may be applicable to some real-life casinos.
This project is open in that students are expected to have their own design to enrich their final software product. Hence what functionalities should be implemented will be a part of the project design, aiming for the excellence of the product at the end. Some of the following questions may affect your design:How many decks of cards can be chosen for the games?
Is there a pleasing and effective way to display all hands of cards?
How to effectively place (game-wise) bets and keep track of the wins and losses?
Can you keep track of all the cards already dealt, and calculate the chances of getting a high card or a lower card, or getting busted with the drawing of the next card?
It is up to each student group to decide how to design and implement their Blackjack system. However, the project will be evaluted according to the functionalities, user interface, robustness, and how much object-oriented programming is being utilised.
Do not use any existing Java classes unless they are a part of the official JDK package, or you have written those classes yourselves. Beware also that the Blackjack rules on this particular sample may not be identical to those of ours.
A primitive Blackjack simulator is available on the Internet or on this local site. However, you are not make use of their code directly.
Two simplified sample Java programs RandomHand.java (Attached) and BlackJack.java (Attached) can also be helpful. Students can feel free to use or modify any part of these 2 Java programs to suit their own project purposes. However, the more you design and write your own programs, including modifying/improving these provided 2 Java programs, the more you have achieved in this project.
should not utilise any of the Java GUI components nor any form of database servers for their project.
The final Project Report must be written to include, among all the other relevant matters, the following aspects.The main functionalities, along with the demonstrating examples and screen shots if pertinent.
The design of your user interface and how it impacts on the user experience with your software product.
How and where you made use of the paradigm of object-oriented programming, if any.
The most advanced 3 (or more) Java technical aspects, in your opinion, you have made use of in the development of your BookStock System.
Brief conclusion and reflection on your experience in completing this project.
SAMPLE RUNSHere are several execution sessions on some related Blackjack Java programs, ranging from the (provided) basic card representation via BlackJack.java, to a single deck and single game SimpleBlackJack.java, then to multiple games with bets BlackJackCards.java, and finally to multi-games with auto-simulations (auto-simulations are not required for this project nevertheless).A game session by the sample implementation BlackJack.java (about 130 lines in code).
C:JAVA>java BlackJack
A deck of 52 cards in random order:
7 25 20 15 28 29 21 26 23 0 30 46 31 19 9 5 41 37 16 38 34 14 32 3 18 35
27 47 49 40 51 50 17 36 10 48 4 22 12 44 42 43 24 8 13 2 45 39 6 11 1 33
1. Player gets an card facing up:7 C:2
2. Other players, if any, each gets a card in turn before the dealer’s turn.
3. Dealer gets a card facing up:25 H:7
4. Player draws another card facing up:20 S:6
5. Other players, if any, each gets a card in turn before the dealer’s turn.
6. Dealer gets the 2nd card facing down:xx X:xx
7. For each player, he can keep drawing an extra card facing up until he chooses to “stay”
or his hand busts (total value goes over 21). Then the next player takes his turn.
8. Players now choose to “stay” for simplicity.
9. Dealer turns his 2nd card facing up:15 C:4
10.Dealer can keep drawing an extra card until he stays or his hand busts.
11.Dealer now chooses to stay for simplicity.
Player has cards C:2, S:6 with the total value 8
Dealer has cards H:7, C:4 with the total value 11
Dealer wins the betting amount from the player.
C:JAVA>
A game session by a simple implementation (about 165 lines in code). Dealer and players’ input is highlighted in this color.C:JAVA>java SimpleBlackJack
1 decks of cards in random order:
41 38 33 4 9 16 28 22 14 36 50 34 43 30 37 46 0 8 32 24 15 48 21 12 49 35
6 18 1 45 23 47 51 42 20 44 29 11 40 13 17 7 27 5 26 39 19 3 10 31 25 2
Blackjack game starts:
Player gets H:J
Dealer gets D:10
Player gets H:9
Dealer gets another cards.
Player (H:J, H:9 -> 19) hit or stand? >>> s
Dealer (D:10, S:2 -> 12) hit or stand? >>> h
Dealer (D:10, S:2, H:3 -> 15) hit or stand? >>> h
Dealer (D:10, S:2, H:3, S:5 -> 20) hit or stand? >>> s
Player’s hand: (H:J, H:9) has 19 points.
Dealer’s hand: (D:10, S:2, H:3, S:5) has 20 points.
Dealer wins.
C:JAVA>
A game session for an implementation (about 340 lines in code) that supports multi-players, multi-decks, betting, and auto game-playing.C:JAVA>java BlackJackCards /p:3 /d:2 /s
Usage: java BlackJackCards [/p:#] [/d:#] [/a:#] [/s]
/p: number of players (default 1)
/d: number of decks of cards (default 1)
/a: number of automatic game runs (default 0)
/s show the randomised full decks of cards (default none)
2 decks of cards in random order:
3 52 79 75 74 91 56 88 70 77 39 49 60 93 58 99 89 65 50 78 90 63 29 47 80 83
38 96 14 12 102 18 98 92 0 59 10 5 23 57 13 8 11 33 84 42 66 76 37 81 46 86
71 1 21 22 72 19 20 48 95 61 101 6 40 2 55 36 87 94 35 4 53 45 100 41 103 7
15 17 28 67 97 64 24 25 16 26 43 73 27 34 31 85 30 82 69 9 68 62 54 44 51 32
— place your bets —
P1: place bet (max=100) >>> 10
P2: place bet (max=100) >>> 8
P3: place bet (max=100) >>> 6
— everyone gets 2 cards —
P1: gets a card -> C:A (C:A -> 11)
P2: gets a card -> S:A (S:A -> 11)
P3: gets a card -> C:7 (C:7 -> 7)
Dealer: gets a card -> C:6 (C:6 -> 6)
P1: gets a card -> D:6 (C:A, D:6 -> 17)
P2: gets a card -> C:10 (S:A, C:10 -> 21)
P3: gets a card -> S:2 (C:7, S:2 -> 9)
Dealer: gets a card -> X:xx (C:6, hidden)
— winning outright by blackjack —
P2: wins 8 with Blackjack (S:A, C:10)
— hit or stand for players —
P1:(C:A, D:6 -> 17) hit or stand? >>> s
P3:(C:7, S:2 -> 9) hit or stand? >>> h
P3:(C:7, S:2, D:5 -> 14) hit or stand? >>> hit
— resolve the game with the remaining players —
Dealer now has cards (C:6, S:10 -> 16)
Dealer: gets a card -> C:10 (C:6, S:10, C:10 -> 26)
P1: wins 10 with (C:A, D:6)
P3: wins 6 with (C:7, S:2, D:5, H:7)
— display remaining funds —
P1 ($): 110
P2 ($): 108
P3 ($): 106
Dealer ($): -24
*** another game? n
C:JAVA>
Auto-running 20 games: just click the switch icon on the left.C:JAVA>java BlackJackCards /d:8 /p:3 /a:20
Usage: java BlackJackCards [/p:#] [/d:#] [/a:#] [/s]
/p: number of players (default 1)
/d: number of decks of cards (default 1)
/a: number of automatic game runs (default 0)
/s show the randomised full decks of cards (default none)
====== auto game 1 ========
— everyone gets 2 cards —
P1: gets a card -> S:2 (S:2 -> 2)
P2: gets a card -> C:J (C:J -> 10)
P3: gets a card -> C:A (C:A -> 11)
Dealer: gets a card -> S:4 (S:4 -> 4)
P1: gets a card -> C:2 (S:2, C:2 -> 4)
P2: gets a card -> H:3 (C:J, H:3 -> 13)
P3: gets a card -> D:6 (C:A, D:6 -> 17)
Dealer: gets a card -> X:xx (S:4, hidden)
— hit or stand for players —
P1:(S:2, C:2 -> 4) hit or stand? >>> hit
P1:(S:2, C:2, C:7 -> 11) hit or stand? >>> hit
P1:(S:2, C:2, C:7, S:6 -> 17) hit or stand? >>> stand
P2:(C:J, H:3 -> 13) hit or stand? >>> hit
P2:(C:J, H:3, C:A -> 14) hit or stand? >>> hit
P2:(C:J, H:3, C:A, H:A -> 15) hit or stand? >>> hit
P2: lost 10 with (C:J, H:3, C:A, H:A, S:7)
P3:(C:A, D:6 -> 17) hit or stand? >>> stand
— resolve the game with the remaining players —
Dealer now has cards (S:4, D:J -> 14)
Dealer: gets a card -> C:6 (S:4, D:J, C:6 -> 20)
P1: lost 10 with (S:2, C:2, C:7, S:6)
P3: lost 10 with (C:A, D:6)
— display remaining funds —
P1 ($): 90
P2 ($): 90
P3 ($): 90
Dealer ($): 30
====== auto game 2 ========
— everyone gets 2 cards —
P1: gets a card -> C:A (C:A -> 11)
P2: gets a card -> D:J (D:J -> 10)
P3: gets a card -> H:6 (H:6 -> 6)
Dealer: gets a card -> C:5 (C:5 -> 5)
… content here skipped …
— display remaining funds —
P1 ($): 120
P2 ($): 0
P3 ($): 130
Dealer ($): 50
====== auto game 20 ========
— everyone gets 2 cards —
P1: gets a card -> D:3 (D:3 -> 3)
P3: gets a card -> C:4 (C:4 -> 4)
Dealer: gets a card -> D:Q (D:Q -> 10)
P1: gets a card -> D:Q (D:3, D:Q -> 13)
P3: gets a card -> H:3 (C:4, H:3 -> 7)
Dealer: gets a card -> X:xx (D:Q, hidden)
— hit or stand for players —
P1:(D:3, D:Q -> 13) hit or stand? >>> hit
P1:(D:3, D:Q, C:2 -> 15) hit or stand? >>> hit
P1: lost 10 with (D:3, D:Q, C:2, D:9)
P3:(C:4, H:3 -> 7) hit or stand? >>> hit
P3:(C:4, H:3, S:6 -> 13) hit or stand? >>> hit
P3:(C:4, H:3, S:6, C:7 -> 20) hit or stand? >>> stand
— resolve the game with the remaining players —
Dealer now has cards (D:Q, S:K -> 20)
P3: draws with the dealer.
— display remaining funds —
P1 ($): 110
P2 ($): 0
P3 ($): 130
Dealer ($): 60
C:JAVA>
Requirements: Blackjack program