A multi-threaded Java application that simulates different betting strategies in a French roulette casino game.
This project simulates a casino environment where multiple players (threads) compete against the house using different betting strategies on a French roulette wheel. The simulation demonstrates concurrent programming concepts including thread synchronization, shared resource management, and race condition prevention.
- French Roulette: 37 numbers (0-36) with draws every 3000 milliseconds
- Multiple Betting Strategies:
- Direct number betting (4 players)
- Even/Odd betting (4 players)
- Martingale strategy (4 players)
- Realistic Casino Rules:
- Initial player balance: 1000€
- Initial house balance: 50000€
- House never pays more than available balance
- Zero (0) results in house taking all bets
- Players select random numbers from 1-36 (not 0)
- Bet amount: 10€
- Payout: 360€ (36x bet) on win
- Players randomly choose even or odd
- Bet amount: 10€
- Payout: 20€ (2x bet) on win
- Players select a random number
- Initial bet: 10€
- Payout on win: 360€
- On loss: double previous bet (10€ → 20€ → 40€ → 80€...)
- On win: reset to 10€ bet
- When 0 is drawn, all players lose and the house collects all bets
- The house accepts all bets but only pays winnings up to its available balance
- New number drawn every 3 seconds
- Java Version: Java 8 or higher
- IDE: IntelliJ IDEA, Eclipse, or NetBeans (optional)
- Build Tool: Not required (can be compiled with javac)
# Compile
javac src/*.java
# Run
java -cp src Main- Open the project in your preferred Java IDE
- Locate the
Main.javafile in thesrcfolder - Run the
Mainclass
Casino/
├── src/
│ └── Main.java
├── docs/ # Excluded from git
├── .gitignore
├── .idea/ # IntelliJ IDEA config
├── Casino.iml
└── README.md
- Multi-threading: Multiple concurrent players (threads)
- Thread Synchronization: Coordinating players with the croupier
- Shared Resources: Managing house balance across threads
- Race Condition Prevention: Using synchronized blocks and methods
- Thread Communication:
wait(),notify(), andnotifyAll()
- Basic simulation structure
- Roulette/Croupier implementation
- Direct number betting players
- Even/Odd betting players
- Martingale strategy players
- Thread synchronization
- Balance management
- Console output formatting
- JavaDoc documentation
- UML class diagram
This is an educational project. Feel free to use it for learning purposes.
