Skip to main content

A professional-grade, colorful CLI Yahtzee game for 1-4 players

Project description

yahtzee-li (yaht-CLI)

PyPI version Python 3.12+ License: MIT Actions status

A professional-grade, colorful CLI Yahtzee game for 1–4 players, built in Python with rich.

Features

  • Full Yahtzee rule set: upper-section bonus (35 pts at ≥63), Yahtzee bonus (+100 per extra Yahtzee), and the official joker rule
  • Vivid terminal UI: ASCII-art dice panels, live multi-player scorecards, and a victory screen
  • 1–4 human players per game
  • "Play again" prompt after each game — keep the same players or start fresh

Requirements

  • Python 3.12+
  • uv (recommended) or any virtual-environment manager

Installation

From PyPI

pip install yahtzee-li

Or with uv:

uv tool install yahtzee-li

From source (development)

git clone https://github.com/carlmatt/yahtzee-li.git
cd yahtzee-li
uv sync

Running the game

# With uv / the project virtual environment
uv run yahtzee-li

# Or activate the venv first
source venv/bin/activate
yahtzee-li

Development

# Install dev dependencies
make install

# Run the game
make run

# Run the full test suite (unit + integration)
make test

# Run only one tier
make test-unit
make test-integration

# Run tests with coverage report
make test-cov

# Lint and format (combined)
make fix

# Lint only
make lint

# Format only
make format

# Type check (Astral's ty)
make typecheck

# Lint + typecheck + test
make check

# Remove cache and build artifacts
make clean

Tests

Tests are organised into two folders:

  • tests/unit/ — fast unit tests that mock collaborators and cover individual modules.
  • tests/integration/ — end-to-end tests that drive a real Game through full flows using a scripted Display double and a deterministic dice RNG. Tests in this folder are auto-marked with @pytest.mark.integration, so you can also run them via pytest -m integration.

Pre-commit hooks

This project uses pre-commit to enforce code quality on every commit. The hooks run ruff (lint) and ruff-format automatically.

# Install the git hooks (once, after cloning)
pre-commit install

# Run all hooks manually against every file
pre-commit run --all-files

How to Play

  1. Enter the number of players (1–4) and each player's name.
  2. On each turn, all five dice are rolled automatically.
  3. After each roll you may hold any dice by entering their numbers (e.g. 1,3,5), press Enter to hold none, or enter d to skip straight to scoring.
  4. After up to three rolls, choose a scoring category from the numbered list.
  5. The game runs for 13 rounds; the player with the highest grand total wins.
  6. Press Ctrl-C at any time to quit.

Scoring Reference

Category Score
Ones – Sixes Sum of matching dice
Three of a Kind Sum of all dice (if ≥3 match)
Four of a Kind Sum of all dice (if ≥4 match)
Full House 25 pts
Small Straight 30 pts
Large Straight 40 pts
Yahtzee 50 pts
Chance Sum of all dice
Upper Bonus +35 if upper subtotal ≥ 63
Yahtzee Bonus +100 per extra Yahtzee

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yahtzee_li-0.6.3.tar.gz (58.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yahtzee_li-0.6.3-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file yahtzee_li-0.6.3.tar.gz.

File metadata

  • Download URL: yahtzee_li-0.6.3.tar.gz
  • Upload date:
  • Size: 58.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yahtzee_li-0.6.3.tar.gz
Algorithm Hash digest
SHA256 f60e20f73003684c3a987a26bdb25d1e0fc968eaa2b942fe1e587d0d3f2770a9
MD5 9146dbabf6103f6b647cd134e62dc7e7
BLAKE2b-256 f47f3e250fe3f79351c967eb449052fdaf21a0d904c11660e2a48c61faf042d7

See more details on using hashes here.

Provenance

The following attestation bundles were made for yahtzee_li-0.6.3.tar.gz:

Publisher: publish.yml on carlmatt/yahtzee-li

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file yahtzee_li-0.6.3-py3-none-any.whl.

File metadata

  • Download URL: yahtzee_li-0.6.3-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for yahtzee_li-0.6.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1d957a8988b30ee131f4099b90b218c18169b36d973b10c09305f7354ff1846c
MD5 35e6776e0b4d54ba9d43d3a0628a71a0
BLAKE2b-256 45735d7e2e4e6f1759a1319c92d1527f4585a2e288e4bf996fdb245ede7e0a15

See more details on using hashes here.

Provenance

The following attestation bundles were made for yahtzee_li-0.6.3-py3-none-any.whl:

Publisher: publish.yml on carlmatt/yahtzee-li

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page