@reicek/neataptic-ts 0.1.25 → 0.1.26

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.
Files changed (210) hide show
  1. package/.github/copilot-instructions.md +11 -0
  2. package/.github/skills/trace-analyzer-extension/SKILL.md +3 -3
  3. package/.github/skills/trace-analyzer-extension/assets/extension-checklist.md +1 -1
  4. package/.github/skills/trace-analyzer-extension/references/analyzer-extension-workflow.md +1 -1
  5. package/.github/skills/trace-audit-reporting/SKILL.md +3 -3
  6. package/.github/skills/trace-audit-reporting/references/trace-analysis-workflow.md +1 -1
  7. package/package.json +19 -13
  8. package/plans/Flappy_Bird_Folder_Documentation_Pass.md +4 -4
  9. package/plans/README.md +24 -0
  10. package/plans/Roadmap.md +62 -40
  11. package/plans/analyze-trace-solid-split.plans.md +66 -0
  12. package/plans/architecture-solid-split.plans.md +9 -15
  13. package/plans/asciiMaze-typescript-repair.plans.md +1 -1
  14. package/plans/generate-docs-solid-split.plans.md +87 -0
  15. package/plans/methods-docs.plans.md +25 -1
  16. package/plans/methods-solid-split.plans.md +14 -14
  17. package/plans/neat-docs.plans.md +9 -1
  18. package/plans/neat-test-surface-repair.plans.md +1 -1
  19. package/plans/render-docs-html-solid-split.plans.md +68 -0
  20. package/plans/src-no-explicit-any-cleanup.plans.md +1 -1
  21. package/plans/utils-docs.plans.md +6 -1
  22. package/scripts/analyze-trace/analyze-trace.analysis.ts +479 -0
  23. package/scripts/analyze-trace/analyze-trace.constants.ts +35 -0
  24. package/scripts/analyze-trace/analyze-trace.io.ts +69 -0
  25. package/scripts/analyze-trace/analyze-trace.report.ts +100 -0
  26. package/scripts/analyze-trace/analyze-trace.shared.ts +116 -0
  27. package/scripts/analyze-trace/analyze-trace.ts +45 -0
  28. package/scripts/analyze-trace/analyze-trace.types.ts +72 -0
  29. package/scripts/assets/theme.css +80 -23
  30. package/scripts/copy-examples.ts +239 -0
  31. package/scripts/export-onnx.ts +223 -0
  32. package/scripts/generate-bench-tables.ts +378 -37
  33. package/scripts/generate-docs/generate-docs.constants.ts +107 -0
  34. package/scripts/generate-docs/generate-docs.order.ts +355 -0
  35. package/scripts/generate-docs/generate-docs.state.ts +31 -0
  36. package/scripts/generate-docs/generate-docs.targets.ts +165 -0
  37. package/scripts/generate-docs/generate-docs.ts +63 -0
  38. package/scripts/generate-docs/generate-docs.types.ts +112 -0
  39. package/scripts/generate-docs/output/generate-docs.output.folder-index.utils.ts +167 -0
  40. package/scripts/generate-docs/output/generate-docs.output.ordering.utils.ts +353 -0
  41. package/scripts/generate-docs/output/generate-docs.output.readme.utils.ts +420 -0
  42. package/scripts/generate-docs/output/generate-docs.output.ts +123 -0
  43. package/scripts/generate-docs/output/generate-docs.output.warnings.utils.ts +219 -0
  44. package/scripts/generate-docs/symbols/generate-docs.symbols.collection.utils.ts +365 -0
  45. package/scripts/generate-docs/symbols/generate-docs.symbols.jsdoc.utils.ts +373 -0
  46. package/scripts/generate-docs/symbols/generate-docs.symbols.normalize.utils.ts +155 -0
  47. package/scripts/generate-docs/symbols/generate-docs.symbols.render.utils.ts +149 -0
  48. package/scripts/generate-docs/symbols/generate-docs.symbols.signature.utils.ts +289 -0
  49. package/scripts/generate-docs/symbols/generate-docs.symbols.ts +11 -0
  50. package/scripts/mermaid-cli.mjs +102 -22
  51. package/scripts/mermaid-cli.ts +736 -0
  52. package/scripts/render-docs-html/render-docs-html.assets.ts +54 -0
  53. package/scripts/render-docs-html/render-docs-html.mermaid.ts +245 -0
  54. package/scripts/{render-docs-html.sidebar.ts → render-docs-html/render-docs-html.navigation.ts} +141 -144
  55. package/scripts/render-docs-html/render-docs-html.pages.ts +333 -0
  56. package/scripts/render-docs-html/render-docs-html.shared.ts +333 -0
  57. package/scripts/render-docs-html/render-docs-html.types.ts +42 -0
  58. package/scripts/render-docs-html.ts +23 -587
  59. package/scripts/run-docs.ts +238 -0
  60. package/scripts/write-dist-docs-pkg.ts +40 -0
  61. package/src/README.md +75 -75
  62. package/src/architecture/connection/README.md +5 -5
  63. package/src/architecture/layer/README.md +508 -508
  64. package/src/architecture/network/README.md +1458 -1458
  65. package/src/architecture/network/activate/README.md +694 -694
  66. package/src/architecture/network/bootstrap/README.md +77 -77
  67. package/src/architecture/network/connect/README.md +74 -74
  68. package/src/architecture/network/deterministic/README.md +135 -135
  69. package/src/architecture/network/evolve/README.md +364 -364
  70. package/src/architecture/network/gating/README.md +130 -130
  71. package/src/architecture/network/genetic/README.md +399 -399
  72. package/src/architecture/network/mutate/README.md +897 -897
  73. package/src/architecture/network/onnx/README.md +720 -720
  74. package/src/architecture/network/onnx/export/README.md +728 -728
  75. package/src/architecture/network/onnx/export/layers/README.md +450 -450
  76. package/src/architecture/network/onnx/import/README.md +618 -618
  77. package/src/architecture/network/onnx/schema/README.md +32 -32
  78. package/src/architecture/network/prune/README.md +245 -245
  79. package/src/architecture/network/remove/README.md +135 -135
  80. package/src/architecture/network/runtime/README.md +106 -106
  81. package/src/architecture/network/serialize/README.md +542 -542
  82. package/src/architecture/network/slab/README.md +608 -608
  83. package/src/architecture/network/standalone/README.md +212 -212
  84. package/src/architecture/network/stats/README.md +84 -84
  85. package/src/architecture/network/topology/README.md +465 -465
  86. package/src/architecture/network/training/README.md +200 -200
  87. package/src/architecture/node/README.md +5 -5
  88. package/src/architecture/nodePool/README.md +14 -14
  89. package/src/methods/README.md +99 -99
  90. package/src/methods/activation/README.md +189 -189
  91. package/src/methods/cost/README.md +131 -131
  92. package/src/methods/rate/README.md +86 -86
  93. package/src/multithreading/README.md +77 -77
  94. package/src/multithreading/workers/browser/README.md +8 -8
  95. package/src/multithreading/workers/node/README.md +8 -8
  96. package/src/neat/README.md +148 -148
  97. package/src/neat/adaptive/README.md +120 -120
  98. package/src/neat/adaptive/acceptance/README.md +40 -40
  99. package/src/neat/adaptive/complexity/README.md +137 -137
  100. package/src/neat/adaptive/core/README.md +197 -197
  101. package/src/neat/adaptive/lineage/README.md +90 -90
  102. package/src/neat/adaptive/mutation/README.md +284 -284
  103. package/src/neat/compat/README.md +43 -43
  104. package/src/neat/compat/core/README.md +90 -90
  105. package/src/neat/diversity/README.md +35 -35
  106. package/src/neat/diversity/core/README.md +88 -88
  107. package/src/neat/evaluate/README.md +85 -85
  108. package/src/neat/evaluate/auto-distance/README.md +75 -75
  109. package/src/neat/evaluate/entropy-compat/README.md +37 -37
  110. package/src/neat/evaluate/entropy-sharing/README.md +43 -43
  111. package/src/neat/evaluate/fitness/README.md +23 -23
  112. package/src/neat/evaluate/novelty/README.md +120 -120
  113. package/src/neat/evaluate/objectives/README.md +17 -17
  114. package/src/neat/evaluate/shared/README.md +94 -94
  115. package/src/neat/evolve/README.md +96 -96
  116. package/src/neat/evolve/adaptive/README.md +60 -60
  117. package/src/neat/evolve/objectives/README.md +63 -63
  118. package/src/neat/evolve/offspring/README.md +56 -56
  119. package/src/neat/evolve/population/README.md +171 -171
  120. package/src/neat/evolve/runtime/README.md +79 -79
  121. package/src/neat/evolve/speciation/README.md +74 -74
  122. package/src/neat/evolve/warnings/README.md +10 -10
  123. package/src/neat/export/README.md +114 -114
  124. package/src/neat/helpers/README.md +50 -50
  125. package/src/neat/init/README.md +9 -9
  126. package/src/neat/lineage/core/README.md +101 -101
  127. package/src/neat/multiobjective/category/README.md +74 -74
  128. package/src/neat/multiobjective/crowding/README.md +272 -272
  129. package/src/neat/multiobjective/dominance/README.md +171 -171
  130. package/src/neat/multiobjective/fronts/README.md +68 -68
  131. package/src/neat/multiobjective/metrics/README.md +43 -43
  132. package/src/neat/multiobjective/objectives/README.md +31 -31
  133. package/src/neat/multiobjective/shared/README.md +27 -27
  134. package/src/neat/mutation/README.md +97 -97
  135. package/src/neat/mutation/add-conn/README.md +115 -115
  136. package/src/neat/mutation/add-node/README.md +126 -126
  137. package/src/neat/mutation/flow/README.md +149 -149
  138. package/src/neat/mutation/repair/README.md +185 -185
  139. package/src/neat/mutation/select/README.md +117 -117
  140. package/src/neat/mutation/shared/README.md +32 -32
  141. package/src/neat/objectives/README.md +25 -25
  142. package/src/neat/objectives/core/README.md +67 -67
  143. package/src/neat/pruning/README.md +40 -40
  144. package/src/neat/pruning/core/README.md +171 -171
  145. package/src/neat/pruning/facade/README.md +32 -32
  146. package/src/neat/rng/README.md +104 -104
  147. package/src/neat/rng/core/README.md +137 -137
  148. package/src/neat/rng/facade/README.md +50 -50
  149. package/src/neat/selection/README.md +111 -111
  150. package/src/neat/selection/core/README.md +227 -227
  151. package/src/neat/selection/facade/README.md +61 -61
  152. package/src/neat/shared/README.md +163 -163
  153. package/src/neat/speciation/README.md +31 -31
  154. package/src/neat/speciation/threshold/README.md +35 -35
  155. package/src/neat/species/README.md +25 -25
  156. package/src/neat/species/core/README.md +20 -20
  157. package/src/neat/species/core/shared/README.md +18 -18
  158. package/src/neat/species/history/context/README.md +22 -22
  159. package/src/neat/telemetry/accessors/README.md +58 -58
  160. package/src/neat/telemetry/exports/README.md +233 -233
  161. package/src/neat/telemetry/facade/README.md +252 -252
  162. package/src/neat/telemetry/facade/archive/README.md +57 -57
  163. package/src/neat/telemetry/facade/buffer/README.md +43 -43
  164. package/src/neat/telemetry/facade/lineage/README.md +12 -12
  165. package/src/neat/telemetry/facade/objectives/README.md +44 -44
  166. package/src/neat/telemetry/facade/runtime/README.md +26 -26
  167. package/src/neat/telemetry/facade/species/README.md +27 -27
  168. package/src/neat/telemetry/metrics/README.md +696 -696
  169. package/src/neat/telemetry/recorder/README.md +57 -57
  170. package/src/neat/telemetry/types/README.md +32 -32
  171. package/src/neat/topology-intent/README.md +75 -75
  172. package/src/utils/README.md +193 -193
  173. package/test/examples/asciiMaze/browser-entry/README.md +92 -92
  174. package/test/examples/asciiMaze/dashboardManager/README.md +109 -109
  175. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +28 -28
  176. package/test/examples/asciiMaze/evolutionEngine/README.md +1527 -1527
  177. package/test/examples/asciiMaze/mazeMovement/README.md +105 -105
  178. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +16 -16
  179. package/test/examples/asciiMaze/mazeMovement/policy/README.md +57 -57
  180. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +52 -52
  181. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +46 -46
  182. package/test/examples/flappy_bird/browser-entry/README.md +508 -508
  183. package/test/examples/flappy_bird/browser-entry/host/README.md +101 -101
  184. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +144 -144
  185. package/test/examples/flappy_bird/browser-entry/network-view/README.md +194 -194
  186. package/test/examples/flappy_bird/browser-entry/playback/README.md +278 -278
  187. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +129 -129
  188. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +502 -502
  189. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +139 -139
  190. package/test/examples/flappy_bird/browser-entry/playback/snapshot/README.md +10 -10
  191. package/test/examples/flappy_bird/browser-entry/playback/trail/README.md +43 -43
  192. package/test/examples/flappy_bird/browser-entry/playback/worker-channel/README.md +30 -30
  193. package/test/examples/flappy_bird/browser-entry/runtime/README.md +59 -59
  194. package/test/examples/flappy_bird/browser-entry/visualization/README.md +276 -276
  195. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +16 -16
  196. package/test/examples/flappy_bird/constants/README.md +1070 -1070
  197. package/test/examples/flappy_bird/environment/README.md +22 -22
  198. package/test/examples/flappy_bird/evaluation/README.md +32 -32
  199. package/test/examples/flappy_bird/evaluation/rollout/README.md +141 -141
  200. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +425 -425
  201. package/test/examples/flappy_bird/simulation-shared/README.md +170 -170
  202. package/test/examples/flappy_bird/simulation-shared/observation/README.md +109 -109
  203. package/test/examples/flappy_bird/trainer/README.md +325 -325
  204. package/test/examples/flappy_bird/trainer/evaluation/README.md +74 -74
  205. package/scripts/analyze-trace.ts +0 -590
  206. package/scripts/copy-examples.mjs +0 -114
  207. package/scripts/export-onnx.mjs +0 -86
  208. package/scripts/generate-bench-tables.mjs +0 -182
  209. package/scripts/generate-docs.ts +0 -2900
  210. package/scripts/write-dist-docs-pkg.mjs +0 -16
