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

# Lint + 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.2.tar.gz (55.8 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.2-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: yahtzee_li-0.6.2.tar.gz
  • Upload date:
  • Size: 55.8 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.2.tar.gz
Algorithm Hash digest
SHA256 d2c479c2d77025ed93c549cfeab82bd4560aa2bc6da4e96ed772ca290699443f
MD5 8bb0a0c93e701c3391df02832a6901e7
BLAKE2b-256 edd93979f4e2e4f4a6e0e2a0b5d9bad7e16b0cc04b09f5b604821b0877e63f92

See more details on using hashes here.

Provenance

The following attestation bundles were made for yahtzee_li-0.6.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: yahtzee_li-0.6.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 aa094b389f6708b052a0b9d630862ef65eb9cac7f450706a99762d48f14a3940
MD5 2e1996f659c248f02770862b5b11c397
BLAKE2b-256 14232193a072c4aabf42f306250666347e588ac57ad973106ebcc211ddcb3e73

See more details on using hashes here.

Provenance

The following attestation bundles were made for yahtzee_li-0.6.2-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