domino-game-cli

A CLI application to play caribbean dominoes and learn how to get better so you can beat your friends IRL!

0
0
0
Python
public

๐ŸŽฒ Caribbean Dominoes CLI

CI

A beautiful, interactive CLI application to play Caribbean dominoes and learn how to get better so you can beat your friends IRL!

โœจ Features

  • ๐ŸŽจ Beautiful Interface: Rich, colorful terminal output with panels, tables, and emojis
  • โŒจ๏ธ Arrow Key Navigation: Navigate menus using โ†‘โ†“ arrow keys or Vim-style j/k keys
  • ๐Ÿค– Smart CPU Opponents: Play against intelligent CPU players
  • ๐Ÿ‘ฅ Team-Based Gameplay: 2v2 teams (You + Ally vs 2 Opponents)
  • ๐Ÿ“Š Real-Time Scoring: Track scores and progress throughout the game
  • ๐ŸŽฏ Multiple Game Modes: Standard and quick play modes
  • ๐Ÿ“– Built-in Rules: Access game rules and help anytime

๐Ÿš€ Setup

  1. Clone the repository:
git clone <repository-url>
cd domino-game-cli
  1. Install dependencies:
uv sync

Thatโ€™s it! Use uv run python main.py to start playing (see Usage below).

๐ŸŽฎ Usage

Start a Game

# Play with default settings (first to 200 points)
uv run python main.py play

# Quick mode (first to 100 points)
uv run python main.py play --quick

# Custom target score
uv run python main.py play --target 150

View Commands

# Show all available commands
uv run python main.py --help

# View game rules
uv run python main.py rules

# About the game
uv run python main.py about

๐ŸŽฏ Game Controls

  • โ†‘/โ†“ or j/k: Navigate menu options
  • Enter: Select/Confirm choice
  • Vim-style navigation: Supports j (down) and k (up) for Vim users

๐Ÿ“– Game Rules

Setup

  • 4 players in 2 teams (You + Ally vs 2 Opponents)
  • Each player gets 7 dominoes from a double-six set
  • First round starts with the [6|6] domino

Gameplay

  • Players take turns counter-clockwise
  • Match your domino to either end of the line
  • If you canโ€™t play, you must pass
  • Round ends when someone plays all dominoes or all players pass

Scoring

  • Winner scores the sum of all remaining dominoes in other playersโ€™ hands
  • If game is blocked, player with lowest hand value wins
  • First team to reach target score (default: 200) wins!

๐Ÿ› ๏ธ Technology Stack

  • Python 3.9+: Core language
  • Typer: CLI framework with rich help formatting
  • Rich: Beautiful terminal output with colors and formatting

๐Ÿ“ Project Structure

domino-game-cli/
โ”œโ”€โ”€ domino_game/              # Main package
โ”‚   โ”œโ”€โ”€ models/               # Domain models (Domino, Board, Player)
โ”‚   โ”œโ”€โ”€ game/                 # Game engine & logic (AI, scoring, deck)
โ”‚   โ”œโ”€โ”€ ui/                   # User interface components
โ”‚   โ”‚   โ””โ”€โ”€ renderer/         # Full-screen rendering
โ”‚   โ””โ”€โ”€ cli.py               # CLI commands
โ”œโ”€โ”€ tests/                    # Organized test suite
โ”‚   โ”œโ”€โ”€ test_models/
โ”‚   โ”œโ”€โ”€ test_game/
โ”‚   โ””โ”€โ”€ test_ui/
โ”œโ”€โ”€ main.py                   # Entry point
โ””โ”€โ”€ pyproject.toml           # Project configuration

๐Ÿงช Testing

Install dev dependencies first:

uv sync --extra dev

Run all tests with pytest:

uv run pytest                    # Run all tests
uv run pytest -v                 # Verbose output
uv run pytest -m "not slow"      # Skip slow tests

Run specific tests:

# Test specific directory
uv run pytest tests/test_game/

# Test specific file
uv run pytest tests/test_models/test_domino.py

# Test specific function
uv run pytest tests/test_game/test_ai.py::test_simple_strategy

Run with coverage:

uv run pytest --cov=domino_game --cov-report=term-missing

Continuous Integration runs automatically on:

  • Pull requests to main
  • Pushes to main branch

The CI tests the package on Python 3.9, 3.10, 3.11, and 3.12.

๐Ÿ“ Commands Reference

Command Options Description
play --target/-t, --quick/-q Start a new game
rules - Display game rules
about - About the application

๐ŸŽจ Screenshots

The game features:

  • Colorful domino representations with unique colors for each number
  • Beautiful panels and borders for game states
  • Real-time score tracking in tables
  • Visual feedback for moves and game events
  • Clean, organized layout for easy gameplay

๐Ÿค Contributing

Contributions are welcome! Feel free to submit issues and enhancement requests.

๐Ÿ“œ License

See LICENSE file for details.


Version 2.0 - Enhanced Edition ๐Ÿš€

v0.3.3[beta]