A command line dice betting game written in C with advanced game mechanics, win streak bonuses and session statistics.
The player bets on a number between 1 and 6. A dice is rolled randomly, and rewards depend on accuracy, streak and proximity to the correct number.
- Random dice rolling (1–6)
- Player balance system with starting input
- Minimum bet requirement ($10)
- Win streak system with bonus multipliers
- Near-miss bonus (±1 during streak)
- Maximum balance tracking
- Session summary and statistics
- Input validation
- Smooth CLI experience with dice roll delay
- Choose a number between 1 and 6
- Enter a bet (minimum $10)
- If your number matches the dice:
- Win 3x your bet
- If you have a streak of 2+ wins:
- Win 5x your bet
- If you're close (±1) during a streak:
- Get 1.5x bonus
- Otherwise:
- Lose your bet
- Set your starting balance (max $1000)
- Choose a number (1–6) or 0 to quit
- Enter your bet amount
- Dice rolls with delay
- Game result is calculated
- Balance updates
- Game continues while balance ≥ $10
- C programming language
- Standard C libraries
stdlib.hfor random number generationtime.hfor seeding randomnessunistd.hfor delay simulation
- Structuring larger C programs using functions
- Managing global state (wins, streaks, statistics)
- Implementing reward systems and game mechanics
- Using random number generation with
rand() - Input validation and control flow
- Tracking and displaying session statistics
WELCOME TO DICE GAME!
Set your starting balance: $200
Enter your chosen dice number: 4
Enter your bet amount: $50
Rolling the dice...
Dice rolled: 4
Congratulations! You won $150.00!
Player balance: $350.00
- Total rounds played
- Wins
- Win percentage
- Highest balance reached
- Longest win streak
Software engineering student at ITS