How isaacbilsel/curling-cs6511 works
1. Repository purpose
- This is a Python package for a simulated curling environment.
- The core runtime is a physics simulation of curling stones, not a web or service application.
2. Primary package boundary
- All runtime code lives under src/.
- The package exposes a small public surface centered on Curling, SimulationConstants, StoneColor, and StoneThrow as shown in the README.
- src/__init__.py likely acts as the top-level export layer for these user-facing types.
3. Main simulation subsystem
- src/curling.py appears to be the orchestration layer for a curling end/game.
- It likely owns game state, turn order, resetting, throwing stones, and scoring/evaluation.
- This is the main entry point that external code interacts with.
4. Stone-level physics subsystem
- src/stone.pyx is a Cython module, which strongly suggests the low-level stone motion and collision/curving physics are performance-sensitive.
- This module is the computational core where the simulation likely steps stone trajectories and resolves interactions.
- The use of Cython is an important architectural boundary: higher-level Python code delegates the expensive physics to compiled extension logic.
5. Domain model and data contracts
- src/enums.py contains domain enums such as stone color and likely other simulation states.
- src/constants.py holds the tunable simulation parameters, exposed as SimulationConstants in the README.
- StoneThrow is documented in docs/api/stone_throw.md, indicating a structured input object for each throw with velocity, angle, spin, and color.
6. Utility layer
- src/utils.py provides supporting functions used by the simulation and/or display logic.
- This likely contains geometry, numeric helpers, or conversion functions that keep the core modules focused.
7. Data flow through the system
- A caller creates a Curling instance, optionally resets it, then repeatedly submits StoneThrow inputs.
- Each throw is processed using a chosen SimulationConstants configuration.
- The simulation updates stone positions and game state, then exposes results through methods like evaluate_position() and state properties such as next_stone_color.
8. Display/visualization boundary
- The README shows display=True during throw(), implying the simulator can render or visualize the environment.
- This is an optional presentation layer attached to the physics/game loop, not the core model.
- The rendered environment image in docs/images/ suggests visualization is part of the package documentation and possibly debugging/inspection.
9. Testing strategy
- tests/test_physics.py validates the physical simulation behavior.
- tests/test_gameplay.py covers game rules and flow.
- tests/test_display.py covers the rendering/display path.
- This separation mirrors the architecture: physics, rules, and visualization are distinct concerns.
10. Documentation and API surface
- docs/api/ contains per-module API docs for curling, enums, and stone_throw.
- mkdocs.yml and .readthedocs.yml show the project publishes documentation via MkDocs/ReadTheDocs.
- The README is usage-oriented and documents the intended public API rather than internals.
11. Packaging and build structure
- pyproject.toml, setup.py, and pytest.ini indicate a standard Python package with test tooling.
- The presence of src/stone.pyx means the build process must compile a Cython extension as part of installation.
12. External dependencies and integration
- The project is self-contained as a simulator; its only clearly stated external consumer is betacurl, which uses this package.
- The physics model references a curling-specific research paper, which is a domain dependency rather than a software dependency.
13. How to diagram it
- Model the system as: client code → Curling orchestration → stone physics engine → updated game state/evaluation, with an optional display/rendering branch.
- Surround that with supporting modules for constants, enums, and utility functions, and show tests and docs/build tooling as adjacent, non-runtime parts of the repository.
Main entry points: curling.py Curling · __init__.py Package API · stone.pyx Stone Physics · stone_throw.md StoneThrow
Components 19
Runtime
Public package and simulation engine
- Package API · Top-level package exports for the public surface
src/__init__.py - Curling · Main game and end simulation controller
src/curling.py - Stone Physics · Low-level motion and collision simulation core
src/stone.pyx - Constants · Tunable simulation parameters
src/constants.py - Enums · Domain enums such as stone color and state
src/enums.py - Utilities · Shared numeric and geometry helpers
src/utils.py - StoneThrow · Structured throw input with velocity, angle, spin, and color
docs/api/stone_throw.md - Game State · Turn order, stone positions, and scoring state
- Display · Optional visualization path attached to throws
- Position Eval · State evaluation and scoring results
Docs
API docs and rendered examples
Tests
Behavioral and display validation
- Physics Tests · Validates simulation behavior
tests/test_physics.py - Gameplay Tests · Validates game rules and flow
tests/test_gameplay.py - Display Tests · Validates rendering and visualization
tests/test_display.py
Connections 26
- Package API → Curling: exports · Re-exports the main simulation entry point
- Package API → Constants: exports · Exposes simulation constants
- Package API → Enums: exports · Exposes domain enums
- Package API → StoneThrow: exports · Exposes the throw input contract
- Curling → Stone Physics: delegates · Hands off motion and collisions to the physics engine
- Curling → Constants: uses · Runs with a chosen constants configuration
- Curling → Enums: uses · Uses stone colors and related domain values
- Curling → StoneThrow: accepts · Consumes structured throw inputs
- Curling → Game State: owns · Maintains game and end state
- Curling → Position Eval: computes · Evaluates stone positions and scoring
- Curling → Display: optionally renders · Can attach a display path during throws
- Stone Physics → Utilities: uses · Relies on shared helpers for math and geometry
- Game State → Position Eval: feeds · State is the basis for scoring and evaluation
- Display → Stone Physics: visualizes · Renders the simulated stone motion
- Physics Tests → Stone Physics: verifies · Checks low-level physics behavior
- Gameplay Tests → Curling: verifies · Checks game rules and flow
- Display Tests → Display: verifies · Checks the rendering path
- API Docs → Curling: documents · Documents the main runtime entry point
- API Docs → StoneThrow: documents · Documents the throw input contract
- Enums Doc → Enums: documents · Documents the domain enums
- Throw Doc → StoneThrow: documents · Detailed reference for throw inputs
- README → Package API: shows · Explains the package-level public API
- Packaging → Stone Physics: builds · Compiles the Cython extension during installation
- CI → Physics Tests: runs · Executes test suite in automation
- CI → Gameplay Tests: runs · Executes test suite in automation
- CI → Display Tests: runs · Executes test suite in automation