A robust Python implementation of the classic Uno card game, featuring a flexible game engine, command-line interface, and AI opponents.
- Flexible Engine: Designed to support custom rules and extensions.
- Command-Line Interface (CLI): Playable terminal-based game against bots.
- AI Opponents: Includes
RandomPlayerbots to play against. - Type Safe: Built with modern Python type hinting for reliability.
- Tested: Comprehensive test suite using
pytest.
Requires Python 3.11 or higher.
-
Clone the repository:
git clone https://github.com/Dorapower/Uno-Game.git cd Uno-Game -
Create and activate a virtual environment:
python -m venv .venv # Windows .venv\Scripts\activate # Linux/Mac source .venv/bin/activate
-
Install dependencies:
pip install -e . pip install pytest
To start a game against bots via the CLI:
python src/cli.pyFollow the on-screen prompts to choose the number of players and make your moves.
The project uses pytest for testing. To run the test suite:
pytestsrc/uno/engine: Core game logic (Game, Player, Context).src/uno/rules: Rule implementations (Standard Uno).src/cli.py: Command-line interface entry point.tests/: Unit tests.
This implementation follows the standard Uno rules (based on the 2008 instruction sheet).
- Setup: 7 cards per player.
- Objective: Be the first to get rid of all your cards.
- Action Cards: Draw 2, Skip, Reverse, Wild, Wild Draw 4.
- Scoring: Winner gets points based on cards left in opponents' hands.