Presentation is loading. Please wait.

Presentation is loading. Please wait.

Task 2 Implementation help

Similar presentations


Presentation on theme: "Task 2 Implementation help"— Presentation transcript:

1 Task 2 Implementation help
Blackjack Game

2 Overview You are to write a Blackjack card game in Java utilizing a graphical user interface (Could be using swing or JavaFx). Object of the Game: Counting any ace as 1 or 11, as a player wishes, any face card (King, queen or Jack) as 10, and any other card at its numerical(Pip) value, the user attempts to beat the dealer by getting a count as close to 21 as possible, without going over 21. The game could be expanded to include more players and a betting system.

3 Deck of cards 52 Cards. A "standard" deck of playing cards consists of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs. Each suit contains 13 cards: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King. Each card will have a numerical value in the game. Consider that you will need graphics for each card and the back of the card.

4 Breaking Blackjack down
When creating programs we first need to break the task down into individual elements or objects. Java as an object oriented language allows us to do this. There's not one set way of making this game. The following classes could be created: Card – Getting the current card and returning it’s numbered value. Code could be used to determine if ace or not. Deck – Start here – Create a 52 card deck and shuffle it. Suggest array. Game – Instantiate the other classes into objects so they can be used. GUI and Action listeners implemented here. Player – Hold the current players hand. Objects could be created from this class for both the user and dealer. Your initial focus should be creating a Deck(Consider a nested for loop with 13 cards assigned to each suit) that then gets shuffled along with creating a user interface, with cards and visual elements.

5 Deck Class Suggest methods for:
Creating a deck – Could use Array and nested for loops. 4 suits with 13 cards in each. Reducing the size of deck when a card is dealt Returning the size of the current deck Shuffling the deck

6 Card Class Suggest method for:
Card(Constructor) – Accepts arguments including CardNumber(0-51), CardValue(0-12), CardImage (string which holds the location of the image) CardValue that uses conditionals to get the current cards value(0-13). Ace set to 1. Jack, queen or king set to 10. Check if ace = true (Link to player class)

7 Player Class You could use this class for the user and dealer.
Suggest method for: Checking players hand value (Could include code to check if ace. If overall hand value is above 11 set to 1. Below set to 11)

8 Game Class Suggest method for: Creating the GUI
Player to deal (Starts or resets the game) Player to Hit Player to Stay Check if winner or bust actionPerformed to enable button functionality, link to methods and update GUI info to user


Download ppt "Task 2 Implementation help"

Similar presentations


Ads by Google