This is a blackjack code in Python.
It was created according to the rules shown in the following article.
https://qiita.com/hirossyi73/items/cf8648c31898216312e5
- Initial cards are 52. No jokers. No duplicate cards when drawing.
- Two player game, player and dealer. Player is executor, dealer executes automatically.
- At the start of the run, the player and the dealer each draw two cards. The cards drawn are displayed on the screen. However, the dealer's second card is not shown.
- Then the player draws a card first. If the player is over 21, the player bursts, the player loses, and the game ends at that point.
- Each time a player draws a card, he/she can choose to draw the next card
- When the player finishes drawing, the dealer then continues drawing until his or her hand is 17 or more
- When the player and the dealer finish drawing, the game is over. The player who draws closer to 21 wins.
- J, Q, and K are treated as tens.
- A is treated only as a "1" for now. No "11".
- No double-downs, no splits, no surrender, no other special rules
This code is based on the "war" game from "The Self-Taught Programmer" by Cory Althoff.
You are free to use it. You are free to play and modify it.
I am currently studying programming. Please let me know what I can improve.