Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Rolling Dice Game

Description

A fun and interactive dice rolling simulator with ASCII art visualization. Roll multiple dice, track statistics, and enjoy special events like doubles and matching numbers!

Features

  • Roll 1-10 dice at once
  • Beautiful ASCII art dice display
  • Multiple dice side-by-side view
  • Statistics tracking
  • High score system
  • Special events (doubles, all matching)
  • Rolling animation
  • Pure Python implementation

Stack

  • Language: Pure Python
  • Libraries: random (standard library)
  • Complexity: Beginner

Installation & Usage

No external dependencies required!

python main.py

How to Play

  1. Choose number of dice (1-10)
  2. Watch the rolling animation
  3. View beautiful ASCII dice
  4. Check your total score
  5. Track statistics
  6. Try to beat your high score!

Features Explained

ASCII Art Dice

Each die (1-6) is displayed as beautiful ASCII art:

┌─────────┐
│    ●    │
│         │
│         │
└─────────┘

Multiple Dice Display

Roll multiple dice and see them side-by-side!

Special Events

  • Doubles: Both dice show same number
  • All Match: All dice show same number
  • New High Score: Beat your previous best

Statistics

  • Total rolls made
  • All-time high sum
  • Persistent during session

Use Cases

  • Gaming: Dice for board games
  • Learning: Random number generation
  • Fun: Pass time with friends
  • Probability: Study dice probabilities
  • Decision Making: Random choices

Learning Outcomes

  • Random number generation
  • ASCII art creation
  • User input handling
  • Data structures (lists)
  • String formatting
  • Control flow
  • Function design

Code Structure

# Main functions
roll_dice(num_dice)          # Generate random rolls
display_dice(number)          # ASCII art for single die
display_multiple_dice(results) # Show multiple dice
main()                        # Game loop

Customization

Change Dice Range

roll = random.randint(1, 6)  # Change to 1, 20 for D20

Add More Dice Faces

dice_art[7] = [...]  # Add 7-sided die
dice_art[8] = [...]  # Add 8-sided die

Custom Colors

Use ANSI color codes for colorful dice!

Game Modes

Standard Mode

Roll 1-3 dice with quick select

Custom Mode

Choose any number of dice (1-10)

Statistics Mode

View your rolling performance

Tips

  • Roll 2 dice for classic board game feel
  • Try to roll all 6s with multiple dice
  • Track your statistics over time
  • Challenge friends for high scores

Future Enhancements

  • Weighted dice
  • Different dice types (D4, D8, D10, D12, D20)
  • Save statistics to file
  • Multiplayer mode
  • Probability calculator
  • Dice rolling history
  • Custom dice faces
  • Sound effects
  • Color themes
  • GUI version

Dice Probability

Single Die

  • Each number (1-6): 16.67% chance

Two Dice

  • Sum of 7: Most common (16.67%)
  • Sum of 2 or 12: Least common (2.78%)
  • Doubles: 16.67% chance

Three Dice

  • Sum of 10-11: Most common
  • Sum of 3 or 18: Least common

Real-World Applications

  • Board Games: Monopoly, Ludo, Snakes & Ladders
  • RPGs: Dungeons & Dragons, Pathfinder
  • Gambling: Craps, Sic Bo
  • Education: Probability lessons
  • Random Selection: Making choices

License

Open source for educational purposes.