A Console-Based UNO Card Game Implementation in Python
Play against the computer in this exciting implementation of the classic UNO card game with a beautiful rich terminal UI.
This is a console-based implementation of the classic UNO card game developed in Python. Challenge yourself against an intelligent computer opponent in a beautifully formatted terminal interface powered by the Rich library. The game provides an interactive experience with real-time card management, game state tracking, and detailed end-game summaries.
Current Version: 1-on-1 gameplay (You vs Computer)
Future Roadmap: Multiplayer support, AI vs AI mode, and Online capabilities
✅ Player vs Computer Gameplay - Test your skills against an AI opponent
✅ Rich Terminal UI - Beautiful, colorful console interface with Rich library
✅ Card Management - Intuitive card selection and hand management
✅ Power Cards - Draw Two, Skip, Reverse, Wild, and Wild Draw Four
✅ Smart Computer AI - Computer makes strategic card plays
✅ Game Summary - Detailed end-game statistics and winner announcement
✅ Real-time Feedback - Instant notifications for game events (UNO!, card plays, etc.)
✅ Standard UNO Rules - Fully compliant with official UNO game rules
- Starting Hand: Each player receives 7 cards
- Deck: Standard UNO deck of 108 cards in 4 colors (Red, Yellow, Green, Blue)
- Objective: Be the first to get rid of all your cards
- Available in all 4 colors
- Must match either the color or number of the previous card
- Skip 🚫 - Next player loses their turn
- Reverse ↩️ - Changes direction (acts as Skip in 2-player mode)
- Draw Two 📥 - Next player draws 2 cards and loses their turn
- Wild 🌈 - Can be played anytime; choose any color to continue with
- Wild Draw Four 🎪 - Can be played only when no other card matches; opponent draws 4 cards and loses turn
- "UNO!" is announced when a player has only 1 card left
- First player to empty their hand wins the game
- Game ends with a detailed summary showing rounds played and final statistics
| Technology | Purpose |
|---|---|
| Python 3.7+ | Core game logic and implementation |
| Rich | Beautiful console UI with colors and formatting |
| NumPy | Optional numerical operations |
| Random | Card shuffling and AI decision-making |
pip install richUNO/
├── app.py # Main application entry point
├── logic_rich.py # Enhanced game logic with Rich UI
├── deck.py # UNO deck generation and management
├── UNO_rules.py # Game rules and card validation
├── card_showing_logic.py # Card display and formatting
├── summary.py # Game summary and statistics
├── requirenment.txt # Project dependencies
└── README.md # This file
- Purpose: Game UNO
- Usage: Run this file to start playing
- Contains: Player turns, computer AI, game flow control
- Features: Beautiful console output, real-time status updates
- Purpose: Core game logic implementation
- Contains: Game mechanics, turn management, hand tracking
- Features: Rule checking, card validation, turn cycling
- Purpose: UNO deck generation and management
- Contains: Standard deck creation (108 cards)
- Features: Card shuffling, deck initialization, custom deck sizes (optional 112-card variant)
- Purpose: Game rules enforcement
- Contains: Card validation rules and power card effects
- Features:
check_rules_for_cards()- Validates if a card play is legalapply_power_card()- Handles special card effects
- Purpose: Card display and formatting
- Contains: Console output formatting for cards
- Features: Visual card representation, hand display
- Purpose: Game summary and statistics
- Contains: End-game results and player statistics
- Features: Winner announcement, game duration, round count
- Python 3.7 or higher
- pip (Python package manager)
- Clone the Repository
git clone https://github.com/mayank-gariya/crazy-python-projects-.git
cd crazy-python-projects-/UNO- Install Dependencies
pip install -r requirenment.txtOr install Rich directly:
pip install rich- Run the Game
python app.py- Run
python app.py - The game initializes with both players receiving 7 cards
- First card from the deck is placed as the initial discard pile card
- View Your Cards: Enter
showto display all your cards with numbers - Play a Card: Enter the card number corresponding to your card
- Valid cards must match the color OR number OR be a Wild card
- Draw a Card: If you can't play, select "N" to draw a card
- UNO: When you have 1 card left, "UNO!" is automatically announced
- The computer automatically plays valid cards from its hand
- Draws a card if no valid play is available
- Strategic decision-making for card selection
- The game ends when either player empties their hand
- Winner Announcement with detailed summary
- Game statistics including:
- Total rounds played
- Cards remaining for each player
- Game duration
- Support for 2-10 players
- Network-based multiplayer
- Local multiplayer (hot-seat mode)
- All Robots Mode - Watch AI players compete autonomously
- Difficulty Levels - Easy, Medium, Hard computer opponents
- Improved AI Strategy - Smarter card selection and blocking tactics
- WebSocket Implementation - Real-time multiplayer over internet
- Server Architecture - Central game server for matchmaking
- Player Authentication - User accounts and rankings
- Web Interface - Browser-based gameplay
- Mobile Support - Cross-platform compatibility
- Game replay functionality
- Leaderboards and statistics tracking
- Custom rule sets
- Game history and replays
- Sound effects and animations
After each game, you'll receive a detailed summary including:
- Winner: Who won the game
- Rounds Played: Total number of complete rounds
- Game Duration: Time taken to complete the game
- Cards Played: Total cards used in the game
- Final Status: Remaining cards in each player's hand
This project is licensed under the MIT License - see the LICENSE file for details.
- 💰 Strategic Plays: Save your Wild cards for critical moments
- 🎯 Memory: Keep track of cards played to predict what's in the deck
- ⚡ Speed: In competitive mode, think fast and play faster
- 🛡️ Defense: Use Skip and Reverse cards to block opponents
Developer: Mayank Gariya
GitHub: mayank-gariya
Repository: crazy-python-projects-