@@ -16,20 +16,6 @@ inspection tools.
16
16
 
17
17
  ## simulation-shared/simulation-shared.types.ts
18
18
 
19
- ### SharedRngLike
20
-
21
- Minimal deterministic random contract used by shared spawn helpers.
22
-
23
- The shared layer keeps its RNG contract intentionally small so the same spawn
24
- helpers can work with both Node-side and browser-side deterministic sources.
25
-
26
- ### SharedPipeLike
27
-
28
- Common pipe shape consumed by observation helpers.
29
-
30
- This is the narrowest useful pipe contract for feature synthesis: horizontal
31
- position plus the vertical gap geometry seen by the bird.
32
-
33
19
  ### SharedDifficultyProfile
34
20
 
35
21
  Shared runtime difficulty profile used by browser and environment simulators.
@@ -47,6 +33,14 @@ These features make the policy input interpretable. The example does not feed
47
33
  raw pixels into NEAT; it feeds geometric signals such as distance to the next
48
34
  pipe, corridor clearance, and urgency of recovering to the gap center.
49
35
 
36
+ ### SharedObservationInput
37
+
38
+ Input shape for observation-feature synthesis.
39
+
40
+ This object is the raw world snapshot from which normalized features are
41
+ derived. It intentionally separates world geometry from the later feature
42
+ projection step.
43
+
50
44
  ### SharedObservationMemoryState
