# timhutton/crochet-simulator architecture

> Architecture diagram of the GitHub repository timhutton/crochet-simulator, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/timhutton/crochet-simulator
- Repository: https://github.com/timhutton/crochet-simulator

## Overview

#### Purpose and delivery

This repository is a browser-based crochet-pattern simulator: it predicts and visualizes the 3D form implied by a compact crochet notation. The deployable application is a single static HTML entry point, suitable for GitHub Pages.

- Entry point and complete application container: `index.html`
- Project intent and example pattern URLs: `README.md`

#### Runtime model

The application runs entirely client-side in a web browser. Pattern state is encoded in the URL query/hash-style suffix used by the demo links, enabling shareable simulations without a backend.

- Browser document, UI, parsing, simulation, and rendering are consolidated in `index.html`
- No server-side runtime, build system, package manifest, or separate source directories are present in the supplied tree.

#### Pattern input boundary

Crochet instructions are supplied as compact textual patterns, such as `sc`, parenthesized sequences, and repetition counts. The README demonstrates patterns for cylinders, spiral discs, granny squares, and negatively curved surfaces.

- Input conventions and representative payloads: `README.md`
- Browser-facing pattern ingestion implementation location: `index.html`

#### Simulation pipeline

The core conceptual pipeline is:

1. Read the pattern from the URL/default demo state.
2. Parse stitch and repetition notation into an ordered crochet structure.
3. Convert that structure into geometric/topological constraints.
4. Solve or relax the structure into a predicted 3D shape.
5. Render the resulting form interactively in the browser.

All executable stages are necessarily colocated in `index.html`; there are no separable modules in this repository snapshot.

#### Visualization and interaction

The browser UI presents the simulated geometry and likely accepts or reflects the active pattern through URL state. Demo links act as externalized presets: loading a URL selects a pattern and displays its resulting shape.

- Application page and visualization surface: `index.html`
- Preset/demo definitions and intended shapes: `README.md`

#### External boundaries

There is no application API, database, queue, authentication layer, or deployed service integration indicated by the repository. The material external dependencies are static hosting and browser capabilities; published demos are hosted at `timhutton.github.io/crochet-simulator`.

- Hosting-facing repository entry: `index.html`
- Documentation links to hosted demos and related research: `README.md`

Main entry points: [`index.html`](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html) (Pattern URL state), [`README.md`](https://github.com/timhutton/crochet-simulator/blob/gh-pages/README.md) (Patterns and demo presets)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser application"]
  node_browser(("Web browser<br/>runtime"))
  node_app_page["Simulator page<br/>static application<br/>[index.html]"]
  node_url_state["Pattern URL state<br/>input boundary<br/>[index.html]"]
  node_pattern_parser["Pattern parser<br/>pipeline stage<br/>[index.html]"]
  node_crochet_structure["Ordered crochet structure<br/>intermediate model<br/>[index.html]"]
  node_constraint_builder["Geometric constraints<br/>pipeline stage<br/>[index.html]"]
  node_shape_solver["3D shape solver<br/>pipeline stage<br/>[index.html]"]
  node_simulated_geometry["Simulated geometry<br/>render model<br/>[index.html]"]
  node_interactive_renderer["Interactive renderer<br/>visualization stage<br/>[index.html]"]
  node_simulation_ui["Simulation UI<br/>user interface<br/>[index.html]"]
end

subgraph group_docs["Documentation"]
  node_readme["Patterns and demo presets<br/>documentation<br/>[README.md]"]
end

node_static_host{{"Static hosting<br/>hosting boundary"}}

node_static_host -->|"serves"| node_app_page
node_browser -->|"loads"| node_app_page
node_app_page -->|"reads"| node_url_state
node_url_state -->|"supplies pattern"| node_pattern_parser
node_pattern_parser -->|"produces"| node_crochet_structure
node_crochet_structure -->|"drives"| node_constraint_builder
node_constraint_builder -->|"constrains"| node_shape_solver
node_shape_solver -->|"produces"| node_simulated_geometry
node_simulated_geometry -->|"renders"| node_interactive_renderer
node_interactive_renderer -->|"displays in"| node_simulation_ui
node_simulation_ui -.->|"reflects active pattern"| node_url_state
node_readme -.->|"documents demo payloads"| node_url_state

click node_app_page "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_url_state "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_pattern_parser "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_crochet_structure "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_constraint_builder "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_shape_solver "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_simulated_geometry "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_interactive_renderer "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_simulation_ui "https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html"
click node_readme "https://github.com/timhutton/crochet-simulator/blob/gh-pages/README.md"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_browser,node_app_page,node_url_state,node_pattern_parser,node_crochet_structure,node_constraint_builder,node_shape_solver,node_simulated_geometry,node_interactive_renderer,node_simulation_ui toneBlue
class node_readme toneAmber
class node_static_host toneNeutral
```

## Components

### Browser application

All runtime stages are colocated in the static page.

- **Web browser**: runtime · Provides URL state, UI, and rendering capabilities.
- [Simulator page](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): static application · Complete client-side application container. · `index.html`
- [Pattern URL state](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): input boundary · Shareable query/hash-style pattern payload. · `index.html`
- [Pattern parser](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): pipeline stage · Parses stitches, groups, and repetition counts. · `index.html`
- [Ordered crochet structure](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): intermediate model · `index.html`
- [Geometric constraints](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): pipeline stage · Converts crochet structure into topology and geometry constraints. · `index.html`
- [3D shape solver](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): pipeline stage · Relaxes constraints into a predicted form. · `index.html`
- [Simulated geometry](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): render model · `index.html`
- [Interactive renderer](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): visualization stage · Displays the predicted form in the page. · `index.html`
- [Simulation UI](https://github.com/timhutton/crochet-simulator/blob/gh-pages/index.html): user interface · Reflects the active pattern and rendered result. · `index.html`

### Documentation

- [Patterns and demo presets](https://github.com/timhutton/crochet-simulator/blob/gh-pages/README.md): documentation · Documents notation, representative patterns, and demo URLs. · `README.md`

### Other components

- **Static hosting**: hosting boundary · Serves the single-page application.

## Connections

- Static hosting → Simulator page: serves
- Web browser → Simulator page: loads
- Simulator page → Pattern URL state: reads
- Pattern URL state → Pattern parser: supplies pattern
- Pattern parser → Ordered crochet structure: produces
- Ordered crochet structure → Geometric constraints: drives
- Geometric constraints → 3D shape solver: constrains
- 3D shape solver → Simulated geometry: produces
- Simulated geometry → Interactive renderer: renders
- Interactive renderer → Simulation UI: displays in
- Simulation UI → Pattern URL state: reflects active pattern
- Patterns and demo presets → Pattern URL state: documents demo payloads
