Skip to main content

VirtualLanes: Ten-Pin Bowling Simulation

VirtualLanes is an extensive simulation toolkit designed for modeling ten-pin bowling games. It offers a comprehensive suite of classes that simulate games, tournaments, leagues, and more, providing a realistic and detailed representation of bowling dynamics. The project also includes a scoring system compatible with various bowling rules, a database for persisting game results, and multiple interfaces (CLI, TUI, Web) for interacting with the library.

Features

  • Simulation Classes: Simulate bowling games frame by frame or as complete games using different probabilities for strikes, spares, and opens.
  • Scoring Systems: Includes traditional, current frame, and 9-pin no-tap scoring systems.
  • Bowling Database: A SQLite database integration for storing and managing bowling games, bowlers, alleys, and tournaments.
  • League and Tournament Support: Organize and run bowling tournaments and leagues with multiple games and multiple bowlers, customizable for different team sizes and frequencies.
  • Multiple Interfaces:
    • Command Line Interface (CLI): Using Typer for a rich command-line experience
    • Terminal User Interface (TUI): Using Textual for an interactive terminal application
    • Web Interface: Using FastHTML for a modern, responsive web application
  • Documentation: Auto-generated API documentation using MkDocs for easy reference and usage.

Installation

Using pip

pip install virtual-lanes

From source

Clone the repository and install using pip or uv:

git clone https://github.com/michael-borck/virtual-lanes.git
cd virtual-lanes

# Using pip
pip install -e .

# Or using uv (recommended)
uv pip install -e .

Usage

As a Python Library

from virtual_lanes import Bowler, Game, Scoring

# Create a bowler
player = Bowler("John Doe", 180)

# Create a game
game = Game(player)
game.roll(10)  # Strike
game.roll(5)   # 5 pins
game.roll(5)   # Spare

# Get the score
score = Scoring.calculate_score(game)
print(f"{player.name}'s score: {score}")

Command Line Interface (CLI)

VirtualLanes provides a command-line interface with various subcommands:

# Show CLI help
virtual-lanes --help

# Manage bowlers
virtual-lanes bowlers list
virtual-lanes bowlers add "John Doe" 180

# Manage games
virtual-lanes games list
virtual-lanes games add "John Doe" 210

# Start the Terminal UI
virtual-lanes tui start

# Start the Web Interface
virtual-lanes web start

Terminal User Interface (TUI)

Start the interactive terminal interface:

virtual-lanes tui start

Or from Python:

import virtual_lanes
virtual_lanes.run_tui()

Web Interface

Start the web server:

virtual-lanes web start --host 0.0.0.0 --port 8080

Or from Python:

import virtual_lanes
virtual_lanes.run_web(host="0.0.0.0", port=8080, debug=True)

Then open your browser at http://localhost:8080.

Documentation

Generate and view the documentation locally:

# Install development dependencies
uv pip install "virtual-lanes[dev]"
# or using pip
pip install "virtual-lanes[dev]"

# Serve the documentation
mkdocs serve

Development Setup

For a quick development setup with uv, run:

./setup_uv.sh

This will:

  1. Install uv if needed
  2. Create a virtual environment
  3. Install all dependencies
  4. Show usage instructions

Testing, Linting and Type Checking

Run tests using pytest:

pytest

Run linting with ruff:

ruff check src tests

Run type checking with mypy:

mypy src tests

Contributing

Contributions are welcome! Please read the contributing guide for directions on how to submit pull requests to the project.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for virtual-lanes 0.2.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for virtual-lanes 0.2.3
File Size Uploaded
virtual_lanes-0.2.3.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for virtual-lanes 0.2.3
File Interpreter ABI Platform
virtual_lanes-0.2.3-py3-none-any.whl Python 3 none any Details

Total release size: 36.3 kB

Release files / virtual_lanes-0.2.3.tar.gz

Download URL virtual_lanes-0.2.3.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e4185ba45e275443e45f18fb2109dd7fe079cc60700cdc96bd2d83d6c1145f79
BLAKE2b-256 checksum
How to use checksums
c36457476cf3a8df595e568effc5912ac38886a451481ee2e6b82110ce433a53
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release files / virtual_lanes-0.2.3-py3-none-any.whl

Download URL virtual_lanes-0.2.3-py3-none-any.whl
Size 17.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
45a74b0e88341d2c030d646038c8f8cfdc69875a0a6a8a91adce730ad04e9025
BLAKE2b-256 checksum
How to use checksums
756e3c4b400adc4cd14d0932c402ef86e0e6f9c0300fb40092a97e873df33d4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.10.12

Release history Release notifications | RSS feed

This release

0.2.3 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page