51
45
 
52
46
  Mutable temporal memory attached to one policy-controlled bird.
@@ -59,13 +53,19 @@ If you want background reading, the Wikipedia article on "frame stacking"
59
53
  captures the basic idea of giving a feed-forward policy a short motion trail
60
54
  instead of full recurrent state.
61
55
 
62
- ### SharedObservationInput
56
+ ### SharedPipeLike
63
57
 
64
- Input shape for observation-feature synthesis.
58
+ Common pipe shape consumed by observation helpers.
65
59
 
66
- This object is the raw world snapshot from which normalized features are
67
- derived. It intentionally separates world geometry from the later feature
68
- projection step.
60
+ This is the narrowest useful pipe contract for feature synthesis: horizontal
61
+ position plus the vertical gap geometry seen by the bird.
62
+
63
+ ### SharedRngLike
64
+
65
+ Minimal deterministic random contract used by shared spawn helpers.
66
+
67
+ The shared layer keeps its RNG contract intentionally small so the same spawn
68
+ helpers can work with both Node-side and browser-side deterministic sources.
69
69
 
70
70
  ## simulation-shared/simulation-shared.constants.ts
71
71
 
@@ -90,17 +90,17 @@ collapse toward zero during normalization.
90
90
 
91
91
  Clamps a numeric value to the inclusive `[min, max]` interval.
