Object oriented implementation of the popular card game, Blackjack, using the Python programming language.
At this point, the point of the project is to create a simple object oriented manifestation of Blackjack using Python. The code (so far) consists of four .py files.
- bj_components.py contains the definitions of classes that define the objects nessecary to play Blackjack i.e. cards, decks, players and dealers.
- In blackjack.py, we define the Blackjack class that piecies the game together using objects of bj_components.py.
- The play_blackjack.py file creates a Blackjack object with a set of user defined parameters and runs the game.
- utils.py contains utilities that did not conceptually fit on any of the other files.
To test the code for yourself tune the parameters on play_blackjack.py at will, open a command prompt, go to the code's directory and simply run
python play_blackjack.py
Some examplary screenshots.
Possible things to do now.
- Add 'split' functionality when Player has two cards of the same value.
- Add insurance when the dealer has a visible Ace at the start.
- Add shortcuts for blackjacks. i.e. the player does not need to play if the dealer gets a blackjack etc.
- Add bots. Maybe explore the statistics of bots with given strategies.
- Add a history log that saves data from played games.
- Add a "slow mode" functionality that uses
time.sleep(delay)
to make terminal output look smoother.