Open Bodacious opened 9 years ago
Hey guys, here's my attempt at analysing the blackjack game in an OOP way:
CARD has suits has values
DECK has cards
PLAYER has a name holds cards method to stick or hit
DEALER holds cards method to stick or hit
BANK has a starting amount method to adjust the account
HAND_HELD has player and dealer cards method to calculate player and dealer hands method to check if hand is bust method to compare hands method to display the cards
BLACKJACK GAME has decks accepts bet input method to deal cards to dealer and player method to remove cards from deck method to replenish deck
GAME_INPUT_VALIDATION method to check if y or n is chosen method to check if player input a number
The game_input_validation wouldn't be a class, would that be a module? I can also see that both the player and dealer can hold cards and should also decide to stick or hit. Would I make the dealer inherit from player seeing as they are both a type of player (the dealer would also need a name in this case). The logic behind the decision to stick or hit is different for a player and a dealer so that behaviour would be overwritten in that case?
I made some changes to the classes and I've finished the game off now - https://github.com/knoxjeffrey/blackjack/blob/master/blackjack_oop.rb
Hey @knoxjeffrey - this is a test issue
Let's ask - @thedreamshake for help