92
92
 
93
- ### clampValue
93
+ ### clamp
94
94
 
95
95
  ```ts
96
- clampValue(
96
+ clamp(
97
97
  value: number,
98
98
  min: number,
99
99
  max: number,
100
100
  ): number
101
101
  ```
102
102
 
103
- Clamps a numeric value to the inclusive `[min, max]` interval.
103
+ Internal clamp primitive.
104
104
 
105
105
  Parameters:
106
106
  - `value` - - Candidate value.
@@ -124,6 +124,25 @@ Parameters:
124
124
 
125
125
  Returns: Value clamped between 0 and 1.
126
126
 
127
+ ### clampValue
128
+
129
+ ```ts
130
+ clampValue(
131
+ value: number,
132
+ min: number,
133
+ max: number,
134
+ ): number
135
+ ```
136
+
137
+ Clamps a numeric value to the inclusive `[min, max]` interval.
138
+
139
+ Parameters:
140
+ - `value` - - Candidate value.
141
+ - `min` - - Inclusive lower bound.
142
+ - `max` - - Inclusive upper bound.
143
+
144
+ Returns: Clamped value.
145
+
127
146
  ### interpolateValue
128
147
 
129
148
  ```ts
@@ -143,25 +162,6 @@ Parameters:
143
162
 
144
163
  Returns: Interpolated value.
145
164
 
146
- ### clamp
147
-
148
- ```ts
149
- clamp(
150
- value: number,
151
- min: number,
152
- max: number,
153
- ): number
154
- ```
155
-
156
- Internal clamp primitive.
157
-
158
- Parameters:
159
- - `value` - - Candidate value.
160
- - `min` - - Inclusive lower bound.
161
- - `max` - - Inclusive upper bound.
162
-
163
- Returns: Clamped value.
164
-
165
165
  ## simulation-shared/simulation-shared.difficulty.utils.ts
166
166
 
167
167
  ### resolveAdaptiveDifficultyProfile
@@ -192,26 +192,6 @@ Returns: Active difficulty profile.
192
192
 
193
193
  ## simulation-shared/simulation-shared.spawn.utils.ts
194
194
 
195
- ### sampleGapCenterY
196
-
197
- ```ts
198
- sampleGapCenterY(
199
- rng: SharedRngLike,
200
- maximumGapCenterYPx: number,
201
- ): number
202
- ```
203
-
204
- Samples a random gap center y-position.
205
-
206
- The sampled center is bounded so the resulting pipe gap always remains inside
207
- the visible play area.
208
-
209
- Parameters:
210
- - `rng` - - Deterministic RNG.
211
- - `maximumGapCenterYPx` - - Optional inclusive upper bound for smaller viewports.
212
-
213
- Returns: Sampled y-position.
214
-
215
195
  ### resolveNextSpawnGapCenterY
216
196
 
217
197
  ```ts
@@ -280,6 +260,26 @@ Parameters:
280
260
 
281
261
  Returns: Next spawn interval in frames.
282
262
 
263
+ ### sampleGapCenterY
264
+
265
+ ```ts
266
+ sampleGapCenterY(
267
+ rng: SharedRngLike,
268
+ maximumGapCenterYPx: number,
269
+ ): number
270
+ ```
271
+
272
+ Samples a random gap center y-position.
273
+
274
+ The sampled center is bounded so the resulting pipe gap always remains inside
275
+ the visible play area.
276
+
277
+ Parameters:
278
+ - `rng` - - Deterministic RNG.
279
+ - `maximumGapCenterYPx` - - Optional inclusive upper bound for smaller viewports.
280
+
281
+ Returns: Sampled y-position.
282
+
283
283
  ## simulation-shared/simulation-shared.observation.utils.ts
284
284
 
285
285
  Shared observation compatibility façade.
@@ -291,36 +291,37 @@ boundary. This file stays as the stable import path for existing callers.
291
291
  That split keeps the high-level import path simple while allowing the
292
292
  observation subsystem to grow into its own documented folder.
293
293
 
294
- ### resolveUpcomingPipes
294
+ ### resolveCoreObservationVectorFromFeatures
295
295
 
296
296
  ```ts
297
- resolveUpcomingPipes(
298
- pipes: SharedPipeLike[],
299
- birdCenterXPx: number,
300
- birdRadiusPx: number,
301
- pipeWidthPx: number,
302
- ): [SharedPipeLike | undefined, SharedPipeLike | undefined]
297
+ resolveCoreObservationVectorFromFeatures(
298
+ features: SharedObservationFeatures,
299
+ ): number[]
303
300
  ```
