Skip to content

kah-ve/blackjack-python-oop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 

Repository files navigation

Python Blackjack game utilizing OOP, typing, ABC (abstract classes), and a completely contrived factory design pattern! This project very basically started from an article I was reading and then I completely took it in another direction to serve the purpose of being a useful tool to practically implement and practice some different types of programming for improvement sake. Also was quite fun.









An example game run (not particularly easy on the eyes or insightful tbh):

Player Intros:
Thanks for me naming me! - NP
I am the Dealer welcome to the table.
Interesting is what interesting does! - IDP
I play and I don't play and yet I never stop. - CP
Is it actually a loss if you never actually win? - PLP


Player: MainCharacterJack - How many chips would you like to bet? 1

Player: InterestingDecisionPlayer - How many chips would you like to bet? 2323
Bet exceeds chips amount. Your total chip amount is 100. Input a valid amount.

Player: InterestingDecisionPlayer - How many chips would you like to bet? 232
Bet exceeds chips amount. Your total chip amount is 100. Input a valid amount.

Player: InterestingDecisionPlayer - How many chips would you like to bet? 23

Player: ConservativePlayer - How many chips would you like to bet? 223
Bet exceeds chips amount. Your total chip amount is 100. Input a valid amount.

Player: ConservativePlayer - How many chips would you like to bet? 23

Player: PerenniallyLosingPlayer - How many chips would you like to bet? 23

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 6 of Clubs.
Current hand value is: 6

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 10 of Diamonds
Current hand value is: 10
Player InterestingDecisionPlayer has received the card suit and rank: 10 of Diamonds.
Current hand value is: 10

ConservativePlayer is standing with hand value at: 0
Player PerenniallyLosingPlayer has received the card suit and rank: 7 of Heart.
Current hand value is: 7

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 10 of Heart.
Current hand value is: 16

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 2 of Clubs
Current hand value is: 12

InterestingDecisionPlayer is standing with hand value at: 10
Player PerenniallyLosingPlayer has received the card suit and rank: 10 of Heart.
Current hand value is: 17

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 9 of Clubs.
Your hand has passed 21 with the value 25. You are bust.
Current hand value is: 25

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 2 of Spades
Current hand value is: 14

PerenniallyLosingPlayer is standing with hand value at: 17

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 4 of Diamonds
Current hand value is: 18

The Dealer has chosen to STAND

Dealer is standing with hand value at: 18
Game has ended!
Blackjack! Game has been won by player(s): Dealer
Would the player(s) like to make any comments on their win?
Total chip scores:

MainCharacterJack: 99
Dealer: 10000
InterestingDecisionPlayer: 77
ConservativePlayer: 77
PerenniallyLosingPlayer: 77


Would you like to continue playing? (1 -> Yes, 2 -> No)1

Player: MainCharacterJack - How many chips would you like to bet? 1

Player: InterestingDecisionPlayer - How many chips would you like to bet? 1

Player: ConservativePlayer - How many chips would you like to bet? 1

Player: PerenniallyLosingPlayer - How many chips would you like to bet? 1

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 9 of Diamonds.
Current hand value is: 9

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 7 of Diamonds
Current hand value is: 7
Player InterestingDecisionPlayer has received the card suit and rank: 4 of Clubs.
Current hand value is: 4

ConservativePlayer is standing with hand value at: 0
Player PerenniallyLosingPlayer has received the card suit and rank: 3 of Clubs.
Current hand value is: 3

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 8 of Heart.
Current hand value is: 17

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 7 of Spades
Current hand value is: 14

InterestingDecisionPlayer is standing with hand value at: 4
Player PerenniallyLosingPlayer has received the card suit and rank: 8 of Spades.
Current hand value is: 11

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 10 of Clubs.
Your hand has passed 21 with the value 27. You are bust.
Current hand value is: 27

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 10 of Spades
Your hand has passed 21 with the value 24. You are bust.
Current hand value is: 24
The Dealer has gone bust!!!

