Introduction
py_bounty was my first serious project to get comfortable with Python programming. Initially, the goal was to create a gambling game that allowed players to use digital currency (with no real-world value) and included multiplayer support. However, as the project progressed, I realized that adding multiplayer functionality and ensuring a secure currency system to prevent cheating was outside the scope of this project.
Instead, I focused on building a command line interface (CLI) for a single-player gambling game. The project allowed users to play roulette and, later, I added blackjack to the game.
Implementation Details
I decided to limit the project to the client-side experience, meaning the game operates entirely in the terminal without a server or networked component. This made the project more manageable and allowed me to focus solely on improving my Python skills and logic for creating a fun and interactive game experience.
The entire project was built using Python, no external frameworks were used. This provided me with a good understanding of core Python features, including:
- Handling user input and output in a CLI
- Managing game logic for roulette and blackjack
- Working with loops, conditions, and basic data structures
Features
Roulette Game
A simple roulette game where players can bet on numbers, colors, or odd/even, using digital currency.
Blackjack Game
A basic blackjack game where the user can play against the dealer, including standard features like hitting, standing, and busting.
Known Issues
Ace Card
One of the known limitations is with Ace handling in Blackjack. In blackjack, the Ace can be counted as either 1 or 11, depending on which value is more beneficial for the player. When I initially programmed the blackjack game, I struggled with the logic for this. Specifically, I overcomplicated how to handle multiple Aces (e.g., when a player has two Aces) and therefore decided to postpone it, which became never.
Potential Fix: Looking back, the solution would be to evaluate the player's hand and assign the Ace a value of 11 unless it would cause the player to bust, in which case it should count as 1. This way, the player's hand is always maximized without exceeding 21 and always in favor of the player.
Written: 2024-09-19