304
301
 
305
- Resolves the next two upcoming pipes in front of the bird.
302
+ Resolves the compact core vector used for temporal stacking.
306
303
 
307
- The observation pipeline only cares about the immediate near future, because
308
- Flappy Bird decisions are dominated by the next gap and the transition after
309
- it. Looking further ahead adds noise faster than it adds useful control
310
- signal.
304
+ The core intentionally keeps directly observed kinematic and geometric
305
+ channels while dropping derived one-step predictors that become redundant
306
+ once short-term temporal memory is available.
307
+
308
+ This is the representation used when the example wants a short history of raw
309
+ observation slices. The idea is similar to frame stacking in reinforcement
310
+ learning: a feed-forward policy can recover some sense of motion by looking
311
+ at several recent compact frames at once.
312
+
313
+ The Wikipedia article on "frame stacking" is a useful conceptual reference.
311
314
 
312
315
  Parameters:
313
- - `pipes` - - Current pipe list.
314
- - `birdCenterXPx` - - Bird center x-position.
315
- - `birdRadiusPx` - - Bird radius.
316
- - `pipeWidthPx` - - Pipe width.
316
+ - `features` - - Structured observation features.
317
317
 
318
- Returns: Tuple of first and second upcoming pipes.
318
+ Returns: Core per-frame vector.
319
319
 
320
320
  Example:
321
321
 
322
322
  ```ts
323
- const [nextPipe, secondPipe] = resolveUpcomingPipes(pipes);
323
+ const coreFrame = resolveCoreObservationVectorFromFeatures(features);
324
+ observationMemoryState.previousCoreFrames.push(coreFrame);
324
325
  ```
325
326
 
326
327
  ### resolveObservationFeatures
@@ -405,37 +406,36 @@ const features = resolveObservationFeatures(input);
405
406
  const networkInput = resolveObservationVectorFromFeatures(features);
406
407
  ```
407
408
 
408
- ### resolveCoreObservationVectorFromFeatures
409
+ ### resolveUpcomingPipes
409
410
 
410
411
  ```ts
411
- resolveCoreObservationVectorFromFeatures(
412
- features: SharedObservationFeatures,
413
- ): number[]
412
+ resolveUpcomingPipes(
413
+ pipes: SharedPipeLike[],
414
+ birdCenterXPx: number,
415
+ birdRadiusPx: number,
416
+ pipeWidthPx: number,
417
+ ): [SharedPipeLike | undefined, SharedPipeLike | undefined]
414
418
  ```
415
419
 
416
- Resolves the compact core vector used for temporal stacking.
417
-
418
- The core intentionally keeps directly observed kinematic and geometric
419
- channels while dropping derived one-step predictors that become redundant
420
- once short-term temporal memory is available.
421
-
422
- This is the representation used when the example wants a short history of raw
423
- observation slices. The idea is similar to frame stacking in reinforcement
424
- learning: a feed-forward policy can recover some sense of motion by looking
425
- at several recent compact frames at once.
420
+ Resolves the next two upcoming pipes in front of the bird.
426
421
 
427
- The Wikipedia article on "frame stacking" is a useful conceptual reference.
422
+ The observation pipeline only cares about the immediate near future, because
423
+ Flappy Bird decisions are dominated by the next gap and the transition after
424
+ it. Looking further ahead adds noise faster than it adds useful control
425
+ signal.
428
426
 
429
427
  Parameters:
430
- - `features` - - Structured observation features.
428
+ - `pipes` - - Current pipe list.
429
+ - `birdCenterXPx` - - Bird center x-position.
430
+ - `birdRadiusPx` - - Bird radius.
431
+ - `pipeWidthPx` - - Pipe width.
431
432
 
432
- Returns: Core per-frame vector.
433
+ Returns: Tuple of first and second upcoming pipes.
433
434
 
434
435
  Example:
435
436
 
436
437
  ```ts
437
- const coreFrame = resolveCoreObservationVectorFromFeatures(features);
438
- observationMemoryState.previousCoreFrames.push(coreFrame);
438
+ const [nextPipe, secondPipe] = resolveUpcomingPipes(pipes);
439
439
  ```
440
440
 
441
441
  ## simulation-shared/simulation-shared.control.utils.ts
@@ -473,6 +473,29 @@ Returns: True when flap should trigger.
473
473
 
474
474
  ## simulation-shared/simulation-shared.memory.utils.ts
475
475
 
476
+ ### commitSharedObservationMemoryStep
477
+
478
+ ```ts
479
+ commitSharedObservationMemoryStep(
480
+ observationMemoryState: SharedObservationMemoryState,
481
+ features: SharedObservationFeatures,
482
+ didFlap: boolean,
483
+ ): void
484
+ ```
485
+
486
+ Commits one observation-action step into temporal memory.
487
+
488
+ The memory update happens after the decision is made so the next step can see
489
+ both the recent observation context and the action history that produced the
490
+ current trajectory.
491
+
492
+ Parameters:
493
+ - `observationMemoryState` - - Mutable temporal memory for the active bird.
494
+ - `features` - - Structured observation features used for the decision.
495
+ - `didFlap` - - Decision taken at this step.
496
+
497
+ Returns: Nothing.
498
+
476
499
  ### createSharedObservationMemoryState
477
500
 
478
501
  ```ts
@@ -489,6 +512,24 @@ Example:
489
512
  const memoryState = createSharedObservationMemoryState();
490
513
  ```
491
514
 
515
+ ### resolvePreviousCoreFramesWithPadding
516
+
517
+ ```ts
518
+ resolvePreviousCoreFramesWithPadding(
519
+ observationMemoryState: SharedObservationMemoryState,
520
+ ): number[][]
521
+ ```
522
+
523
+ Resolves previous core frames (newest-first) with deterministic zero padding.
524
+
525
+ Zero padding keeps the policy input width stable during the first few frames
526
+ of an episode before enough history has accumulated.
527
+
528
+ Parameters:
529
+ - `observationMemoryState` - - Mutable temporal memory for the active bird.
530
+
531
+ Returns: Previous core frame list with fixed target length.
532
+
492
533
  ### resolveTemporalObservationVector
493
534
 
494
535
  ```ts
@@ -518,47 +559,6 @@ Parameters:
518
559
 
519
560
  Returns: Ordered temporal input vector for policy activation.
520
561
 
521
- ### commitSharedObservationMemoryStep
522
-
523
- ```ts
524
- commitSharedObservationMemoryStep(
525
- observationMemoryState: SharedObservationMemoryState,
526
- features: SharedObservationFeatures,
527
- didFlap: boolean,
528
- ): void
529
- ```
530
-
531
- Commits one observation-action step into temporal memory.
532
-
533
- The memory update happens after the decision is made so the next step can see
534
- both the recent observation context and the action history that produced the
535
- current trajectory.
536
-
537
- Parameters:
538
- - `observationMemoryState` - - Mutable temporal memory for the active bird.
539
- - `features` - - Structured observation features used for the decision.
540
- - `didFlap` - - Decision taken at this step.
541
-
542
- Returns: Nothing.
543
-
544
- ### resolvePreviousCoreFramesWithPadding
545
-
546
- ```ts
547
- resolvePreviousCoreFramesWithPadding(
548
- observationMemoryState: SharedObservationMemoryState,
549
- ): number[][]
550
- ```
551
-
552
- Resolves previous core frames (newest-first) with deterministic zero padding.
553
-
554
- Zero padding keeps the policy input width stable during the first few frames
555
- of an episode before enough history has accumulated.
556
-
557
- Parameters:
558
- - `observationMemoryState` - - Mutable temporal memory for the active bird.
559
-
560
- Returns: Previous core frame list with fixed target length.
561
-
562
562
  ### resolveZeroCoreObservationFrame
563
563
 
564
564
  ```ts
@@ -571,41 +571,37 @@ Returns: Zero core frame.
571
571
 
572
572
  ## simulation-shared/simulation-shared.statistics.utils.ts
573
573
 
574
- ### computeMean
574
+ ### compareNumbersAscending
575
575
 
576
576
  ```ts
577
- computeMean(
578
- values: readonly number[],
577
+ compareNumbersAscending(
578
+ leftValue: number,
579
+ rightValue: number,
579
580
  ): number
580
581
  ```
581
582
 
582
- Computes arithmetic mean for numeric samples.
583
+ Compares two numeric values in ascending order.
583
584
 
584
585
  Parameters:
585
- - `values` - - Numeric samples.
586
+ - `leftValue` - - Left numeric value.
587
+ - `rightValue` - - Right numeric value.
586
588
 
587
- Returns: Arithmetic mean.
589
+ Returns: Comparator delta for `Array.prototype.toSorted`.
588
590
 
589
- ### computePopulationStandardDeviation
591
+ ### computeMean
590
592
 
591
593
  ```ts
592
- computePopulationStandardDeviation(
594
+ computeMean(
593
595
  values: readonly number[],
594
- meanValue: number,
595
596
  ): number
596
597
  ```
597
598
 
598
- Computes population standard deviation.
599
-
600
- This uses population variance rather than sample variance because the trainer
601
- is summarizing the whole evolved population for that generation, not estimating
602
- a larger hidden distribution from a subsample.
599
+ Computes arithmetic mean for numeric samples.
603
600
 
604
601
  Parameters:
605
602
  - `values` - - Numeric samples.
606
- - `meanValue` - - Precomputed mean.
607
603
 
608
- Returns: Population standard deviation.
604
+ Returns: Arithmetic mean.
609
605
 
610
606
  ### computePercentile
611
607
 
@@ -627,22 +623,26 @@ Parameters:
627
623
 
628
624
  Returns: Percentile value, or `Number.NaN` when `values` is empty.
629
625
 
630
- ### compareNumbersAscending
626
+ ### computePopulationStandardDeviation
631
627
 
632
628
  ```ts
633
- compareNumbersAscending(
634
- leftValue: number,
635
- rightValue: number,
629
+ computePopulationStandardDeviation(
630
+ values: readonly number[],
631
+ meanValue: number,
636
632
  ): number
637
633
  ```
638
634
 
639
- Compares two numeric values in ascending order.
635
+ Computes population standard deviation.
636
+
637
+ This uses population variance rather than sample variance because the trainer
638
+ is summarizing the whole evolved population for that generation, not estimating
639
+ a larger hidden distribution from a subsample.
640
640
 
641
641
  Parameters:
642
- - `leftValue` - - Left numeric value.
643
- - `rightValue` - - Right numeric value.
642
+ - `values` - - Numeric samples.
643
+ - `meanValue` - - Precomputed mean.
644
644
 
645
- Returns: Comparator delta for `Array.prototype.toSorted`.
645
+ Returns: Population standard deviation.
646
646
 
647
647
  ## simulation-shared/simulation-shared.errors.ts
648
648
 
@@ -651,6 +651,13 @@ Prefix used when formatting unexpected shared-simulation errors.
651
651
  A stable prefix makes logs easier to scan when multiple Flappy subsystems are
652
652
  emitting diagnostics.
653
653
 
654
+ ### FLAPPY_SHARED_SIMULATION_ERROR_PREFIX
655
+
656
+ Prefix used when formatting unexpected shared-simulation errors.
657
+
658
+ A stable prefix makes logs easier to scan when multiple Flappy subsystems are
659
+ emitting diagnostics.
660
+
654
661
  ### formatSharedSimulationErrorMessage
655
662
 
656
663
  ```ts
@@ -669,10 +676,3 @@ Parameters:
669
676
  - `error` - - Unknown error value.
670
677
 
671
678
  Returns: Readable error message.
672
-
673
- ### FLAPPY_SHARED_SIMULATION_ERROR_PREFIX
674
-
675
- Prefix used when formatting unexpected shared-simulation errors.
676
-
677
- A stable prefix makes logs easier to scan when multiple Flappy subsystems are
678
- emitting diagnostics.