# paulrobinson07/cte-capstone architecture

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

- Interactive diagram: https://gitdiagram.com/paulrobinson07/cte-capstone
- Repository: https://github.com/paulrobinson07/cte-capstone

## Overview

This is a browser-based neural-network car-driving simulation with timed generations. The main loop updates and renders cars, walls, and evolution state; cars sense track boundaries, feed distances through weighted neurons, and use outputs to steer. The user can steer manually or force a generation advance. The README is empty, so the architecture is based on the sampled JavaScript; the HTML entry wiring was not shown.

Main entry points: [`car.js`](https://github.com/paulrobinson07/cte-capstone/blob/main/car.js) (Car Simulation), [`game.js`](https://github.com/paulrobinson07/cte-capstone/blob/main/game.js) (Game Loop), [`output_neurons.js`](https://github.com/paulrobinson07/cte-capstone/blob/main/output_neurons.js) (Control Neurons), [`wall.js`](https://github.com/paulrobinson07/cte-capstone/blob/main/wall.js) (Track Walls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_simulation["Simulation Loop"]
  node_loop["Game Loop<br/>[game.js]"]
  node_geometry["Line Geometry<br/>[game.js]"]
end

subgraph group_driving["Driving World"]
  node_car["Car Simulation<br/>[car.js]"]
  node_walls["Track Walls<br/>[wall.js]"]
end

subgraph group_network["Neural Control"]
  node_inputs["Sensor Neurons<br/>[input_neurons.js]"]
  node_outputs["Control Neurons<br/>[output_neurons.js]"]
end

subgraph group_evolution["Evolution"]
  node_generations["Generation Handler"]
end

node_user(("Player"))

node_user -->|"steers / advances"| node_loop
node_loop -->|"updates"| node_car
node_loop -->|"updates"| node_walls
node_loop -->|"updates"| node_generations
node_car -->|"creates / updates"| node_inputs
node_car -->|"creates / updates"| node_outputs
node_inputs -->|"supplies weighted readings"| node_outputs
node_outputs -->|"provides control values"| node_car
node_car -->|"checks ray collisions"| node_walls
node_car -->|"calls intersection helpers"| node_geometry
node_generations -->|"creates successors"| node_car
node_loop -->|"retargets focus"| node_walls

click node_loop "https://github.com/paulrobinson07/cte-capstone/blob/main/game.js"
click node_geometry "https://github.com/paulrobinson07/cte-capstone/blob/main/game.js"
click node_car "https://github.com/paulrobinson07/cte-capstone/blob/main/car.js"
click node_walls "https://github.com/paulrobinson07/cte-capstone/blob/main/wall.js"
click node_inputs "https://github.com/paulrobinson07/cte-capstone/blob/main/input_neurons.js"
click node_outputs "https://github.com/paulrobinson07/cte-capstone/blob/main/output_neurons.js"
click node_generations "https://github.com/paulrobinson07/cte-capstone/blob/main/evolution_handler.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_loop,node_geometry toneBlue
class node_car,node_walls toneAmber
class node_inputs,node_outputs toneMint
class node_generations toneRose
class node_user toneIndigo
```

## Components

### Simulation Loop

- [Game Loop](https://github.com/paulrobinson07/cte-capstone/blob/main/game.js): `game.js`
- [Line Geometry](https://github.com/paulrobinson07/cte-capstone/blob/main/game.js): `game.js`

### Driving World

- [Car Simulation](https://github.com/paulrobinson07/cte-capstone/blob/main/car.js): `car.js`
- [Track Walls](https://github.com/paulrobinson07/cte-capstone/blob/main/wall.js): `wall.js`

### Neural Control

- [Sensor Neurons](https://github.com/paulrobinson07/cte-capstone/blob/main/input_neurons.js): `input_neurons.js`
- [Control Neurons](https://github.com/paulrobinson07/cte-capstone/blob/main/output_neurons.js): `output_neurons.js`

### Evolution

- [Generation Handler](https://github.com/paulrobinson07/cte-capstone/blob/main/evolution_handler.js): `evolution_handler.js`

### Other components

- **Player**

## Connections

- Player → Game Loop: steers / advances (evidence: `game.js`)
- Game Loop → Car Simulation: updates (evidence: `game.js`)
- Game Loop → Track Walls: updates (evidence: `game.js`)
- Game Loop → Generation Handler: updates (evidence: `game.js`)
- Car Simulation → Sensor Neurons: creates / updates (evidence: `car.js`)
- Car Simulation → Control Neurons: creates / updates (evidence: `car.js`)
- Sensor Neurons → Control Neurons: supplies weighted readings (evidence: `output_neurons.js`)
- Control Neurons → Car Simulation: provides control values (evidence: `car.js`)
- Car Simulation → Track Walls: checks ray collisions (evidence: `car.js`)
- Car Simulation → Line Geometry: calls intersection helpers (evidence: `car.js`)
- Generation Handler → Car Simulation: creates successors (evidence: `evolution_handler.js`)
- Game Loop → Track Walls: retargets focus (evidence: `game.js`)
