Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UNO – Command Line Game (Python)

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.


🎮 Game Overview

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

🤖 Bot Logic (Rule‑Based, No Reinforcement Learning)

The bot does not use reinforcement learning or advanced AI techniques.
Instead, it follows a deterministic rule‑based strategy:

1. Selecting a Move

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.

2. Card Validation

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.

3. Choosing a Color for Wild Cards

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.


📊 Technologies Used

  • Python 3
  • Standard library only (no external dependencies)

🚀 How to Run

  1. Clone the repository:
    git clone https://github.com/mattiadane/UNO
  2. Run the game:
    python3 main.py

The game starts directly in the terminal.


👤 Author

Developed by Mattia Danese
One of my first programming projects created during high school.

About

UNO game project created by me

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages