...
/Class Diagram for the Online Blackjack Game
Class Diagram for the Online Blackjack Game
Learn to create a class diagram for the Blackjack game using the bottom-up approach.
We'll cover the following...
We’ll create the class diagram for the Blackjack game. In the class diagram, we will first design the classes, and then identify the relationship between classes according to the requirements for the Blackjack game problem.
Components of Blackjack
In this section, we’ll define the classes for the Blackjack game. As mentioned earlier, we are following the bottom-up approach to designing a class diagram for the Blackjack game.
Card
Card
belongs to a suit and has a face value. The face value of the card is according to the card number. For example, if we have a number card 5, its face value is also 5. The face value for the King, Queen, and Jack is 10, and 1 or 11 for the Ace, depending on the situation.
Deck
Deck
has 52 cards of four suits, and one suit contains nine number cards (2–10) and four face cards (King, Queen, Jack, and Ace). The Deck
class contains a list of cards where the top card is in the first index.
Shoe
Shoe
is a device to hold multiple Deck
, and it has a shuffle operation.
Hand
The Hand
class represents a Blackjack hand used in this game which can contain multiple cards.