@reicek/neataptic-ts 0.1.21 → 0.1.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/agents/boundary-mapper.agent.md +31 -0
- package/.github/agents/docs-scout.agent.md +29 -0
- package/.github/agents/plan-scout.agent.md +31 -0
- package/.github/agents/solid-split.agent.md +143 -0
- package/.github/copilot-instructions.md +119 -0
- package/.github/skills/solid-split-playbook/SKILL.md +220 -0
- package/.github/skills/solid-split-playbook/assets/docs-checklist.md +34 -0
- package/.github/skills/solid-split-playbook/assets/split-plan-template.md +48 -0
- package/.github/skills/solid-split-playbook/assets/split-workflow-checklist.md +51 -0
- package/.github/skills/trace-analyzer-extension/SKILL.md +63 -0
- package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +24 -0
- package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +101 -0
- package/.github/skills/trace-audit-reporting/SKILL.md +96 -0
- package/.github/skills/trace-audit-reporting/assets/performance-report-template.md +123 -0
- package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +132 -0
- package/package.json +7 -3
- package/plans/ES2023 migration +13 -8
- package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
- package/plans/Flappy_Bird_Folder_Documentation_Pass.md +53 -0
- package/plans/Flappy_Evolution_Worker_Documentation_Pass.md +58 -0
- package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
- package/plans/Memory_Optimization.md +3 -3
- package/plans/README.md +63 -0
- package/plans/Roadmap.md +15 -3
- package/plans/asciiMaze_SOLID_split.done.md +130 -0
- package/plans/flappy_bird_SOLID_split.done.md +67 -0
- package/scripts/analyze-trace.ts +590 -0
- package/scripts/assets/theme.css +221 -34
- package/scripts/copy-examples.mjs +9 -5
- package/scripts/export-onnx.mjs +3 -3
- package/scripts/generate-bench-tables.mjs +10 -10
- package/scripts/generate-bench-tables.ts +10 -10
- package/scripts/generate-docs.ts +1415 -449
- package/scripts/render-docs-html.ts +15 -8
- package/src/README.md +127 -222
- package/src/architecture/README.md +117 -184
- package/src/architecture/architect.ts +6 -0
- package/src/architecture/layer/README.md +38 -38
- package/src/architecture/network/README.md +49 -31
- package/src/architecture/network/activate/README.md +77 -77
- package/src/architecture/network/connect/README.md +15 -13
- package/src/architecture/network/deterministic/README.md +7 -7
- package/src/architecture/network/evolve/README.md +44 -44
- package/src/architecture/network/gating/README.md +20 -20
- package/src/architecture/network/genetic/README.md +51 -51
- package/src/architecture/network/mutate/README.md +97 -97
- package/src/architecture/network/network.types.ts +39 -0
- package/src/architecture/network/onnx/README.md +264 -264
- package/src/architecture/network/prune/README.md +39 -39
- package/src/architecture/network/remove/README.md +26 -26
- package/src/architecture/network/serialize/README.md +56 -56
- package/src/architecture/network/serialize/network.serialize.json.utils.ts +1 -0
- package/src/architecture/network/serialize/network.serialize.utils.ts +6 -1
- package/src/architecture/network/serialize/network.serialize.utils.types.ts +1 -1
- package/src/architecture/network/slab/README.md +61 -61
- package/src/architecture/network/standalone/README.md +24 -24
- package/src/architecture/network/stats/README.md +9 -9
- package/src/architecture/network/topology/README.md +46 -46
- package/src/architecture/network/training/README.md +21 -21
- package/src/architecture/network.ts +114 -10
- package/src/methods/README.md +9 -87
- package/src/multithreading/README.md +8 -77
- package/src/multithreading/workers/README.md +2 -2
- package/src/multithreading/workers/browser/README.md +0 -6
- package/src/multithreading/workers/node/README.md +0 -3
- package/src/neat/README.md +623 -568
- package/src/neat/neat.evolve.population.utils.ts +29 -5
- package/src/neat/neat.helpers.ts +16 -0
- package/src/neat/neat.topology-intent.utils.ts +160 -0
- package/src/utils/README.md +18 -18
- package/test/examples/asciiMaze/README.md +59 -59
- package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
- package/test/examples/asciiMaze/browser-entry/README.md +196 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
- package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
- package/test/examples/asciiMaze/browser-entry.ts +10 -576
- package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
- package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
- package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
- package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
- package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
- package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
- package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
- package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
- package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
- package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
- package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
- package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
- package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
- package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
- package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
- package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
- package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
- package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
- package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
- package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
- package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
- package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
- package/test/examples/asciiMaze/fitness.ts +2 -2
- package/test/examples/asciiMaze/fitness.types.ts +65 -0
- package/test/examples/asciiMaze/interfaces.ts +64 -1352
- package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
- package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
- package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
- package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
- package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
- package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
- package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
- package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
- package/test/examples/flappy_bird/README.md +193 -88
- package/test/examples/flappy_bird/browser-entry/README.md +1441 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
- package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +9 -396
- package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +6 -714
- package/test/examples/flappy_bird/browser-entry/browser-entry.render.types.ts +26 -3
- package/test/examples/flappy_bird/browser-entry/browser-entry.runtime.types.ts +16 -1
- package/test/examples/flappy_bird/browser-entry/browser-entry.simulation.types.ts +39 -5
- package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
- package/test/examples/flappy_bird/browser-entry/browser-entry.stats.types.ts +32 -4
- package/test/examples/flappy_bird/browser-entry/browser-entry.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.types.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.types.ts +50 -7
- package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +21 -893
- package/test/examples/flappy_bird/browser-entry/browser-entry.worker.types.ts +91 -10
- package/test/examples/flappy_bird/browser-entry/host/README.md +318 -0
- package/test/examples/flappy_bird/browser-entry/host/host.canvas.service.ts +16 -0
- package/test/examples/flappy_bird/browser-entry/host/host.constants.ts +20 -0
- package/test/examples/flappy_bird/browser-entry/host/host.dom.service.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
- package/test/examples/flappy_bird/browser-entry/host/host.stats.service.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/host/host.ts +592 -6
- package/test/examples/flappy_bird/browser-entry/host/host.types.ts +13 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/README.md +309 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +47 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +392 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +132 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +272 -0
- package/test/examples/flappy_bird/browser-entry/network-view/README.md +389 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.draw.service.ts +13 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.labels.utils.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.layout.utils.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +267 -0
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +823 -7
- package/test/examples/flappy_bird/browser-entry/network-view/network-view.types.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/playback/README.md +845 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/README.md +355 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +1068 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.batch.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +207 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +197 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.batch.utils.ts +114 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.test.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.layout.utils.ts +204 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.services.ts +49 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +313 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.layer.services.ts +81 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.test.ts +33 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +201 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.selection.utils.ts +171 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.timing.utils.ts +124 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.test.ts +279 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +132 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.scene.services.ts +26 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +65 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +342 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +127 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.draw.services.ts +184 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.scene.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +6 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +105 -0
- package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +541 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.bird.utils.ts +180 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.canvas.services.ts +77 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.entity.services.ts +167 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.scene.services.ts +57 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.test.ts +176 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +113 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +35 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.trail.utils.ts +248 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +103 -0
- package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
- package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +10 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.iteration.services.ts +192 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.loop.service.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types.ts +78 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.render.pipe-outline.service.ts +128 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.render.service.ts +1 -116
- package/test/examples/flappy_bird/browser-entry/playback/playback.session.services.ts +184 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.test.ts +121 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.layer.services.ts +36 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +11 -128
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +268 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +91 -0
- package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
- package/test/examples/flappy_bird/browser-entry/playback/playback.trail.utils.ts +9 -86
- package/test/examples/flappy_bird/browser-entry/playback/playback.ts +75 -7
- package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +12 -9
- package/test/examples/flappy_bird/browser-entry/playback/playback.worker-channel.utils.ts +11 -123
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +55 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.services.ts +103 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.test.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/playback/snapshot/playback.snapshot.summary.utils.ts +28 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +95 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.test.ts +35 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.history.services.ts +64 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.test.ts +37 -0
- package/test/examples/flappy_bird/browser-entry/playback/trail/playback.trail.opacity.utils.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +71 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.request.services.ts +45 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.summary.services.ts +74 -0
- package/test/examples/flappy_bird/browser-entry/playback/worker-channel/playback.worker-channel.types.ts +53 -0
- package/test/examples/flappy_bird/browser-entry/runtime/README.md +304 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.browser-globals.service.ts +15 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.errors.ts +17 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +56 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-loop.service.ts +19 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +96 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +92 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.telemetry.service.ts +24 -0
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
- package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +65 -0
- package/test/examples/flappy_bird/browser-entry/visualization/README.md +568 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.colors.utils.ts +26 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +979 -19
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +157 -3
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +13 -27
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +7 -20
- package/test/examples/flappy_bird/browser-entry/visualization/visualization.types.ts +14 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +238 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.errors.ts +11 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.generation.service.ts +12 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.test.ts +143 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.playback.service.ts +140 -14
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.request.service.ts +27 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.ts +8 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.types.ts +23 -0
- package/test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.url.service.ts +5 -0
- package/test/examples/flappy_bird/constants/README.md +1163 -0
- package/test/examples/flappy_bird/constants/constants.birds.ts +16 -38
- package/test/examples/flappy_bird/constants/constants.difficulty.ts +21 -0
- package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
- package/test/examples/flappy_bird/constants/constants.network.ts +1 -1
- package/test/examples/flappy_bird/constants/constants.observation.ts +7 -0
- package/test/examples/flappy_bird/constants/constants.palette.ts +9 -2
- package/test/examples/flappy_bird/constants/constants.physics.ts +9 -0
- package/test/examples/flappy_bird/constants/constants.pipe-render.ts +3 -0
- package/test/examples/flappy_bird/constants/constants.pipes.ts +22 -3
- package/test/examples/flappy_bird/constants/constants.runtime.ts +28 -4
- package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
- package/test/examples/flappy_bird/constants/constants.ts +6 -0
- package/test/examples/flappy_bird/environment/README.md +182 -0
- package/test/examples/flappy_bird/environment/environment.collision.utils.ts +7 -0
- package/test/examples/flappy_bird/environment/environment.constants.ts +16 -3
- package/test/examples/flappy_bird/environment/environment.observation.utils.ts +12 -19
- package/test/examples/flappy_bird/environment/environment.state.service.ts +10 -0
- package/test/examples/flappy_bird/environment/environment.step.service.ts +15 -66
- package/test/examples/flappy_bird/environment/environment.types.ts +14 -0
- package/test/examples/flappy_bird/evaluation/README.md +155 -0
- package/test/examples/flappy_bird/evaluation/evaluation.constants.ts +23 -4
- package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +16 -1
- package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +7 -374
- package/test/examples/flappy_bird/evaluation/evaluation.seed.utils.ts +4 -0
- package/test/examples/flappy_bird/evaluation/evaluation.types.ts +18 -2
- package/test/examples/flappy_bird/evaluation/rollout/README.md +355 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +38 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +71 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +338 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +69 -0
- package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +399 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/README.md +845 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.constants.ts +49 -7
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.errors.ts +34 -3
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.evolution.service.ts +22 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +62 -26
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.protocol.service.ts +27 -1
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.runtime.service.ts +23 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +378 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +22 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +20 -203
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.test.ts +94 -0
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.snapshot.utils.ts +78 -13
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +235 -344
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.types.ts +170 -22
- package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +314 -0
- package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +17 -0
- package/test/examples/flappy_bird/flappyEnvironment.ts +21 -0
- package/test/examples/flappy_bird/flappyEvaluation.ts +12 -0
- package/test/examples/flappy_bird/flappyEvolution.worker.ts +7 -0
- package/test/examples/flappy_bird/index.ts +8 -2
- package/test/examples/flappy_bird/rng.ts +10 -0
- package/test/examples/flappy_bird/simulation-shared/README.md +518 -0
- package/test/examples/flappy_bird/simulation-shared/observation/README.md +255 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +339 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +19 -0
- package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +81 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.constants.ts +3 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.control.utils.ts +6 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.difficulty.utils.ts +9 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.errors.ts +10 -1
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.memory.utils.ts +18 -0
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +7 -402
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +36 -6
- package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +30 -9
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.types.ts +38 -5
- package/test/examples/flappy_bird/trainFlappyBird.ts +13 -0
- package/test/examples/flappy_bird/trainer/README.md +676 -0
- package/test/examples/flappy_bird/trainer/evaluation/README.md +253 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +15 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +86 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +187 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +32 -0
- package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +182 -0
- package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
- package/test/examples/flappy_bird/trainer/trainer.fitness.service.ts +23 -1
- package/test/examples/flappy_bird/trainer/trainer.loop.service.ts +17 -1
- package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
- package/test/examples/flappy_bird/trainer/trainer.report.service.ts +136 -0
- package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
- package/test/examples/flappy_bird/trainer/trainer.setup.service.ts +22 -0
- package/test/examples/flappy_bird/trainer/trainer.signals.service.ts +8 -0
- package/test/examples/flappy_bird/trainer/trainer.ts +38 -553
- package/test/examples/flappy_bird/trainer/trainer.types.ts +44 -7
- package/test/neat/neat.topology-intent.test.ts +129 -0
- package/test/network/network.topology-intent.test.ts +44 -0
- package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
- package/test/examples/flappy_bird/environment/environment.ts +0 -7
- package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
- package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
- package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
|
@@ -0,0 +1,1441 @@
|
|
|
1
|
+
# browser-entry
|
|
2
|
+
|
|
3
|
+
## browser-entry/browser-entry.types.ts
|
|
4
|
+
|
|
5
|
+
### browser-entry.types
|
|
6
|
+
|
|
7
|
+
Aggregated public type surface for the Flappy Bird browser runtime.
|
|
8
|
+
|
|
9
|
+
The browser demo spans several concerns at once: worker messaging, playback
|
|
10
|
+
rendering, telemetry, viewport math, and network visualization. Re-exporting
|
|
11
|
+
the public contracts from one place gives readers a compact map of that
|
|
12
|
+
runtime without forcing them to know the internal folder layout first.
|
|
13
|
+
|
|
14
|
+
### BrowserDifficultyProfile
|
|
15
|
+
|
|
16
|
+
Difficulty profile consumed by simulation observation helpers.
|
|
17
|
+
|
|
18
|
+
This bundles the three variables that define how demanding a stretch of the
|
|
19
|
+
course is: corridor width, pipe speed, and spawn cadence.
|
|
20
|
+
|
|
21
|
+
### BrowserPopulationBirdLike
|
|
22
|
+
|
|
23
|
+
Simulation-facing browser contracts shared by playback helpers.
|
|
24
|
+
|
|
25
|
+
These types describe the minimum world state the browser needs while it is
|
|
26
|
+
reconstructing, rendering, or summarizing worker-produced frames.
|
|
27
|
+
|
|
28
|
+
### BrowserPopulationPipeLike
|
|
29
|
+
|
|
30
|
+
Pipe shape used by utility observation-vector helpers.
|
|
31
|
+
|
|
32
|
+
### ColorLegendRow
|
|
33
|
+
|
|
34
|
+
Legend row model for network visualization color legends.
|
|
35
|
+
|
|
36
|
+
Each row labels a numeric interval and the color used to render it.
|
|
37
|
+
|
|
38
|
+
### ColorTier
|
|
39
|
+
|
|
40
|
+
Connection or bias tier used for color mapping ramps.
|
|
41
|
+
|
|
42
|
+
Visualization buckets continuous weights into legible color bands so humans
|
|
43
|
+
can scan sign and magnitude at a glance.
|
|
44
|
+
|
|
45
|
+
### CreateFlappyStatsTableRowsInput
|
|
46
|
+
|
|
47
|
+
Input contract for declarative runtime stats table row builder.
|
|
48
|
+
|
|
49
|
+
The builder needs both the target table and a small policy surface that says
|
|
50
|
+
whether instrumentation rows should appear and how rows should be colored.
|
|
51
|
+
|
|
52
|
+
### EvolutionGenerationPayload
|
|
53
|
+
|
|
54
|
+
Worker payload describing evolved generation summary values.
|
|
55
|
+
|
|
56
|
+
This is the browser-facing summary of one completed NEAT generation: what
|
|
57
|
+
generation finished, how fit the best genome was, and optionally the best
|
|
58
|
+
network for visualization or playback.
|
|
59
|
+
|
|
60
|
+
### EvolutionGenerationReadyMessage
|
|
61
|
+
|
|
62
|
+
Worker message emitted when a generation has completed evolving.
|
|
63
|
+
|
|
64
|
+
### EvolutionPlaybackStepMessage
|
|
65
|
+
|
|
66
|
+
Worker message carrying one playback step and aggregate markers.
|
|
67
|
+
|
|
68
|
+
Besides the frame snapshot itself, this message also carries summary values
|
|
69
|
+
used by the HUD so the browser can show performance and progress without
|
|
70
|
+
recomputing population-wide statistics on the main thread.
|
|
71
|
+
|
|
72
|
+
### EvolutionPlaybackStepSnapshot
|
|
73
|
+
|
|
74
|
+
Per-frame snapshot received from the worker playback channel.
|
|
75
|
+
|
|
76
|
+
A snapshot combines geometry, packed population state, and lightweight world
|
|
77
|
+
metadata so the browser can render a deterministic frame without rerunning
|
|
78
|
+
the simulation locally.
|
|
79
|
+
|
|
80
|
+
### EvolutionWorkerErrorMessage
|
|
81
|
+
|
|
82
|
+
Worker message emitted for simulation/playback errors.
|
|
83
|
+
|
|
84
|
+
### EvolutionWorkerMessage
|
|
85
|
+
|
|
86
|
+
Union of all supported worker messages consumed by browser entry.
|
|
87
|
+
|
|
88
|
+
A closed union keeps the main-thread message handler explicit and easy to
|
|
89
|
+
audit when the protocol evolves.
|
|
90
|
+
|
|
91
|
+
### FlappyBirdRunHandle
|
|
92
|
+
|
|
93
|
+
Public lifecycle contracts for the Flappy Bird browser runtime.
|
|
94
|
+
|
|
95
|
+
These types describe how the demo is started, stopped, and exposed on the
|
|
96
|
+
browser `window` object. They are intentionally small because callers should
|
|
97
|
+
control the demo at a high level without depending on private implementation
|
|
98
|
+
details.
|
|
99
|
+
|
|
100
|
+
### FlappyStatsCategoryColors
|
|
101
|
+
|
|
102
|
+
Color pair used for stats category key/value styling.
|
|
103
|
+
|
|
104
|
+
The HUD uses paired colors so labels and values stay visually grouped while
|
|
105
|
+
still separating categories such as current run, telemetry, and best-so-far.
|
|
106
|
+
|
|
107
|
+
### FlappyStatsKey
|
|
108
|
+
|
|
109
|
+
HUD and runtime stats contracts for the Flappy Bird browser demo.
|
|
110
|
+
|
|
111
|
+
The browser HUD is intentionally declarative: keys describe what should be
|
|
112
|
+
shown, and helper utilities map those keys to DOM rows and live values. That
|
|
113
|
+
keeps the status panel readable even as telemetry grows.
|
|
114
|
+
|
|
115
|
+
### FlappyStatsRowDescriptor
|
|
116
|
+
|
|
117
|
+
Declarative row descriptor for the runtime stats table.
|
|
118
|
+
|
|
119
|
+
Each row is described as data first so the HUD can be assembled in a stable,
|
|
120
|
+
testable order instead of being hand-written imperatively.
|
|
121
|
+
|
|
122
|
+
### FlappyStatsTableCells
|
|
123
|
+
|
|
124
|
+
Runtime lookup map of stat keys to writable value cells.
|
|
125
|
+
|
|
126
|
+
This acts like a small DOM index so the update loop can mutate the correct
|
|
127
|
+
cells directly without repeatedly querying the document.
|
|
128
|
+
|
|
129
|
+
### NetworkLegendLayout
|
|
130
|
+
|
|
131
|
+
Precomputed legend panel layout used by visualization renderer.
|
|
132
|
+
|
|
133
|
+
Layout is resolved up front so the draw path can stay focused on painting,
|
|
134
|
+
not recomputing geometry every frame.
|
|
135
|
+
|
|
136
|
+
### NetworkNodeDimensionsLike
|
|
137
|
+
|
|
138
|
+
Pixel dimensions used for network-node rectangle rendering.
|
|
139
|
+
|
|
140
|
+
Keeping node box dimensions explicit makes legend and topology layout easier
|
|
141
|
+
to tune without hidden drawing constants.
|
|
142
|
+
|
|
143
|
+
### NetworkVisualizationHandle
|
|
144
|
+
|
|
145
|
+
Network-visualization contracts for the Flappy Bird browser demo.
|
|
146
|
+
|
|
147
|
+
One of the educational goals of the example is to let people watch evolved
|
|
148
|
+
controllers as structures, not just as scores. These types describe the
|
|
149
|
+
lightweight shapes used by the architecture panel so rendering logic can stay
|
|
150
|
+
decoupled from the full internal network implementation.
|
|
151
|
+
|
|
152
|
+
### PackedPlaybackBirdSnapshot
|
|
153
|
+
|
|
154
|
+
Packed typed-array payload for playback bird snapshot transport.
|
|
155
|
+
|
|
156
|
+
This mirrors the pipe packing strategy so playback can move large population
|
|
157
|
+
snapshots with less allocation pressure than object-per-bird messages.
|
|
158
|
+
|
|
159
|
+
### PackedPlaybackPipeSnapshot
|
|
160
|
+
|
|
161
|
+
Packed typed-array payload for playback pipe snapshot transport.
|
|
162
|
+
|
|
163
|
+
Typed arrays keep frame payloads compact and predictable, which matters when
|
|
164
|
+
the worker is streaming many birds and pipes across animation frames.
|
|
165
|
+
|
|
166
|
+
### PlaybackFrameStats
|
|
167
|
+
|
|
168
|
+
Lightweight per-frame telemetry emitted to HUD update callback.
|
|
169
|
+
|
|
170
|
+
These values are the browser-friendly metrics shown in the live status panel:
|
|
171
|
+
how many birds remain, how far the leader has progressed, and how expensive
|
|
172
|
+
the current playback cadence is.
|
|
173
|
+
|
|
174
|
+
### PopulationBird
|
|
175
|
+
|
|
176
|
+
Renderable bird state snapshot emitted by the playback worker.
|
|
177
|
+
|
|
178
|
+
The browser does not receive full neural state here. It only gets the fields
|
|
179
|
+
needed for presentation and HUD summaries, which keeps per-frame transport
|
|
180
|
+
light.
|
|
181
|
+
|
|
182
|
+
### PopulationPipe
|
|
183
|
+
|
|
184
|
+
Renderable pipe state snapshot emitted by the playback worker.
|
|
185
|
+
|
|
186
|
+
This is the smallest pipe shape the browser renderer needs for one frame:
|
|
187
|
+
horizontal position plus the vertical corridor geometry.
|
|
188
|
+
|
|
189
|
+
### PopulationRenderState
|
|
190
|
+
|
|
191
|
+
Mutable render-state model consumed by the population frame renderer.
|
|
192
|
+
|
|
193
|
+
The playback layer incrementally updates this state as worker snapshots
|
|
194
|
+
arrive, which lets rendering stay deterministic without re-deriving world
|
|
195
|
+
history from scratch each frame.
|
|
196
|
+
|
|
197
|
+
### PositionedNetworkNodeLike
|
|
198
|
+
|
|
199
|
+
Positioned node instance used by network visualization drawing.
|
|
200
|
+
|
|
201
|
+
Layout and rendering are split: first a node is assigned screen coordinates,
|
|
202
|
+
then the renderer paints it.
|
|
203
|
+
|
|
204
|
+
### RenderClosedOuterBoxInput
|
|
205
|
+
|
|
206
|
+
Input contract for outer frame rendering helper.
|
|
207
|
+
|
|
208
|
+
The outer frame is the decorative shell that visually separates the playable
|
|
209
|
+
world and telemetry panels from the rest of the page.
|
|
210
|
+
|
|
211
|
+
### RenderStandaloneTitleBoxInput
|
|
212
|
+
|
|
213
|
+
Canvas frame-layout contracts for the Flappy Bird browser demo.
|
|
214
|
+
|
|
215
|
+
These types support the demo's deliberately stylized text-frame chrome: title
|
|
216
|
+
boxes, outer borders, and viewport transforms that make the example feel more
|
|
217
|
+
like an instrument panel than a plain canvas game.
|
|
218
|
+
|
|
219
|
+
### RngLike
|
|
220
|
+
|
|
221
|
+
Minimal random source contract used by utility random helpers.
|
|
222
|
+
|
|
223
|
+
The narrow contract keeps deterministic spawn utilities portable across
|
|
224
|
+
browser and test contexts.
|
|
225
|
+
|
|
226
|
+
### RuntimeWindow
|
|
227
|
+
|
|
228
|
+
Runtime window contract for the Flappy Bird browser demo.
|
|
229
|
+
|
|
230
|
+
The demo exposes a small debug-friendly surface on `window` so manual browser
|
|
231
|
+
experiments and docs examples can start the simulation without importing the
|
|
232
|
+
bundle as a module.
|
|
233
|
+
|
|
234
|
+
### SerializedNetwork
|
|
235
|
+
|
|
236
|
+
Worker transport contracts for the Flappy Bird browser runtime.
|
|
237
|
+
|
|
238
|
+
The browser UI and the evolution worker communicate through a deliberately
|
|
239
|
+
explicit message protocol. The goal is educational as well as practical: it
|
|
240
|
+
makes it obvious which values are computed off-thread, which snapshots are
|
|
241
|
+
transferred frame-by-frame, and which events advance the demo state.
|
|
242
|
+
|
|
243
|
+
If you want background reading, the Wikipedia article on "message passing"
|
|
244
|
+
provides a useful conceptual frame for this boundary.
|
|
245
|
+
|
|
246
|
+
### TextFrameMetrics
|
|
247
|
+
|
|
248
|
+
Canvas text-grid metrics used for frame rendering layout helpers.
|
|
249
|
+
|
|
250
|
+
The frame renderer measures glyph and row geometry once, then uses that grid
|
|
251
|
+
to place ASCII-style UI elements consistently.
|
|
252
|
+
|
|
253
|
+
### TrailPoint
|
|
254
|
+
|
|
255
|
+
Trail point used by playback trail rendering cache.
|
|
256
|
+
|
|
257
|
+
A trail point stores where one bird was at one frame so the UI can draw a
|
|
258
|
+
short motion history behind active agents.
|
|
259
|
+
|
|
260
|
+
### TrailState
|
|
261
|
+
|
|
262
|
+
Mutable trail cache keyed by bird index for frame rendering.
|
|
263
|
+
|
|
264
|
+
This cache exists purely for visualization ergonomics; it is not part of the
|
|
265
|
+
worker simulation state.
|
|
266
|
+
|
|
267
|
+
### ViewportInfo
|
|
268
|
+
|
|
269
|
+
Viewport transform values for world-to-canvas rendering.
|
|
270
|
+
|
|
271
|
+
These numbers answer the classic graphics question: how does one unit in the
|
|
272
|
+
simulated world map into the current canvas rectangle?
|
|
273
|
+
|
|
274
|
+
### VisualNetworkConnectionLike
|
|
275
|
+
|
|
276
|
+
Lightweight connection shape used by network visualization drawing.
|
|
277
|
+
|
|
278
|
+
The renderer only needs connectivity, weight, and enabled state, not the full
|
|
279
|
+
training-time behavior of a connection object.
|
|
280
|
+
|
|
281
|
+
### VisualNetworkNodeLike
|
|
282
|
+
|
|
283
|
+
Lightweight node shape used by network visualization drawing.
|
|
284
|
+
|
|
285
|
+
This shape keeps the renderer independent from the concrete Network class
|
|
286
|
+
while still exposing the semantic fields that matter visually.
|
|
287
|
+
|
|
288
|
+
## browser-entry/browser-entry.stats.types.ts
|
|
289
|
+
|
|
290
|
+
### browser-entry.stats.types
|
|
291
|
+
|
|
292
|
+
HUD and runtime stats contracts for the Flappy Bird browser demo.
|
|
293
|
+
|
|
294
|
+
The browser HUD is intentionally declarative: keys describe what should be
|
|
295
|
+
shown, and helper utilities map those keys to DOM rows and live values. That
|
|
296
|
+
keeps the status panel readable even as telemetry grows.
|
|
297
|
+
|
|
298
|
+
### CreateFlappyStatsTableRowsInput
|
|
299
|
+
|
|
300
|
+
Input contract for declarative runtime stats table row builder.
|
|
301
|
+
|
|
302
|
+
The builder needs both the target table and a small policy surface that says
|
|
303
|
+
whether instrumentation rows should appear and how rows should be colored.
|
|
304
|
+
|
|
305
|
+
### FlappyStatsCategoryColors
|
|
306
|
+
|
|
307
|
+
Color pair used for stats category key/value styling.
|
|
308
|
+
|
|
309
|
+
The HUD uses paired colors so labels and values stay visually grouped while
|
|
310
|
+
still separating categories such as current run, telemetry, and best-so-far.
|
|
311
|
+
|
|
312
|
+
### FlappyStatsKey
|
|
313
|
+
|
|
314
|
+
HUD and runtime stats contracts for the Flappy Bird browser demo.
|
|
315
|
+
|
|
316
|
+
The browser HUD is intentionally declarative: keys describe what should be
|
|
317
|
+
shown, and helper utilities map those keys to DOM rows and live values. That
|
|
318
|
+
keeps the status panel readable even as telemetry grows.
|
|
319
|
+
|
|
320
|
+
### FlappyStatsRowDescriptor
|
|
321
|
+
|
|
322
|
+
Declarative row descriptor for the runtime stats table.
|
|
323
|
+
|
|
324
|
+
Each row is described as data first so the HUD can be assembled in a stable,
|
|
325
|
+
testable order instead of being hand-written imperatively.
|
|
326
|
+
|
|
327
|
+
### FlappyStatsTableCells
|
|
328
|
+
|
|
329
|
+
Runtime lookup map of stat keys to writable value cells.
|
|
330
|
+
|
|
331
|
+
This acts like a small DOM index so the update loop can mutate the correct
|
|
332
|
+
cells directly without repeatedly querying the document.
|
|
333
|
+
|
|
334
|
+
## browser-entry/browser-entry.render.types.ts
|
|
335
|
+
|
|
336
|
+
### browser-entry.render.types
|
|
337
|
+
|
|
338
|
+
Canvas frame-layout contracts for the Flappy Bird browser demo.
|
|
339
|
+
|
|
340
|
+
These types support the demo's deliberately stylized text-frame chrome: title
|
|
341
|
+
boxes, outer borders, and viewport transforms that make the example feel more
|
|
342
|
+
like an instrument panel than a plain canvas game.
|
|
343
|
+
|
|
344
|
+
### RenderClosedOuterBoxInput
|
|
345
|
+
|
|
346
|
+
Input contract for outer frame rendering helper.
|
|
347
|
+
|
|
348
|
+
The outer frame is the decorative shell that visually separates the playable
|
|
349
|
+
world and telemetry panels from the rest of the page.
|
|
350
|
+
|
|
351
|
+
### RenderStandaloneTitleBoxInput
|
|
352
|
+
|
|
353
|
+
Canvas frame-layout contracts for the Flappy Bird browser demo.
|
|
354
|
+
|
|
355
|
+
These types support the demo's deliberately stylized text-frame chrome: title
|
|
356
|
+
boxes, outer borders, and viewport transforms that make the example feel more
|
|
357
|
+
like an instrument panel than a plain canvas game.
|
|
358
|
+
|
|
359
|
+
### TextFrameMetrics
|
|
360
|
+
|
|
361
|
+
Canvas text-grid metrics used for frame rendering layout helpers.
|
|
362
|
+
|
|
363
|
+
The frame renderer measures glyph and row geometry once, then uses that grid
|
|
364
|
+
to place ASCII-style UI elements consistently.
|
|
365
|
+
|
|
366
|
+
### ViewportInfo
|
|
367
|
+
|
|
368
|
+
Viewport transform values for world-to-canvas rendering.
|
|
369
|
+
|
|
370
|
+
These numbers answer the classic graphics question: how does one unit in the
|
|
371
|
+
simulated world map into the current canvas rectangle?
|
|
372
|
+
|
|
373
|
+
## browser-entry/browser-entry.worker.types.ts
|
|
374
|
+
|
|
375
|
+
### browser-entry.worker.types
|
|
376
|
+
|
|
377
|
+
Worker transport contracts for the Flappy Bird browser runtime.
|
|
378
|
+
|
|
379
|
+
The browser UI and the evolution worker communicate through a deliberately
|
|
380
|
+
explicit message protocol. The goal is educational as well as practical: it
|
|
381
|
+
makes it obvious which values are computed off-thread, which snapshots are
|
|
382
|
+
transferred frame-by-frame, and which events advance the demo state.
|
|
383
|
+
|
|
384
|
+
If you want background reading, the Wikipedia article on "message passing"
|
|
385
|
+
provides a useful conceptual frame for this boundary.
|
|
386
|
+
|
|
387
|
+
### EvolutionGenerationPayload
|
|
388
|
+
|
|
389
|
+
Worker payload describing evolved generation summary values.
|
|
390
|
+
|
|
391
|
+
This is the browser-facing summary of one completed NEAT generation: what
|
|
392
|
+
generation finished, how fit the best genome was, and optionally the best
|
|
393
|
+
network for visualization or playback.
|
|
394
|
+
|
|
395
|
+
### EvolutionGenerationReadyMessage
|
|
396
|
+
|
|
397
|
+
Worker message emitted when a generation has completed evolving.
|
|
398
|
+
|
|
399
|
+
### EvolutionPlaybackStepMessage
|
|
400
|
+
|
|
401
|
+
Worker message carrying one playback step and aggregate markers.
|
|
402
|
+
|
|
403
|
+
Besides the frame snapshot itself, this message also carries summary values
|
|
404
|
+
used by the HUD so the browser can show performance and progress without
|
|
405
|
+
recomputing population-wide statistics on the main thread.
|
|
406
|
+
|
|
407
|
+
### EvolutionPlaybackStepSnapshot
|
|
408
|
+
|
|
409
|
+
Per-frame snapshot received from the worker playback channel.
|
|
410
|
+
|
|
411
|
+
A snapshot combines geometry, packed population state, and lightweight world
|
|
412
|
+
metadata so the browser can render a deterministic frame without rerunning
|
|
413
|
+
the simulation locally.
|
|
414
|
+
|
|
415
|
+
### EvolutionWorkerErrorMessage
|
|
416
|
+
|
|
417
|
+
Worker message emitted for simulation/playback errors.
|
|
418
|
+
|
|
419
|
+
### EvolutionWorkerMessage
|
|
420
|
+
|
|
421
|
+
Union of all supported worker messages consumed by browser entry.
|
|
422
|
+
|
|
423
|
+
A closed union keeps the main-thread message handler explicit and easy to
|
|
424
|
+
audit when the protocol evolves.
|
|
425
|
+
|
|
426
|
+
### PackedPlaybackBirdSnapshot
|
|
427
|
+
|
|
428
|
+
Packed typed-array payload for playback bird snapshot transport.
|
|
429
|
+
|
|
430
|
+
This mirrors the pipe packing strategy so playback can move large population
|
|
431
|
+
snapshots with less allocation pressure than object-per-bird messages.
|
|
432
|
+
|
|
433
|
+
### PackedPlaybackPipeSnapshot
|
|
434
|
+
|
|
435
|
+
Packed typed-array payload for playback pipe snapshot transport.
|
|
436
|
+
|
|
437
|
+
Typed arrays keep frame payloads compact and predictable, which matters when
|
|
438
|
+
the worker is streaming many birds and pipes across animation frames.
|
|
439
|
+
|
|
440
|
+
### PlaybackFrameStats
|
|
441
|
+
|
|
442
|
+
Lightweight per-frame telemetry emitted to HUD update callback.
|
|
443
|
+
|
|
444
|
+
These values are the browser-friendly metrics shown in the live status panel:
|
|
445
|
+
how many birds remain, how far the leader has progressed, and how expensive
|
|
446
|
+
the current playback cadence is.
|
|
447
|
+
|
|
448
|
+
### PopulationBird
|
|
449
|
+
|
|
450
|
+
Renderable bird state snapshot emitted by the playback worker.
|
|
451
|
+
|
|
452
|
+
The browser does not receive full neural state here. It only gets the fields
|
|
453
|
+
needed for presentation and HUD summaries, which keeps per-frame transport
|
|
454
|
+
light.
|
|
455
|
+
|
|
456
|
+
### PopulationPipe
|
|
457
|
+
|
|
458
|
+
Renderable pipe state snapshot emitted by the playback worker.
|
|
459
|
+
|
|
460
|
+
This is the smallest pipe shape the browser renderer needs for one frame:
|
|
461
|
+
horizontal position plus the vertical corridor geometry.
|
|
462
|
+
|
|
463
|
+
### SerializedNetwork
|
|
464
|
+
|
|
465
|
+
Worker transport contracts for the Flappy Bird browser runtime.
|
|
466
|
+
|
|
467
|
+
The browser UI and the evolution worker communicate through a deliberately
|
|
468
|
+
explicit message protocol. The goal is educational as well as practical: it
|
|
469
|
+
makes it obvious which values are computed off-thread, which snapshots are
|
|
470
|
+
transferred frame-by-frame, and which events advance the demo state.
|
|
471
|
+
|
|
472
|
+
If you want background reading, the Wikipedia article on "message passing"
|
|
473
|
+
provides a useful conceptual frame for this boundary.
|
|
474
|
+
|
|
475
|
+
## browser-entry/browser-entry.runtime.types.ts
|
|
476
|
+
|
|
477
|
+
### browser-entry.runtime.types
|
|
478
|
+
|
|
479
|
+
Public lifecycle contracts for the Flappy Bird browser runtime.
|
|
480
|
+
|
|
481
|
+
These types describe how the demo is started, stopped, and exposed on the
|
|
482
|
+
browser `window` object. They are intentionally small because callers should
|
|
483
|
+
control the demo at a high level without depending on private implementation
|
|
484
|
+
details.
|
|
485
|
+
|
|
486
|
+
### FlappyBirdRunHandle
|
|
487
|
+
|
|
488
|
+
Public lifecycle contracts for the Flappy Bird browser runtime.
|
|
489
|
+
|
|
490
|
+
These types describe how the demo is started, stopped, and exposed on the
|
|
491
|
+
browser `window` object. They are intentionally small because callers should
|
|
492
|
+
control the demo at a high level without depending on private implementation
|
|
493
|
+
details.
|
|
494
|
+
|
|
495
|
+
### RuntimeWindow
|
|
496
|
+
|
|
497
|
+
Runtime window contract for the Flappy Bird browser demo.
|
|
498
|
+
|
|
499
|
+
The demo exposes a small debug-friendly surface on `window` so manual browser
|
|
500
|
+
experiments and docs examples can start the simulation without importing the
|
|
501
|
+
bundle as a module.
|
|
502
|
+
|
|
503
|
+
## browser-entry/browser-entry.simulation.types.ts
|
|
504
|
+
|
|
505
|
+
### BrowserDifficultyProfile
|
|
506
|
+
|
|
507
|
+
Difficulty profile consumed by simulation observation helpers.
|
|
508
|
+
|
|
509
|
+
This bundles the three variables that define how demanding a stretch of the
|
|
510
|
+
course is: corridor width, pipe speed, and spawn cadence.
|
|
511
|
+
|
|
512
|
+
### BrowserPopulationBirdLike
|
|
513
|
+
|
|
514
|
+
Simulation-facing browser contracts shared by playback helpers.
|
|
515
|
+
|
|
516
|
+
These types describe the minimum world state the browser needs while it is
|
|
517
|
+
reconstructing, rendering, or summarizing worker-produced frames.
|
|
518
|
+
|
|
519
|
+
### BrowserPopulationPipeLike
|
|
520
|
+
|
|
521
|
+
Pipe shape used by utility observation-vector helpers.
|
|
522
|
+
|
|
523
|
+
### PopulationRenderState
|
|
524
|
+
|
|
525
|
+
Mutable render-state model consumed by the population frame renderer.
|
|
526
|
+
|
|
527
|
+
The playback layer incrementally updates this state as worker snapshots
|
|
528
|
+
arrive, which lets rendering stay deterministic without re-deriving world
|
|
529
|
+
history from scratch each frame.
|
|
530
|
+
|
|
531
|
+
### RngLike
|
|
532
|
+
|
|
533
|
+
Minimal random source contract used by utility random helpers.
|
|
534
|
+
|
|
535
|
+
The narrow contract keeps deterministic spawn utilities portable across
|
|
536
|
+
browser and test contexts.
|
|
537
|
+
|
|
538
|
+
### TrailPoint
|
|
539
|
+
|
|
540
|
+
Trail point used by playback trail rendering cache.
|
|
541
|
+
|
|
542
|
+
A trail point stores where one bird was at one frame so the UI can draw a
|
|
543
|
+
short motion history behind active agents.
|
|
544
|
+
|
|
545
|
+
### TrailState
|
|
546
|
+
|
|
547
|
+
Mutable trail cache keyed by bird index for frame rendering.
|
|
548
|
+
|
|
549
|
+
This cache exists purely for visualization ergonomics; it is not part of the
|
|
550
|
+
worker simulation state.
|
|
551
|
+
|
|
552
|
+
## browser-entry/browser-entry.visualization.types.ts
|
|
553
|
+
|
|
554
|
+
### ColorLegendRow
|
|
555
|
+
|
|
556
|
+
Legend row model for network visualization color legends.
|
|
557
|
+
|
|
558
|
+
Each row labels a numeric interval and the color used to render it.
|
|
559
|
+
|
|
560
|
+
### ColorTier
|
|
561
|
+
|
|
562
|
+
Connection or bias tier used for color mapping ramps.
|
|
563
|
+
|
|
564
|
+
Visualization buckets continuous weights into legible color bands so humans
|
|
565
|
+
can scan sign and magnitude at a glance.
|
|
566
|
+
|
|
567
|
+
### NetworkLegendLayout
|
|
568
|
+
|
|
569
|
+
Precomputed legend panel layout used by visualization renderer.
|
|
570
|
+
|
|
571
|
+
Layout is resolved up front so the draw path can stay focused on painting,
|
|
572
|
+
not recomputing geometry every frame.
|
|
573
|
+
|
|
574
|
+
### NetworkNodeDimensionsLike
|
|
575
|
+
|
|
576
|
+
Pixel dimensions used for network-node rectangle rendering.
|
|
577
|
+
|
|
578
|
+
Keeping node box dimensions explicit makes legend and topology layout easier
|
|
579
|
+
to tune without hidden drawing constants.
|
|
580
|
+
|
|
581
|
+
### NetworkVisualizationHandle
|
|
582
|
+
|
|
583
|
+
Network-visualization contracts for the Flappy Bird browser demo.
|
|
584
|
+
|
|
585
|
+
One of the educational goals of the example is to let people watch evolved
|
|
586
|
+
controllers as structures, not just as scores. These types describe the
|
|
587
|
+
lightweight shapes used by the architecture panel so rendering logic can stay
|
|
588
|
+
decoupled from the full internal network implementation.
|
|
589
|
+
|
|
590
|
+
### PositionedNetworkNodeLike
|
|
591
|
+
|
|
592
|
+
Positioned node instance used by network visualization drawing.
|
|
593
|
+
|
|
594
|
+
Layout and rendering are split: first a node is assigned screen coordinates,
|
|
595
|
+
then the renderer paints it.
|
|
596
|
+
|
|
597
|
+
### VisualNetworkConnectionLike
|
|
598
|
+
|
|
599
|
+
Lightweight connection shape used by network visualization drawing.
|
|
600
|
+
|
|
601
|
+
The renderer only needs connectivity, weight, and enabled state, not the full
|
|
602
|
+
training-time behavior of a connection object.
|
|
603
|
+
|
|
604
|
+
### VisualNetworkNodeLike
|
|
605
|
+
|
|
606
|
+
Lightweight node shape used by network visualization drawing.
|
|
607
|
+
|
|
608
|
+
This shape keeps the renderer independent from the concrete Network class
|
|
609
|
+
while still exposing the semantic fields that matter visually.
|
|
610
|
+
|
|
611
|
+
## browser-entry/browser-entry.ts
|
|
612
|
+
|
|
613
|
+
### browser-entry
|
|
614
|
+
|
|
615
|
+
Browser demo public entry for the Flappy Bird example.
|
|
616
|
+
|
|
617
|
+
This boundary is the hand-off point between library consumers and the demo's
|
|
618
|
+
browser runtime. Calling `start` boots the canvas UI, worker channel, HUD,
|
|
619
|
+
and playback loop without exposing all of that internal orchestration as part
|
|
620
|
+
of the public API.
|
|
621
|
+
|
|
622
|
+
In other words, this file is intentionally tiny because it acts like a clean
|
|
623
|
+
facade over a much larger interactive system.
|
|
624
|
+
|
|
625
|
+
### FlappyBirdRunHandle
|
|
626
|
+
|
|
627
|
+
Public lifecycle contracts for the Flappy Bird browser runtime.
|
|
628
|
+
|
|
629
|
+
These types describe how the demo is started, stopped, and exposed on the
|
|
630
|
+
browser `window` object. They are intentionally small because callers should
|
|
631
|
+
control the demo at a high level without depending on private implementation
|
|
632
|
+
details.
|
|
633
|
+
|
|
634
|
+
### start
|
|
635
|
+
|
|
636
|
+
`(container: import("test/examples/flappy_bird/browser-entry/runtime/runtime.types").RuntimeContainerTarget) => Promise<import("test/examples/flappy_bird/browser-entry/browser-entry.runtime.types").FlappyBirdRunHandle>`
|
|
637
|
+
|
|
638
|
+
## browser-entry/browser-entry.host.utils.ts
|
|
639
|
+
|
|
640
|
+
### createCanvasHostInternal
|
|
641
|
+
|
|
642
|
+
`(containerElement: HTMLElement) => import("test/examples/flappy_bird/browser-entry/host/host.types").CanvasHostResult`
|
|
643
|
+
|
|
644
|
+
Builds the browser demo host tree and returns rendering handles.
|
|
645
|
+
|
|
646
|
+
The orchestration is deliberately step-shaped: clear old DOM, build layout,
|
|
647
|
+
create canvases, wire resize behavior, render placeholders, then return the
|
|
648
|
+
handles the runtime will mutate during execution.
|
|
649
|
+
|
|
650
|
+
Parameters:
|
|
651
|
+
- `containerElement` - - Root host container.
|
|
652
|
+
|
|
653
|
+
Returns: Canvas handles, stats cells and network render callback.
|
|
654
|
+
|
|
655
|
+
### updateStatsTableValues
|
|
656
|
+
|
|
657
|
+
`(statsValueByKey: Partial<Record<import("test/examples/flappy_bird/browser-entry/browser-entry.stats.types").FlappyStatsKey, HTMLTableCellElement>>, partialValues: Partial<Record<import("test/examples/flappy_bird/browser-entry/browser-entry.stats.types").FlappyStatsKey, string>>) => void`
|
|
658
|
+
|
|
659
|
+
Applies partial stat updates to the rendered stats table.
|
|
660
|
+
|
|
661
|
+
The runtime writes HUD values incrementally, so the host exposes a narrow
|
|
662
|
+
partial-update helper rather than requiring full table redraws.
|
|
663
|
+
|
|
664
|
+
Parameters:
|
|
665
|
+
- `statsValueByKey` - - Lookup of stat keys to value cells.
|
|
666
|
+
- `partialValues` - - Subset of values to write this tick.
|
|
667
|
+
|
|
668
|
+
Returns: Nothing.
|
|
669
|
+
|
|
670
|
+
## browser-entry/browser-entry.math.utils.ts
|
|
671
|
+
|
|
672
|
+
### applyAlphaToHexColor
|
|
673
|
+
|
|
674
|
+
`(hexColor: string, alphaValue: number) => string`
|
|
675
|
+
|
|
676
|
+
Converts a six-digit hex color to rgba with the requested alpha.
|
|
677
|
+
|
|
678
|
+
Parameters:
|
|
679
|
+
- `hexColor` - - Color in `#RRGGBB` form.
|
|
680
|
+
- `alphaValue` - - Alpha value to apply.
|
|
681
|
+
|
|
682
|
+
Returns: rgba color string, or original value when not 6-digit hex.
|
|
683
|
+
|
|
684
|
+
### clamp
|
|
685
|
+
|
|
686
|
+
`(value: number, min: number, max: number) => number`
|
|
687
|
+
|
|
688
|
+
Clamps a numeric value to the inclusive `[min, max]` interval.
|
|
689
|
+
|
|
690
|
+
Parameters:
|
|
691
|
+
- `value` - - Candidate value.
|
|
692
|
+
- `min` - - Inclusive lower bound.
|
|
693
|
+
- `max` - - Inclusive upper bound.
|
|
694
|
+
|
|
695
|
+
Returns: Clamped value.
|
|
696
|
+
|
|
697
|
+
### clamp01
|
|
698
|
+
|
|
699
|
+
`(value: number) => number`
|
|
700
|
+
|
|
701
|
+
Clamps a numeric value to the inclusive `[0, 1]` interval.
|
|
702
|
+
|
|
703
|
+
Parameters:
|
|
704
|
+
- `value` - - Candidate value.
|
|
705
|
+
|
|
706
|
+
Returns: Value clamped between 0 and 1.
|
|
707
|
+
|
|
708
|
+
### interpolateValue
|
|
709
|
+
|
|
710
|
+
`(startValue: number, endValue: number, progress: number) => number`
|
|
711
|
+
|
|
712
|
+
Linear interpolation helper.
|
|
713
|
+
|
|
714
|
+
Parameters:
|
|
715
|
+
- `startValue` - - Start value at progress `0`.
|
|
716
|
+
- `endValue` - - End value at progress `1`.
|
|
717
|
+
- `progress` - - Normalized interpolation progress.
|
|
718
|
+
|
|
719
|
+
Returns: Interpolated value.
|
|
720
|
+
|
|
721
|
+
## browser-entry/browser-entry.spawn.utils.ts
|
|
722
|
+
|
|
723
|
+
### createBirdColor
|
|
724
|
+
|
|
725
|
+
`(birdIndex: number, totalBirds: number) => string`
|
|
726
|
+
|
|
727
|
+
Resolves deterministic bird color from palette index.
|
|
728
|
+
|
|
729
|
+
Parameters:
|
|
730
|
+
- `birdIndex` - - Bird index in current population.
|
|
731
|
+
- `totalBirds` - - Population size.
|
|
732
|
+
|
|
733
|
+
Returns: Hex color string.
|
|
734
|
+
|
|
735
|
+
### resolveGapCenterUpperBoundYPx
|
|
736
|
+
|
|
737
|
+
`(worldHeightPx: number) => number`
|
|
738
|
+
|
|
739
|
+
Resolves the exclusive upper bound used for gap-center sampling.
|
|
740
|
+
|
|
741
|
+
Educational note:
|
|
742
|
+
We cap dynamic viewport-derived bounds at the shared simulation maximum to
|
|
743
|
+
keep browser playback distribution aligned with trainer/evaluation defaults,
|
|
744
|
+
while still supporting smaller world heights.
|
|
745
|
+
|
|
746
|
+
Parameters:
|
|
747
|
+
- `worldHeightPx` - - Current world height.
|
|
748
|
+
|
|
749
|
+
Returns: Exclusive upper bound for `nextInt(minInclusive, maxExclusive)`.
|
|
750
|
+
|
|
751
|
+
### resolveNextSpawnGapCenterY
|
|
752
|
+
|
|
753
|
+
`(previousGapCenterYPx: number, rng: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").RngLike, worldHeightPx: number) => number`
|
|
754
|
+
|
|
755
|
+
Resolves next gap center with bounded per-pipe delta.
|
|
756
|
+
|
|
757
|
+
Parameters:
|
|
758
|
+
- `previousGapCenterYPx` - - Previous spawn gap center.
|
|
759
|
+
- `rng` - - Deterministic RNG.
|
|
760
|
+
- `worldHeightPx` - - World height used to clamp candidate gap centers.
|
|
761
|
+
|
|
762
|
+
Returns: Next gap center y-position.
|
|
763
|
+
|
|
764
|
+
### resolveNextSpawnGapSize
|
|
765
|
+
|
|
766
|
+
`(previousSpawnGapPx: number | undefined, difficultyProfile: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserDifficultyProfile, rng: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").RngLike) => number`
|
|
767
|
+
|
|
768
|
+
Resolves next spawn gap size using progressive shrink and jitter.
|
|
769
|
+
|
|
770
|
+
Parameters:
|
|
771
|
+
- `previousSpawnGapPx` - - Previous spawn gap size.
|
|
772
|
+
- `difficultyProfile` - - Active difficulty profile.
|
|
773
|
+
- `rng` - - Deterministic RNG.
|
|
774
|
+
|
|
775
|
+
Returns: Next spawn gap size.
|
|
776
|
+
|
|
777
|
+
### resolveNextSpawnIntervalFrames
|
|
778
|
+
|
|
779
|
+
`(previousSpawnIntervalFrames: number | undefined, difficultyProfile: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserDifficultyProfile) => number`
|
|
780
|
+
|
|
781
|
+
Resolves next spawn interval using progressive shrink.
|
|
782
|
+
|
|
783
|
+
Parameters:
|
|
784
|
+
- `previousSpawnIntervalFrames` - - Previous spawn interval.
|
|
785
|
+
- `difficultyProfile` - - Active difficulty profile.
|
|
786
|
+
|
|
787
|
+
Returns: Next spawn interval in frames.
|
|
788
|
+
|
|
789
|
+
### sampleGapCenterY
|
|
790
|
+
|
|
791
|
+
`(rng: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").RngLike, worldHeightPx: number) => number`
|
|
792
|
+
|
|
793
|
+
Samples a random gap center y-position.
|
|
794
|
+
|
|
795
|
+
Parameters:
|
|
796
|
+
- `rng` - - Deterministic RNG.
|
|
797
|
+
- `worldHeightPx` - - World height used to derive valid gap-center bounds.
|
|
798
|
+
|
|
799
|
+
Returns: Sampled y-position.
|
|
800
|
+
|
|
801
|
+
## browser-entry/browser-entry.stats.utils.ts
|
|
802
|
+
|
|
803
|
+
### createFlappyStatsTableRows
|
|
804
|
+
|
|
805
|
+
`(input: import("test/examples/flappy_bird/browser-entry/browser-entry.stats.types").CreateFlappyStatsTableRowsInput) => Partial<Record<import("test/examples/flappy_bird/browser-entry/browser-entry.stats.types").FlappyStatsKey, HTMLTableCellElement>>`
|
|
806
|
+
|
|
807
|
+
Builds stats table rows and returns value-cell lookup by key.
|
|
808
|
+
|
|
809
|
+
Parameters:
|
|
810
|
+
- `input` - - Table construction inputs.
|
|
811
|
+
|
|
812
|
+
Returns: Mapping from stat key to value cell.
|
|
813
|
+
|
|
814
|
+
### formatArchitectureStatsValue
|
|
815
|
+
|
|
816
|
+
`(architectureValue: string) => string`
|
|
817
|
+
|
|
818
|
+
Splits architecture suffix onto a second line for readability in the stats table.
|
|
819
|
+
|
|
820
|
+
Parameters:
|
|
821
|
+
- `architectureValue` - - Full architecture label.
|
|
822
|
+
|
|
823
|
+
Returns: Line-broken label value.
|
|
824
|
+
|
|
825
|
+
## browser-entry/browser-entry.playback.utils.ts
|
|
826
|
+
|
|
827
|
+
### browser-entry.playback.utils
|
|
828
|
+
|
|
829
|
+
Compatibility facade for the browser-entry playback boundary.
|
|
830
|
+
|
|
831
|
+
Older imports still reach playback through this file, while the real
|
|
832
|
+
implementation now lives in the dedicated playback folder. Keeping the facade
|
|
833
|
+
explicit preserves stable imports while letting the playback subsystem grow
|
|
834
|
+
into a clearer module boundary.
|
|
835
|
+
|
|
836
|
+
### animatePopulationEpisodeInternal
|
|
837
|
+
|
|
838
|
+
`(canvas: HTMLCanvasElement, context: CanvasRenderingContext2D, evolutionWorker: Worker, onFrameStats: (stats: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").PlaybackFrameStats) => void) => Promise<import("test/examples/flappy_bird/browser-entry/playback/playback.orchestration.types").PlaybackEpisodeSummary>`
|
|
839
|
+
|
|
840
|
+
Internal playback orchestration entry retained for compatibility re-exports.
|
|
841
|
+
|
|
842
|
+
The implementation is shared with the public entry so legacy imports and the
|
|
843
|
+
newer folderized surface behave identically.
|
|
844
|
+
|
|
845
|
+
Parameters:
|
|
846
|
+
- `canvas` - - Target playback canvas.
|
|
847
|
+
- `context` - - Canvas 2D context.
|
|
848
|
+
- `evolutionWorker` - - Worker owning playback simulation state.
|
|
849
|
+
- `onFrameStats` - - Callback receiving per-frame playback telemetry.
|
|
850
|
+
|
|
851
|
+
Returns: Aggregate playback summary for the current episode.
|
|
852
|
+
|
|
853
|
+
## browser-entry/browser-entry.viewport.utils.ts
|
|
854
|
+
|
|
855
|
+
### resolvePipeSpawnXPx
|
|
856
|
+
|
|
857
|
+
`(visibleWorldWidthPx: number) => number`
|
|
858
|
+
|
|
859
|
+
Resolves the world-space x spawn position for new pipes.
|
|
860
|
+
|
|
861
|
+
Parameters:
|
|
862
|
+
- `visibleWorldWidthPx` - - Current visible world width.
|
|
863
|
+
|
|
864
|
+
Returns: Spawn x-position.
|
|
865
|
+
|
|
866
|
+
### resolveVisibleWorldHeightPx
|
|
867
|
+
|
|
868
|
+
`(canvas: HTMLCanvasElement) => number`
|
|
869
|
+
|
|
870
|
+
Resolves visible world height represented by the current canvas.
|
|
871
|
+
|
|
872
|
+
Educational note:
|
|
873
|
+
The current viewport model uses a 1:1 mapping between canvas pixels and
|
|
874
|
+
world-space pixels, so visible height is the canvas height directly.
|
|
875
|
+
|
|
876
|
+
Parameters:
|
|
877
|
+
- `canvas` - - Playback canvas.
|
|
878
|
+
|
|
879
|
+
Returns: Visible height in world-space pixels.
|
|
880
|
+
|
|
881
|
+
### resolveVisibleWorldWidthPx
|
|
882
|
+
|
|
883
|
+
`(canvas: HTMLCanvasElement) => number`
|
|
884
|
+
|
|
885
|
+
Resolves visible world width represented by the current canvas.
|
|
886
|
+
|
|
887
|
+
Educational note:
|
|
888
|
+
The current viewport model uses a 1:1 mapping between canvas pixels and
|
|
889
|
+
world-space pixels, so visible width is the canvas width directly.
|
|
890
|
+
|
|
891
|
+
Parameters:
|
|
892
|
+
- `canvas` - - Playback canvas.
|
|
893
|
+
|
|
894
|
+
Returns: Visible width in world-space pixels.
|
|
895
|
+
|
|
896
|
+
### resolveWorldViewport
|
|
897
|
+
|
|
898
|
+
`(canvas: HTMLCanvasElement) => import("test/examples/flappy_bird/browser-entry/browser-entry.render.types").ViewportInfo`
|
|
899
|
+
|
|
900
|
+
Resolves world viewport transformation based on canvas size.
|
|
901
|
+
|
|
902
|
+
Parameters:
|
|
903
|
+
- `canvas` - - Playback canvas.
|
|
904
|
+
|
|
905
|
+
Returns: Viewport scale and offsets.
|
|
906
|
+
|
|
907
|
+
## browser-entry/browser-entry.telemetry.utils.ts
|
|
908
|
+
|
|
909
|
+
### createMinorGcObserver
|
|
910
|
+
|
|
911
|
+
`(minorGcTimestampsMs: number[]) => PerformanceObserver | undefined`
|
|
912
|
+
|
|
913
|
+
Creates a PerformanceObserver that tracks minor GC events when supported.
|
|
914
|
+
|
|
915
|
+
Parameters:
|
|
916
|
+
- `minorGcTimestampsMs` - - Mutable minor-GC timestamp buffer.
|
|
917
|
+
|
|
918
|
+
Returns: Observer when supported; otherwise `undefined`.
|
|
919
|
+
|
|
920
|
+
### resolveEventsPerMinute
|
|
921
|
+
|
|
922
|
+
`(samples: number[]) => number`
|
|
923
|
+
|
|
924
|
+
Resolves events per minute from the latest sample window.
|
|
925
|
+
|
|
926
|
+
Parameters:
|
|
927
|
+
- `samples` - - Event timestamps.
|
|
928
|
+
|
|
929
|
+
Returns: Events-per-minute estimate.
|
|
930
|
+
|
|
931
|
+
### resolveHudUpdatesPerSecond
|
|
932
|
+
|
|
933
|
+
`(samples: number[]) => number`
|
|
934
|
+
|
|
935
|
+
Resolves HUD updates per second from the latest sample window.
|
|
936
|
+
|
|
937
|
+
Parameters:
|
|
938
|
+
- `samples` - - HUD update timestamps.
|
|
939
|
+
|
|
940
|
+
Returns: Updates-per-second estimate.
|
|
941
|
+
|
|
942
|
+
### trimSamplesToWindow
|
|
943
|
+
|
|
944
|
+
`(samples: number[], windowMs: number, nowMs: number) => void`
|
|
945
|
+
|
|
946
|
+
Trims timestamp samples to a sliding time window.
|
|
947
|
+
|
|
948
|
+
Parameters:
|
|
949
|
+
- `samples` - - Mutable timestamp buffer.
|
|
950
|
+
- `windowMs` - - Window width in milliseconds.
|
|
951
|
+
- `nowMs` - - Current timestamp.
|
|
952
|
+
|
|
953
|
+
Returns: Nothing.
|
|
954
|
+
|
|
955
|
+
## browser-entry/browser-entry.text-frame.utils.ts
|
|
956
|
+
|
|
957
|
+
### buildCenteredTitleBoxLines
|
|
958
|
+
|
|
959
|
+
`(centeredColumns: number, titleText: string) => string[]`
|
|
960
|
+
|
|
961
|
+
Builds an ASCII centered title box.
|
|
962
|
+
|
|
963
|
+
Parameters:
|
|
964
|
+
- `centeredColumns` - - Available centered column count.
|
|
965
|
+
- `titleText` - - Title text.
|
|
966
|
+
|
|
967
|
+
Returns: Three-row title box.
|
|
968
|
+
|
|
969
|
+
### buildOuterBoxLines
|
|
970
|
+
|
|
971
|
+
`(centeredColumns: number, totalRows: number) => string[]`
|
|
972
|
+
|
|
973
|
+
Builds an ASCII outer frame with closed borders.
|
|
974
|
+
|
|
975
|
+
Parameters:
|
|
976
|
+
- `centeredColumns` - - Centered column count.
|
|
977
|
+
- `totalRows` - - Total row count.
|
|
978
|
+
|
|
979
|
+
Returns: Frame lines.
|
|
980
|
+
|
|
981
|
+
### renderClosedOuterBox
|
|
982
|
+
|
|
983
|
+
`(input: import("test/examples/flappy_bird/browser-entry/browser-entry.render.types").RenderClosedOuterBoxInput) => void`
|
|
984
|
+
|
|
985
|
+
Renders a complete closed outer glyph box.
|
|
986
|
+
|
|
987
|
+
Parameters:
|
|
988
|
+
- `input` - - Rendering input object.
|
|
989
|
+
|
|
990
|
+
Returns: Nothing.
|
|
991
|
+
|
|
992
|
+
### renderStandaloneTitleBox
|
|
993
|
+
|
|
994
|
+
`(input: import("test/examples/flappy_bird/browser-entry/browser-entry.render.types").RenderStandaloneTitleBoxInput) => void`
|
|
995
|
+
|
|
996
|
+
Renders only the centered title box.
|
|
997
|
+
|
|
998
|
+
Parameters:
|
|
999
|
+
- `input` - - Rendering input object.
|
|
1000
|
+
|
|
1001
|
+
Returns: Nothing.
|
|
1002
|
+
|
|
1003
|
+
### resolveGlyphWidthPx
|
|
1004
|
+
|
|
1005
|
+
`(context: CanvasRenderingContext2D) => number`
|
|
1006
|
+
|
|
1007
|
+
Resolves a stable glyph width used for frame-column math.
|
|
1008
|
+
|
|
1009
|
+
Parameters:
|
|
1010
|
+
- `context` - - Rendering context used to measure text.
|
|
1011
|
+
|
|
1012
|
+
Returns: Floored glyph width clamped to a minimum pixel value.
|
|
1013
|
+
|
|
1014
|
+
### resolveTextFrameMetrics
|
|
1015
|
+
|
|
1016
|
+
`(frameWidthPx: number, frameHeightPx: number, glyphWidthPx: number, rowHeightPx: number, minimumColumns: number) => import("test/examples/flappy_bird/browser-entry/browser-entry.render.types").TextFrameMetrics`
|
|
1017
|
+
|
|
1018
|
+
Resolves core text-frame metrics for glyph box rendering.
|
|
1019
|
+
|
|
1020
|
+
Parameters:
|
|
1021
|
+
- `frameWidthPx` - - Frame width.
|
|
1022
|
+
- `frameHeightPx` - - Frame height.
|
|
1023
|
+
- `glyphWidthPx` - - Measured glyph width.
|
|
1024
|
+
- `rowHeightPx` - - Glyph row height.
|
|
1025
|
+
- `minimumColumns` - - Minimum column count.
|
|
1026
|
+
|
|
1027
|
+
Returns: Text frame metrics.
|
|
1028
|
+
|
|
1029
|
+
## browser-entry/browser-entry.observation.utils.ts
|
|
1030
|
+
|
|
1031
|
+
### commitObservationMemoryStep
|
|
1032
|
+
|
|
1033
|
+
`(observationMemoryState: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState, observationFeatures: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures, shouldFlap: boolean) => void`
|
|
1034
|
+
|
|
1035
|
+
Commits one browser decision step into temporal memory.
|
|
1036
|
+
|
|
1037
|
+
Parameters:
|
|
1038
|
+
- `observationMemoryState` - - Mutable memory state for one bird.
|
|
1039
|
+
- `observationFeatures` - - Structured features used for this decision.
|
|
1040
|
+
- `shouldFlap` - - Action selected by the policy.
|
|
1041
|
+
|
|
1042
|
+
Returns: Nothing.
|
|
1043
|
+
|
|
1044
|
+
### hasAliveBirds
|
|
1045
|
+
|
|
1046
|
+
`(birds: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationBirdLike[]) => boolean`
|
|
1047
|
+
|
|
1048
|
+
Checks whether at least one bird remains alive.
|
|
1049
|
+
|
|
1050
|
+
Parameters:
|
|
1051
|
+
- `birds` - - Population birds.
|
|
1052
|
+
|
|
1053
|
+
Returns: True when any bird is alive.
|
|
1054
|
+
|
|
1055
|
+
### resolveAliveBirdCount
|
|
1056
|
+
|
|
1057
|
+
`(birds: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationBirdLike[]) => number`
|
|
1058
|
+
|
|
1059
|
+
Counts birds that are still alive.
|
|
1060
|
+
|
|
1061
|
+
Parameters:
|
|
1062
|
+
- `birds` - - Population birds.
|
|
1063
|
+
|
|
1064
|
+
Returns: Alive bird count.
|
|
1065
|
+
|
|
1066
|
+
### resolveFlapDecision
|
|
1067
|
+
|
|
1068
|
+
`(rawOutputs: unknown) => boolean`
|
|
1069
|
+
|
|
1070
|
+
Resolves flap/no-flap decision from network outputs.
|
|
1071
|
+
|
|
1072
|
+
Parameters:
|
|
1073
|
+
- `rawOutputs` - - Activation output payload.
|
|
1074
|
+
|
|
1075
|
+
Returns: True when flap should trigger.
|
|
1076
|
+
|
|
1077
|
+
### resolveFramePrimaryWinnerIndex
|
|
1078
|
+
|
|
1079
|
+
`(birds: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationBirdLike[], includeAliveOnly: boolean) => number`
|
|
1080
|
+
|
|
1081
|
+
Resolves winner index for current frame.
|
|
1082
|
+
|
|
1083
|
+
Parameters:
|
|
1084
|
+
- `birds` - - Population birds.
|
|
1085
|
+
- `includeAliveOnly` - - When true, ignores dead birds.
|
|
1086
|
+
|
|
1087
|
+
Returns: Winner index, or `-1` when unavailable.
|
|
1088
|
+
|
|
1089
|
+
### resolveLeaderPipesPassed
|
|
1090
|
+
|
|
1091
|
+
`(birds: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationBirdLike[]) => number`
|
|
1092
|
+
|
|
1093
|
+
Resolves leading pipes-passed score in the population.
|
|
1094
|
+
|
|
1095
|
+
Parameters:
|
|
1096
|
+
- `birds` - - Population birds.
|
|
1097
|
+
|
|
1098
|
+
Returns: Maximum pipes passed.
|
|
1099
|
+
|
|
1100
|
+
### resolveObservationVector
|
|
1101
|
+
|
|
1102
|
+
`(birdYPx: number, velocityYPxPerFrame: number, pipes: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationPipeLike[], visibleWorldWidthPx: number, worldHeightPx: number, difficultyProfile: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserDifficultyProfile, activeSpawnIntervalFrames: number, observationMemoryState: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState) => { observationVector: number[]; observationFeatures: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures; }`
|
|
1103
|
+
|
|
1104
|
+
Builds the normalized observation vector consumed by bird networks.
|
|
1105
|
+
|
|
1106
|
+
Parameters:
|
|
1107
|
+
- `birdYPx` - - Bird y position.
|
|
1108
|
+
- `velocityYPxPerFrame` - - Bird vertical velocity.
|
|
1109
|
+
- `pipes` - - Current pipe list.
|
|
1110
|
+
- `visibleWorldWidthPx` - - Current visible world width.
|
|
1111
|
+
- `worldHeightPx` - - Current world height used for normalization and bounds.
|
|
1112
|
+
- `difficultyProfile` - - Active difficulty profile.
|
|
1113
|
+
- `activeSpawnIntervalFrames` - - Current spawn interval.
|
|
1114
|
+
- `observationMemoryState` - - Temporal memory state for recurrent observation features.
|
|
1115
|
+
|
|
1116
|
+
Returns: Ordered normalized observation vector.
|
|
1117
|
+
|
|
1118
|
+
### resolveUpcomingPipes
|
|
1119
|
+
|
|
1120
|
+
`(pipes: import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationPipeLike[]) => [import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationPipeLike | undefined, import("test/examples/flappy_bird/browser-entry/browser-entry.simulation.types").BrowserPopulationPipeLike | undefined]`
|
|
1121
|
+
|
|
1122
|
+
Resolves the next two upcoming pipes in front of the bird.
|
|
1123
|
+
|
|
1124
|
+
Parameters:
|
|
1125
|
+
- `pipes` - - Current pipe list.
|
|
1126
|
+
|
|
1127
|
+
Returns: Tuple of first and second upcoming pipes.
|
|
1128
|
+
|
|
1129
|
+
## browser-entry/browser-entry.network-view.utils.ts
|
|
1130
|
+
|
|
1131
|
+
### browser-entry.network-view.utils
|
|
1132
|
+
|
|
1133
|
+
Compatibility facade for browser-entry network-view helpers.
|
|
1134
|
+
|
|
1135
|
+
Legacy imports still use this file while the network-view subsystem is split
|
|
1136
|
+
into smaller topology, layout, label, and drawing modules.
|
|
1137
|
+
|
|
1138
|
+
### drawNetworkVisualization
|
|
1139
|
+
|
|
1140
|
+
`(context: CanvasRenderingContext2D, network: import("src/architecture/network").default | undefined, inputSize: number, outputSize: number) => void`
|
|
1141
|
+
|
|
1142
|
+
Draws a complete, layer-based visualization of the active network.
|
|
1143
|
+
|
|
1144
|
+
Conceptually, this is the main fold from network object to finished panel:
|
|
1145
|
+
resolve scene state, compute layout, paint the graph, then paint overlays.
|
|
1146
|
+
|
|
1147
|
+
Parameters:
|
|
1148
|
+
- `context` - - Canvas 2D drawing context.
|
|
1149
|
+
- `network` - - Network to visualize.
|
|
1150
|
+
- `inputSize` - - Input-layer size.
|
|
1151
|
+
- `outputSize` - - Output-layer size.
|
|
1152
|
+
|
|
1153
|
+
Returns: Nothing.
|
|
1154
|
+
|
|
1155
|
+
### resolveNetworkArchitectureLabel
|
|
1156
|
+
|
|
1157
|
+
`(network: import("src/architecture/network").default | undefined, inputSize: number, outputSize: number) => string`
|
|
1158
|
+
|
|
1159
|
+
Resolves compact architecture label text for headers and HUD rows.
|
|
1160
|
+
|
|
1161
|
+
The label compresses the active network into a short human-readable summary:
|
|
1162
|
+
input size, hidden-layer structure, output size, and graph size metadata.
|
|
1163
|
+
|
|
1164
|
+
Parameters:
|
|
1165
|
+
- `network` - - Network to describe.
|
|
1166
|
+
- `inputSize` - - Configured input size.
|
|
1167
|
+
- `outputSize` - - Configured output size.
|
|
1168
|
+
|
|
1169
|
+
Returns: Readable architecture label.
|
|
1170
|
+
|
|
1171
|
+
### resolveNetworkVisualizationHeightPx
|
|
1172
|
+
|
|
1173
|
+
`(network: import("src/architecture/network").default | undefined, inputSize: number, outputSize: number) => number`
|
|
1174
|
+
|
|
1175
|
+
Resolves responsive visualization canvas height from network shape.
|
|
1176
|
+
|
|
1177
|
+
Dense or deeper networks need more vertical room to stay readable, so panel
|
|
1178
|
+
height is driven by topology rather than fixed to a single constant.
|
|
1179
|
+
|
|
1180
|
+
Parameters:
|
|
1181
|
+
- `network` - - Network to visualize.
|
|
1182
|
+
- `inputSize` - - Input-layer size.
|
|
1183
|
+
- `outputSize` - - Output-layer size.
|
|
1184
|
+
|
|
1185
|
+
Returns: Recommended height in pixels.
|
|
1186
|
+
|
|
1187
|
+
### resolveNetworkVisualizationLayers
|
|
1188
|
+
|
|
1189
|
+
`(network: import("src/architecture/network").default | undefined, inputSize: number, outputSize: number) => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").VisualNetworkNodeLike[][]`
|
|
1190
|
+
|
|
1191
|
+
Topology resolution helpers for the browser network view.
|
|
1192
|
+
|
|
1193
|
+
These helpers answer a key visualization question: how should the current
|
|
1194
|
+
network be partitioned into ordered layers so layout and architecture labels
|
|
1195
|
+
stay meaningful even when some metadata is missing?
|
|
1196
|
+
|
|
1197
|
+
## browser-entry/browser-entry.visualization.utils.ts
|
|
1198
|
+
|
|
1199
|
+
### browser-entry.visualization.utils
|
|
1200
|
+
|
|
1201
|
+
Compatibility facade for browser-entry network visualization helpers.
|
|
1202
|
+
|
|
1203
|
+
Legacy imports still flow through this file while the visualization subsystem
|
|
1204
|
+
is organized into smaller, clearer modules under the dedicated folder.
|
|
1205
|
+
|
|
1206
|
+
### createColorLegendRows
|
|
1207
|
+
|
|
1208
|
+
`(scale: import("test/examples/flappy_bird/browser-entry/visualization/visualization.types").DynamicColorScale, symbol: "w" | "b") => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").ColorLegendRow[]`
|
|
1209
|
+
|
|
1210
|
+
Legend-layout helpers for network visualization.
|
|
1211
|
+
|
|
1212
|
+
The legend explains how colors map back to numeric weights and biases. These
|
|
1213
|
+
helpers turn color scales into labeled rows and place the legend so it stays
|
|
1214
|
+
readable across different canvas sizes.
|
|
1215
|
+
|
|
1216
|
+
### createLogDivergingColorTiers
|
|
1217
|
+
|
|
1218
|
+
`(input: { maxAbsValue: number; centerBlueThreshold: number; negativePalette: readonly string[]; centerBluePalette: readonly string[]; positivePalette: readonly string[]; logarithmicSteepness: number; edgeStartAbsValue?: number | undefined; edgeTierCount?: number | undefined; }) => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").ColorTier[]`
|
|
1219
|
+
|
|
1220
|
+
Color-scale synthesis helpers for network visualization.
|
|
1221
|
+
|
|
1222
|
+
These utilities convert raw connection weights and node biases into tiered
|
|
1223
|
+
neon color scales. The goal is not photorealism; it is interpretability. A
|
|
1224
|
+
reader should be able to glance at the network panel and see where strong
|
|
1225
|
+
positive, strong negative, and near-zero values live.
|
|
1226
|
+
|
|
1227
|
+
### drawBiasNodesLayer
|
|
1228
|
+
|
|
1229
|
+
`(context: CanvasRenderingContext2D, positionedNodes: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").PositionedNetworkNodeLike[], nodeDimensions: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").NetworkNodeDimensionsLike, biasScale: import("test/examples/flappy_bird/browser-entry/visualization/visualization.types").DynamicColorScale) => void`
|
|
1230
|
+
|
|
1231
|
+
Draws all network nodes with bias labels.
|
|
1232
|
+
|
|
1233
|
+
The node layer pairs each rectangle with a compact bias label so the panel can
|
|
1234
|
+
show both topology and a lightweight hint of parameter state.
|
|
1235
|
+
|
|
1236
|
+
Parameters:
|
|
1237
|
+
- `context` - - Render context.
|
|
1238
|
+
- `positionedNodes` - - Positioned nodes.
|
|
1239
|
+
- `nodeDimensions` - - Node dimensions.
|
|
1240
|
+
- `biasScale` - - Dynamic bias color scale.
|
|
1241
|
+
|
|
1242
|
+
Returns: Nothing.
|
|
1243
|
+
|
|
1244
|
+
### drawNetworkColorLegend
|
|
1245
|
+
|
|
1246
|
+
`(context: CanvasRenderingContext2D, architectureLabel: string, colorScales: import("test/examples/flappy_bird/browser-entry/visualization/visualization.types").NetworkVisualizationColorScales) => void`
|
|
1247
|
+
|
|
1248
|
+
Draws the color legend for connections and node bias values.
|
|
1249
|
+
|
|
1250
|
+
This legend is what turns the panel from "colorful art" into an interpretable
|
|
1251
|
+
instrument: it tells the viewer what each weight and bias color actually
|
|
1252
|
+
means numerically.
|
|
1253
|
+
|
|
1254
|
+
Parameters:
|
|
1255
|
+
- `context` - - Render context.
|
|
1256
|
+
- `architectureLabel` - - Compact architecture description.
|
|
1257
|
+
- `colorScales` - - Connection and bias color scales.
|
|
1258
|
+
|
|
1259
|
+
Returns: Nothing.
|
|
1260
|
+
|
|
1261
|
+
### drawNetworkVisualizationHeader
|
|
1262
|
+
|
|
1263
|
+
`(context: CanvasRenderingContext2D, architectureLabel: string) => void`
|
|
1264
|
+
|
|
1265
|
+
Draws network architecture header text.
|
|
1266
|
+
|
|
1267
|
+
The header gives viewers a compact architecture summary before they inspect
|
|
1268
|
+
individual nodes and edges.
|
|
1269
|
+
|
|
1270
|
+
Parameters:
|
|
1271
|
+
- `context` - - Render context.
|
|
1272
|
+
- `architectureLabel` - - Header label.
|
|
1273
|
+
|
|
1274
|
+
Returns: Nothing.
|
|
1275
|
+
|
|
1276
|
+
### drawWeightedConnectionsLayer
|
|
1277
|
+
|
|
1278
|
+
`(context: CanvasRenderingContext2D, runtimeConnections: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").VisualNetworkConnectionLike[], positionByNodeIndex: Map<number, import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").PositionedNetworkNodeLike>, connectionScale: import("test/examples/flappy_bird/browser-entry/visualization/visualization.types").DynamicColorScale) => void`
|
|
1279
|
+
|
|
1280
|
+
Draws weighted connection lines.
|
|
1281
|
+
|
|
1282
|
+
Connection styling carries semantic meaning: color encodes magnitude and sign,
|
|
1283
|
+
while dash patterns and auxiliary marks help distinguish disabled or negative
|
|
1284
|
+
edges in a way that still reads quickly on a dense graph.
|
|
1285
|
+
|
|
1286
|
+
Parameters:
|
|
1287
|
+
- `context` - - Render context.
|
|
1288
|
+
- `runtimeConnections` - - Runtime connection list.
|
|
1289
|
+
- `positionByNodeIndex` - - Node layout map.
|
|
1290
|
+
- `connectionScale` - - Dynamic connection color scale.
|
|
1291
|
+
|
|
1292
|
+
Returns: Nothing.
|
|
1293
|
+
|
|
1294
|
+
### formatNodeBiasLabel
|
|
1295
|
+
|
|
1296
|
+
`(nodeBias: number) => string`
|
|
1297
|
+
|
|
1298
|
+
Formats node bias labels with fixed sign and precision.
|
|
1299
|
+
|
|
1300
|
+
Consistent sign and precision make dense node labels easier to scan quickly in
|
|
1301
|
+
the rendered network panel.
|
|
1302
|
+
|
|
1303
|
+
Parameters:
|
|
1304
|
+
- `nodeBias` - - Node bias value.
|
|
1305
|
+
|
|
1306
|
+
Returns: Label text.
|
|
1307
|
+
|
|
1308
|
+
### resolveBiasRangeColor
|
|
1309
|
+
|
|
1310
|
+
`(nodeBias: number) => string`
|
|
1311
|
+
|
|
1312
|
+
Resolves bias color for a raw node bias.
|
|
1313
|
+
|
|
1314
|
+
Bias colors follow the same diverging logic as connection colors so the legend
|
|
1315
|
+
remains conceptually consistent across channels.
|
|
1316
|
+
|
|
1317
|
+
Parameters:
|
|
1318
|
+
- `nodeBias` - - Node bias.
|
|
1319
|
+
|
|
1320
|
+
Returns: Tier color.
|
|
1321
|
+
|
|
1322
|
+
### resolveConnectionRangeColor
|
|
1323
|
+
|
|
1324
|
+
`(connectionWeight: number) => string`
|
|
1325
|
+
|
|
1326
|
+
Resolves connection color for a raw weight.
|
|
1327
|
+
|
|
1328
|
+
This small helper is useful when one-off drawing code wants the same color
|
|
1329
|
+
semantics as the full dynamic scale machinery.
|
|
1330
|
+
|
|
1331
|
+
Parameters:
|
|
1332
|
+
- `connectionWeight` - - Connection weight.
|
|
1333
|
+
|
|
1334
|
+
Returns: Tier color.
|
|
1335
|
+
|
|
1336
|
+
### resolveDefaultNetworkLegendLayout
|
|
1337
|
+
|
|
1338
|
+
`(context: CanvasRenderingContext2D, network: import("src/architecture/network").default | undefined) => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").NetworkLegendLayout`
|
|
1339
|
+
|
|
1340
|
+
Resolves default legend layout from internal tier definitions.
|
|
1341
|
+
|
|
1342
|
+
This convenience helper is used when the caller wants a layout driven by the
|
|
1343
|
+
currently active network and does not need to assemble the intermediate rows
|
|
1344
|
+
manually.
|
|
1345
|
+
|
|
1346
|
+
Parameters:
|
|
1347
|
+
- `context` - - Render context.
|
|
1348
|
+
- `network` - - Active network instance.
|
|
1349
|
+
|
|
1350
|
+
Returns: Legend layout.
|
|
1351
|
+
|
|
1352
|
+
### resolveNetworkLegendLayout
|
|
1353
|
+
|
|
1354
|
+
`(context: CanvasRenderingContext2D, connectionLegendRows: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").ColorLegendRow[], biasLegendRows: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").ColorLegendRow[]) => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").NetworkLegendLayout`
|
|
1355
|
+
|
|
1356
|
+
Resolves network legend layout from canvas constraints.
|
|
1357
|
+
|
|
1358
|
+
The legend layout adapts between regular and compact modes so the network
|
|
1359
|
+
panel can stay informative on smaller viewports without swallowing the whole
|
|
1360
|
+
canvas.
|
|
1361
|
+
|
|
1362
|
+
Parameters:
|
|
1363
|
+
- `context` - - Render context.
|
|
1364
|
+
- `connectionLegendRows` - - Connection legend rows.
|
|
1365
|
+
- `biasLegendRows` - - Bias legend rows.
|
|
1366
|
+
|
|
1367
|
+
Returns: Computed legend layout.
|
|
1368
|
+
|
|
1369
|
+
### resolveNetworkVisualizationColorScales
|
|
1370
|
+
|
|
1371
|
+
`(network: import("src/architecture/network").default | undefined) => import("test/examples/flappy_bird/browser-entry/visualization/visualization.types").NetworkVisualizationColorScales`
|
|
1372
|
+
|
|
1373
|
+
Resolves dynamic connection/bias color scales from the active network range.
|
|
1374
|
+
|
|
1375
|
+
The active network may contain only a narrow slice of the full theoretical
|
|
1376
|
+
value range, so the legend adapts to what is currently present instead of
|
|
1377
|
+
always rendering a fixed generic scale.
|
|
1378
|
+
|
|
1379
|
+
Parameters:
|
|
1380
|
+
- `network` - - Active network.
|
|
1381
|
+
|
|
1382
|
+
Returns: Dynamic scales used by graph drawing and legend rows.
|
|
1383
|
+
|
|
1384
|
+
### resolveNetworkVisualizationLayers
|
|
1385
|
+
|
|
1386
|
+
`(network: import("src/architecture/network").default | undefined, inputSize: number, outputSize: number) => import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").VisualNetworkNodeLike[][]`
|
|
1387
|
+
|
|
1388
|
+
Topology resolution helpers for the browser network view.
|
|
1389
|
+
|
|
1390
|
+
These helpers answer a key visualization question: how should the current
|
|
1391
|
+
network be partitioned into ordered layers so layout and architecture labels
|
|
1392
|
+
stay meaningful even when some metadata is missing?
|
|
1393
|
+
|
|
1394
|
+
### resolveTierColor
|
|
1395
|
+
|
|
1396
|
+
`(value: number, tiers: import("test/examples/flappy_bird/browser-entry/browser-entry.visualization.types").ColorTier[], aboveTierColor: string) => string`
|
|
1397
|
+
|
|
1398
|
+
Resolves a color from ordered tier definitions.
|
|
1399
|
+
|
|
1400
|
+
This is the final classification step that maps one numeric weight or bias to
|
|
1401
|
+
the swatch color the renderer should paint.
|
|
1402
|
+
|
|
1403
|
+
Parameters:
|
|
1404
|
+
- `value` - - Numeric value to classify.
|
|
1405
|
+
- `tiers` - - Ordered tier list.
|
|
1406
|
+
- `aboveTierColor` - - Fallback color for values above the last tier.
|
|
1407
|
+
|
|
1408
|
+
Returns: Resolved color string.
|
|
1409
|
+
|
|
1410
|
+
## browser-entry/browser-entry.worker-channel.utils.ts
|
|
1411
|
+
|
|
1412
|
+
### createEvolutionWorker
|
|
1413
|
+
|
|
1414
|
+
`() => Worker`
|
|
1415
|
+
|
|
1416
|
+
Creates the evolution worker used to keep heavy NEAT compute off the UI thread.
|
|
1417
|
+
|
|
1418
|
+
Returns: Initialized worker instance.
|
|
1419
|
+
|
|
1420
|
+
### requestWorkerGeneration
|
|
1421
|
+
|
|
1422
|
+
`(evolutionWorker: Worker) => Promise<import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionGenerationPayload>`
|
|
1423
|
+
|
|
1424
|
+
Waits for the next generation payload emitted by the evolution worker.
|
|
1425
|
+
|
|
1426
|
+
Parameters:
|
|
1427
|
+
- `evolutionWorker` - - Worker emitting generation-ready messages.
|
|
1428
|
+
|
|
1429
|
+
Returns: Next generation payload.
|
|
1430
|
+
|
|
1431
|
+
### requestWorkerPlaybackStep
|
|
1432
|
+
|
|
1433
|
+
`(evolutionWorker: Worker, playbackStepRequest: import("test/examples/flappy_bird/browser-entry/worker-channel/worker-channel.types").WorkerChannelPlaybackStepRequest) => Promise<{ requestId: number; snapshot: import("test/examples/flappy_bird/browser-entry/browser-entry.worker.types").EvolutionPlaybackStepSnapshot; instrumentation?: { activationCallsPerFrame: number; simulationStepsPerRaf: number; } | undefined; done: boolean; averagePipesPassed?: number | undefined; p90FramesSurvived?: number | undefined; winnerPipesPassed?: number | undefined; winnerFramesSurvived?: number | undefined; }>`
|
|
1434
|
+
|
|
1435
|
+
Requests one playback batch step from the worker.
|
|
1436
|
+
|
|
1437
|
+
Parameters:
|
|
1438
|
+
- `evolutionWorker` - - Worker that owns playback simulation state.
|
|
1439
|
+
- `playbackStepRequest` - - Requested simulation budget and viewport width.
|
|
1440
|
+
|
|
1441
|
+
Returns: Playback-step payload including snapshot and completion marker.
|