This project is a command‑line implementation of the classic UNO card game, written in Python.
I developed it during high school as one of my first programming projects, focusing on game rules, turn management, and basic decision‑making for a computer opponent.
Although simple, the game includes a complete playable match system, card validation, and a functional bot that follows the official UNO rules.
The game runs entirely in the terminal and supports a match between:
- Human player
- Bot player
Gameplay features:
- Full UNO rules (colors, numbers, special cards)
- Turn‑based system
- Card drawing when no valid move is available
- Automatic win detection when a player reaches zero cards
- Bot decision logic based on rule‑based evaluation
The bot does not use reinforcement learning or advanced AI techniques.
Instead, it follows a deterministic rule‑based strategy:
The bot scans its hand from the first card to the last and plays the first valid card according to UNO rules.
If no valid card is found, it draws a card.
A card is considered playable if:
- It matches the color of the current table color
- It matches the number of the field card
- It is a special card (which the bot treats as always playable)
This means the bot has no priority system for special cards like +2, +4, Skip, or Reverse.
It simply plays the first legal card it finds.
When playing a Wild or +4 card, the bot:
- Counts how many cards it has of each color
- Chooses the color it has the most cards of
- If there is a tie, it picks a random color
This simple heuristic makes the bot predictable but functional.
- Python 3
- Standard library only (no external dependencies)
- Clone the repository:
git clone https://github.com/mattiadane/UNO
- Run the game:
python3 main.py
The game starts directly in the terminal.
Developed by Mattia Danese
One of my first programming projects created during high school.