How to organize classes for blackjack game
in
Programming Questions
•
10 months ago
Hi,
I have to write blackjack game for college using processing language. It has to be done in a strict object oriented approach. So i can`t make an object of a class in another class unless there is some connection.
We have to use a Player interface
- interface Player {
- // This is the interface you are expected to implement for both
- // the computer controlled 'dealer' and the human player(s)
- // You can change the return types for any of the items in the interface.
- // You can also add arguments two the first two method listed below
- void twist(/* you can add an argument here */); // This method should allow the player to add acard to their hand
- void updateValueOfHand(/* you can add an argument here */); // Updates the the value of the cards the player has in their hand
- void stick(); // Called when the player does not want to take another card
- void updateScore(); // Updates the player's overall score (number of games they have won)
- int getValueOfHand(); // Getter method for the value of the cards the player has in their hand
- int getScore(); // Getter method for the player's overall score (number of games they have won)
- void showHand(); // Used to display the player's hand on screen
- void clearHand(); // Used at the end of a round to empty the cards in the player's hand
- }
I have done a storyboard for the game.
So far I have got a
- interface Player
- class Card
- class Deck extends Card
- class Computer implements Player
- class Human implements Player
I am planning to have a class called ScoreTable where i can keep and show the scores and a Button class where i can draw the buttons.
What kind of classes should i have? Can i have a ScoreTable class which implements Player and a stand alone Button class?
Thank you for your help
1