# wise-introvert/crossplay-solver architecture

> Architecture diagram of the GitHub repository wise-introvert/crossplay-solver, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/wise-introvert/crossplay-solver
- Repository: https://github.com/wise-introvert/crossplay-solver

## Overview

This is a browser-based Crossplay board solver. Users enter a board and rack, or import a screenshot; the app loads its word list, generates and scores legal plays, then presents ranked results and board previews. Screenshot recognition uses image analysis and character templates before returning board and rack data. The excerpts show the main dictionary, solver, UI, and OCR responsibilities, but omit some wiring, so uncertain internal calls are not asserted.

Main entry points: [`ocr.js`](https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js) (OCR Pipeline), [`app.js`](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js) (Screenshot Import), [`dict.txt`](https://github.com/wise-introvert/crossplay-solver/blob/master/dict.txt) (Word List), [`templates.json`](https://github.com/wise-introvert/crossplay-solver/blob/master/templates.json) (Glyph Templates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_board_entry["Board Entry"]
  node_board_editor["Board Editor<br/>[app.js]"]
  node_rack_input["Rack Input<br/>[app.js]"]
  node_screenshot_import["Screenshot Import<br/>[app.js]"]
end

subgraph group_solve["Move Solving"]
  node_dictionary_loader["Dictionary Loader<br/>[app.js]"]
  node_move_generator["Move Generator<br/>[app.js]"]
  node_move_scoring["Move Scoring<br/>[app.js]"]
  node_results_preview["Results Preview<br/>[app.js]"]
end

subgraph group_recognition["Screenshot Recognition"]
  node_ocr_pipeline["OCR Pipeline<br/>[ocr.js]"]
  node_board_detection["Board Detection<br/>[ocr.js]"]
  node_glyph_matching["Glyph Matching<br/>[ocr.js]"]
end

subgraph group_assets["Data Assets"]
  node_word_list["Word List<br/>[dict.txt]"]
  node_glyph_templates["Glyph Templates<br/>[templates.json]"]
end

node_user(("Player"))

node_user -->|"enters board"| node_board_editor
node_user -->|"enters rack"| node_rack_input
node_user -->|"selects image"| node_screenshot_import
node_dictionary_loader -->|"fetches words"| node_word_list
node_screenshot_import -->|"processes image"| node_ocr_pipeline
node_ocr_pipeline -->|"loads templates"| node_glyph_templates
node_ocr_pipeline -.->|"analyzes image"| node_board_detection
node_ocr_pipeline -.->|"matches glyphs"| node_glyph_matching
node_move_generator -.->|"scores plays"| node_move_scoring
node_results_preview -->|"previews play"| node_board_editor

click node_board_editor "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_rack_input "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_screenshot_import "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_dictionary_loader "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_move_generator "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_move_scoring "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_results_preview "https://github.com/wise-introvert/crossplay-solver/blob/master/app.js"
click node_ocr_pipeline "https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js"
click node_board_detection "https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js"
click node_glyph_matching "https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js"
click node_word_list "https://github.com/wise-introvert/crossplay-solver/blob/master/dict.txt"
click node_glyph_templates "https://github.com/wise-introvert/crossplay-solver/blob/master/templates.json"

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_board_editor,node_rack_input,node_screenshot_import toneBlue
class node_dictionary_loader,node_move_generator,node_move_scoring,node_results_preview toneAmber
class node_ocr_pipeline,node_board_detection,node_glyph_matching toneMint
class node_word_list,node_glyph_templates toneRose
class node_user toneIndigo
```

## Components

### Board Entry

- [Board Editor](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`
- [Rack Input](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`
- [Screenshot Import](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`

### Move Solving

- [Dictionary Loader](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`
- [Move Generator](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`
- [Move Scoring](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`
- [Results Preview](https://github.com/wise-introvert/crossplay-solver/blob/master/app.js): `app.js`

### Screenshot Recognition

- [OCR Pipeline](https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js): `ocr.js`
- [Board Detection](https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js): `ocr.js`
- [Glyph Matching](https://github.com/wise-introvert/crossplay-solver/blob/master/ocr.js): `ocr.js`

### Data Assets

- [Word List](https://github.com/wise-introvert/crossplay-solver/blob/master/dict.txt): `dict.txt`
- [Glyph Templates](https://github.com/wise-introvert/crossplay-solver/blob/master/templates.json): `templates.json`

### Other components

- **Player**

## Connections

- Player → Board Editor: enters board (evidence: `app.js`)
- Player → Rack Input: enters rack (evidence: `app.js`)
- Player → Screenshot Import: selects image (evidence: `app.js`)
- Dictionary Loader → Word List: fetches words (evidence: `app.js`)
- Screenshot Import → OCR Pipeline: processes image (evidence: `app.js`)
- OCR Pipeline → Glyph Templates: loads templates (evidence: `ocr.js`)
- OCR Pipeline → Board Detection: analyzes image (evidence: `ocr.js`)
- OCR Pipeline → Glyph Matching: matches glyphs (evidence: `ocr.js`)
- Move Generator → Move Scoring: scores plays (evidence: `app.js`)
- Results Preview → Board Editor: previews play (evidence: `app.js`)