PerenniallyLosingPlayer is standing with hand value at: 11
Game has ended!
Blackjack! Game has been won by player(s): InterestingDecisionPlayer, ConservativePlayer, PerenniallyLosingPlayer
Would the player(s) like to make any comments on their win?
Total chip scores:

MainCharacterJack: 98
Dealer: 10000
InterestingDecisionPlayer: 78
ConservativePlayer: 78
PerenniallyLosingPlayer: 78


Would you like to continue playing? (1 -> Yes, 2 -> No)1

Player: MainCharacterJack - How many chips would you like to bet? 1

Player: InterestingDecisionPlayer - How many chips would you like to bet? 1

Player: ConservativePlayer - How many chips would you like to bet? 1

Player: PerenniallyLosingPlayer - How many chips would you like to bet? 1

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 10 of Diamonds.
Current hand value is: 10

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 7 of Clubs
Current hand value is: 7
Player InterestingDecisionPlayer has received the card suit and rank: 4 of Heart.
Current hand value is: 4

ConservativePlayer is standing with hand value at: 0
Player PerenniallyLosingPlayer has received the card suit and rank: 11 of Clubs.
Current hand value is: 11

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 6 of Heart.
Current hand value is: 16

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 10 of Clubs
Current hand value is: 17

InterestingDecisionPlayer is standing with hand value at: 4

PerenniallyLosingPlayer is standing with hand value at: 11

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 8 of Clubs.
Your hand has passed 21 with the value 24. You are bust.
Current hand value is: 24

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 10 of Diamonds
Your hand has passed 21 with the value 27. You are bust.
Current hand value is: 27
The Dealer has gone bust!!!
Game has ended!
Blackjack! Game has been won by player(s): InterestingDecisionPlayer, ConservativePlayer, PerenniallyLosingPlayer
Would the player(s) like to make any comments on their win?
Total chip scores:

MainCharacterJack: 97
Dealer: 10000
InterestingDecisionPlayer: 79
ConservativePlayer: 79
PerenniallyLosingPlayer: 79


Would you like to continue playing? (1 -> Yes, 2 -> No)1

Player: MainCharacterJack - How many chips would you like to bet? 1

Player: InterestingDecisionPlayer - How many chips would you like to bet? 1

Player: ConservativePlayer - How many chips would you like to bet? 1

Player: PerenniallyLosingPlayer - How many chips would you like to bet? 1

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 3 of Heart.
Current hand value is: 3

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 9 of Heart
Current hand value is: 9
Player InterestingDecisionPlayer has received the card suit and rank: 3 of Spades.
Current hand value is: 3

ConservativePlayer is standing with hand value at: 0
Player PerenniallyLosingPlayer has received the card suit and rank: 2 of Diamonds.
Current hand value is: 2

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 4 of Spades.
Current hand value is: 7

The Dealer has chosen to HIT
The Dealer has drawn the card suit and rank: 10 of Heart
Current hand value is: 19

InterestingDecisionPlayer is standing with hand value at: 3
Player PerenniallyLosingPlayer has received the card suit and rank: 10 of Clubs.
Current hand value is: 12

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 10 of Clubs.
Current hand value is: 17

The Dealer has chosen to STAND

Dealer is standing with hand value at: 19

PerenniallyLosingPlayer is standing with hand value at: 12

Player: MainCharacterJack - Would you like to hit or stand. (1 -> Hit, 2 -> Stand): 1
Player MainCharacterJack has received the card suit and rank: 6 of Spades.
Your hand has passed 21 with the value 23. You are bust.
Current hand value is: 23
Game has ended!
Blackjack! Game has been won by player(s): Dealer
Would the player(s) like to make any comments on their win?
Total chip scores:

MainCharacterJack: 96
Dealer: 10000
InterestingDecisionPlayer: 78
ConservativePlayer: 78
PerenniallyLosingPlayer: 78


Would you like to continue playing? (1 -> Yes, 2 -> No)2
Thank you for playing!

About

Python Blackjack game utilizing OOP

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages