# tanwa1/knights-travails architecture

> Architecture diagram of the GitHub repository tanwa1/knights-travails, 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/tanwa1/knights-travails
- Repository: https://github.com/tanwa1/knights-travails

## Overview

Knights-Travails is a small JavaScript library for finding a shortest knight route on an 8×8 board. The caller supplies start and end squares to `knightMoves`, which normalizes coordinates, searches legal moves breadth-first, and returns the path. The same module exposes parsing, board-boundary validation, and legal-move generation as separate helpers. The implementation excerpt supports the call relationships shown; tests and tooling are excluded.

Main entry points: [`Knights-Travails/knightTravails.js`](https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js) (BFS solver)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_caller(("Caller"))
node_solver["BFS solver<br/>[knightTravails.js]"]
node_parser["Square parser<br/>[knightTravails.js]"]
node_moves["Legal moves<br/>[knightTravails.js]"]
node_validator["Board validator<br/>[knightTravails.js]"]

node_caller -->|"requests route"| node_solver
node_solver -->|"normalizes squares"| node_parser
node_solver -->|"expands paths"| node_moves
node_moves -->|"checks bounds"| node_validator
node_solver -->|"returns path"| node_caller

click node_solver "https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js"
click node_parser "https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js"
click node_moves "https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js"
click node_validator "https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js"

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_caller toneIndigo
class node_solver,node_parser,node_moves,node_validator toneTeal
```

## Components

### Other components

- **Caller**
- [BFS solver](https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js): `Knights-Travails/knightTravails.js`
- [Square parser](https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js): `Knights-Travails/knightTravails.js`
- [Legal moves](https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js): `Knights-Travails/knightTravails.js`
- [Board validator](https://github.com/tanwa1/knights-travails/blob/main/Knights-Travails/knightTravails.js): `Knights-Travails/knightTravails.js`

## Connections

- Caller → BFS solver: requests route (evidence: `Knights-Travails/knightTravails.js`)
- BFS solver → Square parser: normalizes squares (evidence: `Knights-Travails/knightTravails.js`)
- BFS solver → Legal moves: expands paths (evidence: `Knights-Travails/knightTravails.js`)
- Legal moves → Board validator: checks bounds (evidence: `Knights-Travails/knightTravails.js`)
- BFS solver → Caller: returns path (evidence: `Knights-Travails/knightTravails.js`)
