@reicek/neataptic-ts 0.1.21 → 0.1.22

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 (223) hide show
  1. package/.github/agents/boundary-mapper.agent.md +29 -0
  2. package/.github/agents/docs-scout.agent.md +29 -0
  3. package/.github/agents/plan-scout.agent.md +29 -0
  4. package/.github/agents/solid-split.agent.md +138 -0
  5. package/.github/copilot-instructions.md +103 -0
  6. package/package.json +6 -3
  7. package/plans/ES2023 migration +13 -8
  8. package/plans/Evolution_Training_Interoperability_Contracts.md +1 -1
  9. package/plans/Interactive_Examples_and_Learning_Path.md +10 -2
  10. package/plans/Memory_Optimization.md +3 -3
  11. package/plans/README.md +63 -0
  12. package/plans/Roadmap.md +15 -3
  13. package/plans/asciiMaze_SOLID_split.done.md +130 -0
  14. package/plans/flappy_bird_SOLID_split.done.md +67 -0
  15. package/scripts/assets/theme.css +221 -34
  16. package/scripts/copy-examples.mjs +9 -5
  17. package/scripts/export-onnx.mjs +3 -3
  18. package/scripts/generate-bench-tables.mjs +10 -10
  19. package/scripts/generate-bench-tables.ts +10 -10
  20. package/scripts/generate-docs.ts +1415 -449
  21. package/scripts/render-docs-html.ts +15 -8
  22. package/src/README.md +101 -223
  23. package/src/architecture/README.md +57 -185
  24. package/src/architecture/layer/README.md +38 -38
  25. package/src/architecture/network/README.md +33 -31
  26. package/src/architecture/network/activate/README.md +77 -77
  27. package/src/architecture/network/connect/README.md +15 -13
  28. package/src/architecture/network/deterministic/README.md +7 -7
  29. package/src/architecture/network/evolve/README.md +44 -44
  30. package/src/architecture/network/gating/README.md +20 -20
  31. package/src/architecture/network/genetic/README.md +51 -51
  32. package/src/architecture/network/mutate/README.md +97 -97
  33. package/src/architecture/network/onnx/README.md +264 -264
  34. package/src/architecture/network/prune/README.md +39 -39
  35. package/src/architecture/network/remove/README.md +26 -26
  36. package/src/architecture/network/serialize/README.md +56 -56
  37. package/src/architecture/network/slab/README.md +61 -61
  38. package/src/architecture/network/standalone/README.md +24 -24
  39. package/src/architecture/network/stats/README.md +9 -9
  40. package/src/architecture/network/topology/README.md +46 -46
  41. package/src/architecture/network/training/README.md +21 -21
  42. package/src/methods/README.md +9 -87
  43. package/src/multithreading/README.md +8 -77
  44. package/src/multithreading/workers/README.md +2 -2
  45. package/src/multithreading/workers/browser/README.md +0 -6
  46. package/src/multithreading/workers/node/README.md +0 -3
  47. package/src/neat/README.md +562 -568
  48. package/src/utils/README.md +18 -18
  49. package/test/examples/asciiMaze/README.md +59 -59
  50. package/test/examples/asciiMaze/asciiMaze.e2e.test.ts +14 -9
  51. package/test/examples/asciiMaze/browser-entry/README.md +196 -0
  52. package/test/examples/asciiMaze/browser-entry/browser-entry.abort.services.ts +95 -0
  53. package/test/examples/asciiMaze/browser-entry/browser-entry.constants.ts +23 -0
  54. package/test/examples/asciiMaze/browser-entry/browser-entry.curriculum.services.ts +115 -0
  55. package/test/examples/asciiMaze/browser-entry/browser-entry.globals.services.ts +106 -0
  56. package/test/examples/asciiMaze/browser-entry/browser-entry.host.services.ts +157 -0
  57. package/test/examples/asciiMaze/browser-entry/browser-entry.services.ts +14 -0
  58. package/test/examples/asciiMaze/browser-entry/browser-entry.ts +129 -0
  59. package/test/examples/asciiMaze/browser-entry/browser-entry.types.ts +120 -0
  60. package/test/examples/asciiMaze/browser-entry/browser-entry.utils.ts +98 -0
  61. package/test/examples/asciiMaze/browser-entry.ts +10 -576
  62. package/test/examples/asciiMaze/dashboardManager/README.md +276 -0
  63. package/test/examples/asciiMaze/dashboardManager/archive/README.md +16 -0
  64. package/test/examples/asciiMaze/dashboardManager/archive/dashboardManager.archive.services.ts +267 -0
  65. package/test/examples/asciiMaze/dashboardManager/dashboardManager.constants.ts +35 -0
  66. package/test/examples/asciiMaze/dashboardManager/dashboardManager.services.ts +103 -0
  67. package/test/examples/asciiMaze/dashboardManager/dashboardManager.ts +181 -0
  68. package/test/examples/asciiMaze/dashboardManager/dashboardManager.types.ts +267 -0
  69. package/test/examples/asciiMaze/dashboardManager/dashboardManager.utils.ts +254 -0
  70. package/test/examples/asciiMaze/dashboardManager/live/README.md +14 -0
  71. package/test/examples/asciiMaze/dashboardManager/live/dashboardManager.live.services.ts +264 -0
  72. package/test/examples/asciiMaze/dashboardManager/telemetry/README.md +47 -0
  73. package/test/examples/asciiMaze/dashboardManager/telemetry/dashboardManager.telemetry.services.ts +513 -0
  74. package/test/examples/asciiMaze/dashboardManager.ts +13 -2335
  75. package/test/examples/asciiMaze/evolutionEngine/README.md +1058 -0
  76. package/test/examples/asciiMaze/evolutionEngine/curriculumPhase.ts +90 -0
  77. package/test/examples/asciiMaze/evolutionEngine/engineState.constants.ts +36 -0
  78. package/test/examples/asciiMaze/evolutionEngine/engineState.ts +58 -513
  79. package/test/examples/asciiMaze/evolutionEngine/engineState.types.ts +212 -0
  80. package/test/examples/asciiMaze/evolutionEngine/engineState.utils.ts +301 -0
  81. package/test/examples/asciiMaze/evolutionEngine/evolutionEngine.types.ts +445 -0
  82. package/test/examples/asciiMaze/evolutionEngine/evolutionLoop.ts +81 -50
  83. package/test/examples/asciiMaze/evolutionEngine/optionsAndSetup.ts +2 -4
  84. package/test/examples/asciiMaze/evolutionEngine/populationDynamics.ts +17 -33
  85. package/test/examples/asciiMaze/evolutionEngine/populationPruning.ts +1 -1
  86. package/test/examples/asciiMaze/evolutionEngine/rngAndTiming.ts +1 -2
  87. package/test/examples/asciiMaze/evolutionEngine/sampling.ts +1 -1
  88. package/test/examples/asciiMaze/evolutionEngine/scratchPools.ts +2 -5
  89. package/test/examples/asciiMaze/evolutionEngine/setupHelpers.ts +30 -37
  90. package/test/examples/asciiMaze/evolutionEngine/telemetryMetrics.ts +16 -58
  91. package/test/examples/asciiMaze/evolutionEngine/trainingWarmStart.ts +2 -2
  92. package/test/examples/asciiMaze/evolutionEngine.ts +55 -55
  93. package/test/examples/asciiMaze/fitness.ts +2 -2
  94. package/test/examples/asciiMaze/fitness.types.ts +65 -0
  95. package/test/examples/asciiMaze/interfaces.ts +64 -1352
  96. package/test/examples/asciiMaze/mazeMovement/README.md +356 -0
  97. package/test/examples/asciiMaze/mazeMovement/finalization/README.md +49 -0
  98. package/test/examples/asciiMaze/mazeMovement/finalization/mazeMovement.finalization.ts +138 -0
  99. package/test/examples/asciiMaze/mazeMovement/mazeMovement.constants.ts +101 -0
  100. package/test/examples/asciiMaze/mazeMovement/mazeMovement.services.ts +230 -0
  101. package/test/examples/asciiMaze/mazeMovement/mazeMovement.ts +299 -0
  102. package/test/examples/asciiMaze/mazeMovement/mazeMovement.types.ts +185 -0
  103. package/test/examples/asciiMaze/mazeMovement/mazeMovement.utils.ts +153 -0
  104. package/test/examples/asciiMaze/mazeMovement/policy/README.md +91 -0
  105. package/test/examples/asciiMaze/mazeMovement/policy/mazeMovement.policy.ts +467 -0
  106. package/test/examples/asciiMaze/mazeMovement/runtime/README.md +95 -0
  107. package/test/examples/asciiMaze/mazeMovement/runtime/mazeMovement.runtime.ts +354 -0
  108. package/test/examples/asciiMaze/mazeMovement/shaping/README.md +124 -0
  109. package/test/examples/asciiMaze/mazeMovement/shaping/mazeMovement.shaping.ts +459 -0
  110. package/test/examples/asciiMaze/mazeMovement.ts +12 -2978
  111. package/test/examples/flappy_bird/Trace-20260309T191949.json +24124 -0
  112. package/test/examples/flappy_bird/browser-entry/README.md +1129 -0
  113. package/test/examples/flappy_bird/browser-entry/browser-entry.host.utils.ts +4 -324
  114. package/test/examples/flappy_bird/browser-entry/browser-entry.network-view.utils.ts +6 -399
  115. package/test/examples/flappy_bird/browser-entry/browser-entry.playback.utils.ts +1 -717
  116. package/test/examples/flappy_bird/browser-entry/browser-entry.spawn.utils.ts +11 -31
  117. package/test/examples/flappy_bird/browser-entry/browser-entry.visualization.utils.ts +15 -893
  118. package/test/examples/flappy_bird/browser-entry/host/README.md +307 -0
  119. package/test/examples/flappy_bird/browser-entry/host/host.resize.service.ts +1 -295
  120. package/test/examples/flappy_bird/browser-entry/host/host.ts +562 -6
  121. package/test/examples/flappy_bird/browser-entry/host/resize/README.md +274 -0
  122. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.constants.ts +31 -0
  123. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.services.ts +360 -0
  124. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.ts +117 -0
  125. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.types.ts +63 -0
  126. package/test/examples/flappy_bird/browser-entry/host/resize/host.resize.service.utils.ts +250 -0
  127. package/test/examples/flappy_bird/browser-entry/network-view/README.md +399 -0
  128. package/test/examples/flappy_bird/browser-entry/network-view/network-view.topology.utils.ts +255 -0
  129. package/test/examples/flappy_bird/browser-entry/network-view/network-view.ts +802 -7
  130. package/test/examples/flappy_bird/browser-entry/playback/README.md +684 -0
  131. package/test/examples/flappy_bird/browser-entry/playback/background/README.md +277 -0
  132. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/README.md +770 -0
  133. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.cache.services.ts +178 -0
  134. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.constants.ts +107 -0
  135. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.geometry.utils.ts +518 -0
  136. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.math.utils.ts +117 -0
  137. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.pulse.utils.ts +233 -0
  138. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.services.ts +211 -0
  139. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.ts +48 -0
  140. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.types.ts +212 -0
  141. package/test/examples/flappy_bird/browser-entry/playback/background/ground-grid/playback.background.ground-grid.utils.ts +81 -0
  142. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.cache.services.ts +96 -0
  143. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.constants.ts +62 -0
  144. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.services.ts +244 -0
  145. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.ts +53 -0
  146. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.types.ts +68 -0
  147. package/test/examples/flappy_bird/browser-entry/playback/background/playback.background.utils.ts +100 -0
  148. package/test/examples/flappy_bird/browser-entry/playback/frame-render/README.md +310 -0
  149. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.service.ts +92 -0
  150. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.services.ts +272 -0
  151. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.types.ts +39 -0
  152. package/test/examples/flappy_bird/browser-entry/playback/frame-render/playback.frame-render.utils.ts +493 -0
  153. package/test/examples/flappy_bird/browser-entry/playback/playback.constants.ts +1 -1
  154. package/test/examples/flappy_bird/browser-entry/playback/playback.frame-render.service.ts +4 -0
  155. package/test/examples/flappy_bird/browser-entry/playback/playback.snapshot.utils.ts +44 -0
  156. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.service.ts +39 -122
  157. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.services.ts +272 -0
  158. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.types.ts +62 -0
  159. package/test/examples/flappy_bird/browser-entry/playback/playback.starfield.utils.ts +11 -4
  160. package/test/examples/flappy_bird/browser-entry/playback/playback.ts +409 -8
  161. package/test/examples/flappy_bird/browser-entry/playback/playback.types.ts +4 -12
  162. package/test/examples/flappy_bird/browser-entry/runtime/README.md +235 -0
  163. package/test/examples/flappy_bird/browser-entry/runtime/runtime.evolution-launch.service.ts +45 -0
  164. package/test/examples/flappy_bird/browser-entry/runtime/runtime.lifecycle.service.ts +81 -0
  165. package/test/examples/flappy_bird/browser-entry/runtime/runtime.startup.service.ts +74 -0
  166. package/test/examples/flappy_bird/browser-entry/runtime/runtime.ts +31 -121
  167. package/test/examples/flappy_bird/browser-entry/runtime/runtime.types.ts +36 -0
  168. package/test/examples/flappy_bird/browser-entry/visualization/README.md +557 -0
  169. package/test/examples/flappy_bird/browser-entry/visualization/visualization.constants.ts +110 -0
  170. package/test/examples/flappy_bird/browser-entry/visualization/visualization.draw.service.ts +957 -19
  171. package/test/examples/flappy_bird/browser-entry/visualization/visualization.legend.utils.ts +138 -3
  172. package/test/examples/flappy_bird/browser-entry/visualization/visualization.topology.utils.ts +3 -27
  173. package/test/examples/flappy_bird/browser-entry/visualization/visualization.ts +1 -23
  174. package/test/examples/flappy_bird/browser-entry/worker-channel/README.md +156 -0
  175. package/test/examples/flappy_bird/constants/README.md +1179 -0
  176. package/test/examples/flappy_bird/constants/constants.network-view.ts +24 -0
  177. package/test/examples/flappy_bird/constants/constants.palette.ts +7 -0
  178. package/test/examples/flappy_bird/constants/constants.starfield.ts +78 -3
  179. package/test/examples/flappy_bird/environment/README.md +143 -0
  180. package/test/examples/flappy_bird/environment/environment.observation.utils.ts +1 -19
  181. package/test/examples/flappy_bird/environment/environment.step.service.ts +3 -66
  182. package/test/examples/flappy_bird/evaluation/README.md +130 -0
  183. package/test/examples/flappy_bird/evaluation/evaluation.fitness.utils.ts +1 -1
  184. package/test/examples/flappy_bird/evaluation/evaluation.rollout.service.ts +5 -375
  185. package/test/examples/flappy_bird/evaluation/rollout/README.md +291 -0
  186. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.constants.ts +30 -0
  187. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.service.ts +58 -0
  188. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.services.ts +310 -0
  189. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.types.ts +56 -0
  190. package/test/examples/flappy_bird/evaluation/rollout/evaluation.rollout.utils.ts +368 -0
  191. package/test/examples/flappy_bird/flappy-evolution-worker/README.md +618 -0
  192. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.playback.service.ts +7 -7
  193. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.frame.service.ts +364 -0
  194. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.types.ts +14 -0
  195. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.simulation.utils.ts +4 -201
  196. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.ts +184 -345
  197. package/test/examples/flappy_bird/flappy-evolution-worker/flappy-evolution-worker.warm-start.service.ts +291 -0
  198. package/test/examples/flappy_bird/flappy.simulation.shared.utils.ts +5 -0
  199. package/test/examples/flappy_bird/simulation-shared/README.md +417 -0
  200. package/test/examples/flappy_bird/simulation-shared/observation/README.md +183 -0
  201. package/test/examples/flappy_bird/simulation-shared/observation/observation.features.utils.ts +301 -0
  202. package/test/examples/flappy_bird/simulation-shared/observation/observation.ts +9 -0
  203. package/test/examples/flappy_bird/simulation-shared/observation/observation.vector.utils.ts +59 -0
  204. package/test/examples/flappy_bird/simulation-shared/simulation-shared.observation.utils.ts +5 -403
  205. package/test/examples/flappy_bird/simulation-shared/simulation-shared.spawn.utils.ts +20 -6
  206. package/test/examples/flappy_bird/{evaluation/evaluation.statistics.utils.ts → simulation-shared/simulation-shared.statistics.utils.ts} +23 -8
  207. package/test/examples/flappy_bird/trainer/README.md +563 -0
  208. package/test/examples/flappy_bird/trainer/evaluation/README.md +199 -0
  209. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.constants.ts +9 -0
  210. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.services.ts +73 -0
  211. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.ts +165 -0
  212. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.types.ts +25 -0
  213. package/test/examples/flappy_bird/trainer/evaluation/trainer.evaluation.service.utils.ts +161 -0
  214. package/test/examples/flappy_bird/trainer/trainer.evaluation.service.ts +13 -0
  215. package/test/examples/flappy_bird/trainer/trainer.report.service.services.ts +181 -0
  216. package/test/examples/flappy_bird/trainer/trainer.report.service.ts +126 -0
  217. package/test/examples/flappy_bird/trainer/trainer.selection.utils.ts +89 -0
  218. package/test/examples/flappy_bird/trainer/trainer.ts +11 -553
  219. package/test/examples/flappy_bird/browser-entry/browser-entry.utils.ts +0 -12
  220. package/test/examples/flappy_bird/environment/environment.ts +0 -7
  221. package/test/examples/flappy_bird/evaluation/evaluation.ts +0 -7
  222. package/test/examples/flappy_bird/simulation-shared/simulation-shared.ts +0 -15
  223. package/test/examples/flappy_bird/trainer/trainer.statistics.utils.ts +0 -78
@@ -0,0 +1,417 @@
1
+ # simulation-shared
2
+
3
+ ## simulation-shared/simulation-shared.types.ts
4
+
5
+ ### simulation-shared.types
6
+
7
+ Minimal deterministic random contract used by shared spawn helpers.
8
+
9
+ ### SharedDifficultyProfile
10
+
11
+ Shared runtime difficulty profile used by browser and environment simulators.
12
+
13
+ ### SharedObservationFeatures
14
+
15
+ Structured observation features for network input.
16
+
17
+ ### SharedObservationInput
18
+
19
+ Input shape for observation-feature synthesis.
20
+
21
+ ### SharedObservationMemoryState
22
+
23
+ Mutable temporal memory attached to one policy-controlled bird.
24
+
25
+ The memory stores recent core observation frames and recent action history,
26
+ allowing feedforward policies to consume short-term context without adding
27
+ recurrent connections.
28
+
29
+ ### SharedPipeLike
30
+
31
+ Common pipe shape consumed by observation helpers.
32
+
33
+ ### SharedRngLike
34
+
35
+ Minimal deterministic random contract used by shared spawn helpers.
36
+
37
+ ## simulation-shared/simulation-shared.errors.ts
38
+
39
+ ### simulation-shared.errors
40
+
41
+ Prefix used when formatting unexpected shared-simulation errors.
42
+
43
+ ### FLAPPY_SHARED_SIMULATION_ERROR_PREFIX
44
+
45
+ ### formatSharedSimulationErrorMessage
46
+
47
+ `(error: unknown) => string`
48
+
49
+ Formats unknown shared-simulation errors for stable logs.
50
+
51
+ Parameters:
52
+
53
+ - `error` - - Unknown error value.
54
+
55
+ Returns: Readable error message.
56
+
57
+ ## simulation-shared/simulation-shared.constants.ts
58
+
59
+ ### simulation-shared.constants
60
+
61
+ Default curriculum scale used when callers do not provide one.
62
+
63
+ A value of `1` means full adaptive difficulty behavior is enabled.
64
+
65
+ ### FLAPPY_SHARED_DEFAULT_DIFFICULTY_SCALE
66
+
67
+ ### FLAPPY_SHARED_DEFAULT_NORMALIZATION_EPSILON
68
+
69
+ ## simulation-shared/simulation-shared.math.utils.ts
70
+
71
+ ### simulation-shared.math.utils
72
+
73
+ Clamps a numeric value to the inclusive `[min, max]` interval.
74
+
75
+ @param value - Candidate value.
76
+ @param min - Inclusive lower bound.
77
+ @param max - Inclusive upper bound.
78
+ @returns Clamped value.
79
+
80
+ ### clamp
81
+
82
+ `(value: number, min: number, max: number) => number`
83
+
84
+ Internal clamp primitive.
85
+
86
+ Parameters:
87
+
88
+ - `value` - - Candidate value.
89
+ - `min` - - Inclusive lower bound.
90
+ - `max` - - Inclusive upper bound.
91
+
92
+ Returns: Clamped value.
93
+
94
+ ### clamp01
95
+
96
+ `(value: number) => number`
97
+
98
+ Clamps a numeric value to the inclusive `[0, 1]` interval.
99
+
100
+ Parameters:
101
+
102
+ - `value` - - Candidate value.
103
+
104
+ Returns: Value clamped between 0 and 1.
105
+
106
+ ### clampValue
107
+
108
+ `(value: number, min: number, max: number) => number`
109
+
110
+ Clamps a numeric value to the inclusive `[min, max]` interval.
111
+
112
+ Parameters:
113
+
114
+ - `value` - - Candidate value.
115
+ - `min` - - Inclusive lower bound.
116
+ - `max` - - Inclusive upper bound.
117
+
118
+ Returns: Clamped value.
119
+
120
+ ### interpolateValue
121
+
122
+ `(startValue: number, endValue: number, progress: number) => number`
123
+
124
+ Linear interpolation helper.
125
+
126
+ Parameters:
127
+
128
+ - `startValue` - - Start value at progress `0`.
129
+ - `endValue` - - End value at progress `1`.
130
+ - `progress` - - Normalized interpolation progress.
131
+
132
+ Returns: Interpolated value.
133
+
134
+ ## simulation-shared/simulation-shared.spawn.utils.ts
135
+
136
+ ### resolveNextSpawnGapCenterY
137
+
138
+ `(previousGapCenterYPx: number, rng: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedRngLike, maximumGapCenterYPx: number) => number`
139
+
140
+ Resolves next gap center with bounded per-pipe delta.
141
+
142
+ Parameters:
143
+
144
+ - `previousGapCenterYPx` - - Previous spawn gap center.
145
+ - `rng` - - Deterministic RNG.
146
+ - `maximumGapCenterYPx` - - Optional inclusive upper bound for smaller viewports.
147
+
148
+ Returns: Next gap center y-position.
149
+
150
+ ### resolveNextSpawnGapSize
151
+
152
+ `(previousSpawnGapPx: number | undefined, difficultyProfile: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedDifficultyProfile, rng: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedRngLike) => number`
153
+
154
+ Resolves next spawn gap size using progressive shrink and jitter.
155
+
156
+ Parameters:
157
+
158
+ - `previousSpawnGapPx` - - Previous spawn gap size.
159
+ - `difficultyProfile` - - Active difficulty profile.
160
+ - `rng` - - Deterministic RNG.
161
+
162
+ Returns: Next spawn gap size.
163
+
164
+ ### resolveNextSpawnIntervalFrames
165
+
166
+ `(previousSpawnIntervalFrames: number | undefined, difficultyProfile: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedDifficultyProfile) => number`
167
+
168
+ Resolves next spawn interval using progressive shrink.
169
+
170
+ Parameters:
171
+
172
+ - `previousSpawnIntervalFrames` - - Previous spawn interval.
173
+ - `difficultyProfile` - - Active difficulty profile.
174
+
175
+ Returns: Next spawn interval in frames.
176
+
177
+ ### sampleGapCenterY
178
+
179
+ `(rng: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedRngLike, maximumGapCenterYPx: number) => number`
180
+
181
+ Samples a random gap center y-position.
182
+
183
+ Parameters:
184
+
185
+ - `rng` - - Deterministic RNG.
186
+ - `maximumGapCenterYPx` - - Optional inclusive upper bound for smaller viewports.
187
+
188
+ Returns: Sampled y-position.
189
+
190
+ ## simulation-shared/simulation-shared.memory.utils.ts
191
+
192
+ ### commitSharedObservationMemoryStep
193
+
194
+ `(observationMemoryState: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState, features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures, didFlap: boolean) => void`
195
+
196
+ Commits one observation-action step into temporal memory.
197
+
198
+ Parameters:
199
+
200
+ - `observationMemoryState` - - Mutable temporal memory for the active bird.
201
+ - `features` - - Structured observation features used for the decision.
202
+ - `didFlap` - - Decision taken at this step.
203
+
204
+ Returns: Nothing.
205
+
206
+ ### createSharedObservationMemoryState
207
+
208
+ `() => import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState`
209
+
210
+ Creates an empty temporal observation memory state.
211
+
212
+ Returns: Fresh mutable memory buffers for one bird/controller.
213
+
214
+ ### resolvePreviousCoreFramesWithPadding
215
+
216
+ `(observationMemoryState: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState) => number[][]`
217
+
218
+ Resolves previous core frames (newest-first) with deterministic zero padding.
219
+
220
+ Parameters:
221
+
222
+ - `observationMemoryState` - - Mutable temporal memory for the active bird.
223
+
224
+ Returns: Previous core frame list with fixed target length.
225
+
226
+ ### resolveTemporalObservationVector
227
+
228
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures, observationMemoryState: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationMemoryState) => number[]`
229
+
230
+ Builds the temporal policy input vector (stacked observation + action memory).
231
+
232
+ Output layout:
233
+
234
+ 1. current core observation frame
235
+ 2. previous core frames (newest to oldest) with zero padding
236
+ 3. last-action channel
237
+ 4. recent flap-rate channel over a fixed window
238
+
239
+ Parameters:
240
+
241
+ - `features` - - Structured observation features for the current decision step.
242
+ - `observationMemoryState` - - Mutable temporal memory for the active bird.
243
+
244
+ Returns: Ordered temporal input vector for policy activation.
245
+
246
+ ### resolveZeroCoreObservationFrame
247
+
248
+ `() => number[]`
249
+
250
+ Builds a zero-valued core frame with canonical length.
251
+
252
+ Returns: Zero core frame.
253
+
254
+ ## simulation-shared/simulation-shared.control.utils.ts
255
+
256
+ ### simulation-shared.control.utils
257
+
258
+ Resolves flap/no-flap decision from network outputs.
259
+
260
+ @param rawOutputs - Activation output payload.
261
+ @param flapThreshold - Scalar threshold for single-output policies.
262
+ @returns True when flap should trigger.
263
+
264
+ ### resolveFlapDecision
265
+
266
+ `(rawOutputs: unknown, flapThreshold: number) => boolean`
267
+
268
+ Resolves flap/no-flap decision from network outputs.
269
+
270
+ Parameters:
271
+
272
+ - `rawOutputs` - - Activation output payload.
273
+ - `flapThreshold` - - Scalar threshold for single-output policies.
274
+
275
+ Returns: True when flap should trigger.
276
+
277
+ ## simulation-shared/simulation-shared.difficulty.utils.ts
278
+
279
+ ### resolveAdaptiveDifficultyProfile
280
+
281
+ `(pipesPassed: number, difficultyScale: number) => import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedDifficultyProfile`
282
+
283
+ Resolves adaptive difficulty profile from passed-pipe progress.
284
+
285
+ Parameters:
286
+
287
+ - `pipesPassed` - - Number of passed pipes.
288
+ - `difficultyScale` - - Curriculum scale in `[0, 1]`.
289
+
290
+ Returns: Active difficulty profile.
291
+
292
+ ## simulation-shared/simulation-shared.statistics.utils.ts
293
+
294
+ ### compareNumbersAscending
295
+
296
+ `(leftValue: number, rightValue: number) => number`
297
+
298
+ Compares two numeric values in ascending order.
299
+
300
+ Parameters:
301
+
302
+ - `leftValue` - - Left numeric value.
303
+ - `rightValue` - - Right numeric value.
304
+
305
+ Returns: Comparator delta for `Array.prototype.toSorted`.
306
+
307
+ ### computeMean
308
+
309
+ `(values: readonly number[]) => number`
310
+
311
+ Computes arithmetic mean for numeric samples.
312
+
313
+ Parameters:
314
+
315
+ - `values` - - Numeric samples.
316
+
317
+ Returns: Arithmetic mean.
318
+
319
+ ### computePercentile
320
+
321
+ `(values: readonly number[], percentile: number) => number`
322
+
323
+ Computes percentile value via linear interpolation between nearest ranks.
324
+
325
+ Parameters:
326
+
327
+ - `values` - - Numeric samples.
328
+ - `percentile` - - Percentile in [0, 1].
329
+
330
+ Returns: Percentile value, or `Number.NaN` when `values` is empty.
331
+
332
+ ### computePopulationStandardDeviation
333
+
334
+ `(values: readonly number[], meanValue: number) => number`
335
+
336
+ Computes population standard deviation.
337
+
338
+ Parameters:
339
+
340
+ - `values` - - Numeric samples.
341
+ - `meanValue` - - Precomputed mean.
342
+
343
+ Returns: Population standard deviation.
344
+
345
+ ## simulation-shared/simulation-shared.observation.utils.ts
346
+
347
+ ### simulation-shared.observation.utils
348
+
349
+ Shared observation compatibility façade.
350
+
351
+ The observation implementation now lives under `simulation-shared/observation/`
352
+ so feature synthesis and vector projection can evolve behind a focused module
353
+ boundary. This file stays as the stable import path for existing callers.
354
+
355
+ ### resolveCoreObservationVectorFromFeatures
356
+
357
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
358
+
359
+ Resolves the compact core vector used for temporal stacking.
360
+
361
+ The core intentionally keeps directly observed kinematic and geometric
362
+ channels while dropping derived one-step predictors that become redundant
363
+ once short-term temporal memory is available.
364
+
365
+ Parameters:
366
+
367
+ - `features` - - Structured observation features.
368
+
369
+ Returns: Core per-frame vector.
370
+
371
+ ### resolveObservationFeatures
372
+
373
+ `(input: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationInput) => import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures`
374
+
375
+ Builds the shared normalized observation feature set consumed by policies.
376
+
377
+ Educational note:
378
+ This helper stays focused on semantic feature assembly only. Projection into
379
+ the canonical network vectors now lives in the neighboring vector module so
380
+ observation policy and network-shape concerns can evolve independently.
381
+
382
+ Parameters:
383
+
384
+ - `input` - - Observation input bundle.
385
+
386
+ Returns: Structured observation features.
387
+
388
+ ### resolveObservationVectorFromFeatures
389
+
390
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
391
+
392
+ Converts observation features to the canonical 12-value network input vector.
393
+
394
+ Educational note:
395
+ This module owns the network-shape projection so feature semantics can change
396
+ independently from how the policy input is ordered.
397
+
398
+ Parameters:
399
+
400
+ - `features` - - Structured feature object.
401
+
402
+ Returns: Ordered feature vector.
403
+
404
+ ### resolveUpcomingPipes
405
+
406
+ `(pipes: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike[], birdCenterXPx: number, birdRadiusPx: number, pipeWidthPx: number) => [import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined, import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined]`
407
+
408
+ Resolves the next two upcoming pipes in front of the bird.
409
+
410
+ Parameters:
411
+
412
+ - `pipes` - - Current pipe list.
413
+ - `birdCenterXPx` - - Bird center x-position.
414
+ - `birdRadiusPx` - - Bird radius.
415
+ - `pipeWidthPx` - - Pipe width.
416
+
417
+ Returns: Tuple of first and second upcoming pipes.
@@ -0,0 +1,183 @@
1
+ # simulation-shared/observation
2
+
3
+ ## simulation-shared/observation/observation.ts
4
+
5
+ ### observation
6
+
7
+ Shared observation public entry.
8
+
9
+ This focused boundary keeps observation feature assembly separate from
10
+ observation-vector projection so browser, environment, and worker callers can
11
+ depend on a smaller, clearer public surface.
12
+
13
+ ### resolveCoreObservationVectorFromFeatures
14
+
15
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
16
+
17
+ Resolves the compact core vector used for temporal stacking.
18
+
19
+ The core intentionally keeps directly observed kinematic and geometric
20
+ channels while dropping derived one-step predictors that become redundant
21
+ once short-term temporal memory is available.
22
+
23
+ Parameters:
24
+
25
+ - `features` - - Structured observation features.
26
+
27
+ Returns: Core per-frame vector.
28
+
29
+ ### resolveObservationFeatures
30
+
31
+ `(input: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationInput) => import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures`
32
+
33
+ Builds the shared normalized observation feature set consumed by policies.
34
+
35
+ Educational note:
36
+ This helper stays focused on semantic feature assembly only. Projection into
37
+ the canonical network vectors now lives in the neighboring vector module so
38
+ observation policy and network-shape concerns can evolve independently.
39
+
40
+ Parameters:
41
+
42
+ - `input` - - Observation input bundle.
43
+
44
+ Returns: Structured observation features.
45
+
46
+ ### resolveObservationVectorFromFeatures
47
+
48
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
49
+
50
+ Converts observation features to the canonical 12-value network input vector.
51
+
52
+ Educational note:
53
+ This module owns the network-shape projection so feature semantics can change
54
+ independently from how the policy input is ordered.
55
+
56
+ Parameters:
57
+
58
+ - `features` - - Structured feature object.
59
+
60
+ Returns: Ordered feature vector.
61
+
62
+ ### resolveUpcomingPipes
63
+
64
+ `(pipes: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike[], birdCenterXPx: number, birdRadiusPx: number, pipeWidthPx: number) => [import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined, import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined]`
65
+
66
+ Resolves the next two upcoming pipes in front of the bird.
67
+
68
+ Parameters:
69
+
70
+ - `pipes` - - Current pipe list.
71
+ - `birdCenterXPx` - - Bird center x-position.
72
+ - `birdRadiusPx` - - Bird radius.
73
+ - `pipeWidthPx` - - Pipe width.
74
+
75
+ Returns: Tuple of first and second upcoming pipes.
76
+
77
+ ## simulation-shared/observation/observation.vector.utils.ts
78
+
79
+ ### resolveCoreObservationVectorFromFeatures
80
+
81
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
82
+
83
+ Resolves the compact core vector used for temporal stacking.
84
+
85
+ The core intentionally keeps directly observed kinematic and geometric
86
+ channels while dropping derived one-step predictors that become redundant
87
+ once short-term temporal memory is available.
88
+
89
+ Parameters:
90
+
91
+ - `features` - - Structured observation features.
92
+
93
+ Returns: Core per-frame vector.
94
+
95
+ ### resolveObservationVectorFromFeatures
96
+
97
+ `(features: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures) => number[]`
98
+
99
+ Converts observation features to the canonical 12-value network input vector.
100
+
101
+ Educational note:
102
+ This module owns the network-shape projection so feature semantics can change
103
+ independently from how the policy input is ordered.
104
+
105
+ Parameters:
106
+
107
+ - `features` - - Structured feature object.
108
+
109
+ Returns: Ordered feature vector.
110
+
111
+ ## simulation-shared/observation/observation.features.utils.ts
112
+
113
+ ### clamp
114
+
115
+ `(value: number, min: number, max: number) => number`
116
+
117
+ Clamps a numeric value to the inclusive [min, max] interval.
118
+
119
+ Parameters:
120
+
121
+ - `value` - - Candidate value.
122
+ - `min` - - Inclusive lower bound.
123
+ - `max` - - Inclusive upper bound.
124
+
125
+ Returns: Clamped value.
126
+
127
+ ### clamp01
128
+
129
+ `(value: number) => number`
130
+
131
+ Clamps a numeric value to the inclusive [0, 1] interval.
132
+
133
+ Parameters:
134
+
135
+ - `value` - - Candidate value.
136
+
137
+ Returns: Value clamped between 0 and 1.
138
+
139
+ ### resolveObservationFeatures
140
+
141
+ `(input: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationInput) => import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedObservationFeatures`
142
+
143
+ Builds the shared normalized observation feature set consumed by policies.
144
+
145
+ Educational note:
146
+ This helper stays focused on semantic feature assembly only. Projection into
147
+ the canonical network vectors now lives in the neighboring vector module so
148
+ observation policy and network-shape concerns can evolve independently.
149
+
150
+ Parameters:
151
+
152
+ - `input` - - Observation input bundle.
153
+
154
+ Returns: Structured observation features.
155
+
156
+ ### resolvePredictedBirdYAtFrames
157
+
158
+ `(startYPx: number, initialVerticalVelocityPxPerFrame: number, frameHorizon: number) => number`
159
+
160
+ Predicts bird y-position after a frame horizon with constant gravity.
161
+
162
+ Parameters:
163
+
164
+ - `startYPx` - - Current bird y-position.
165
+ - `initialVerticalVelocityPxPerFrame` - - Initial vertical velocity.
166
+ - `frameHorizon` - - Predicted horizon in simulation frames.
167
+
168
+ Returns: Predicted y-position.
169
+
170
+ ### resolveUpcomingPipes
171
+
172
+ `(pipes: import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike[], birdCenterXPx: number, birdRadiusPx: number, pipeWidthPx: number) => [import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined, import("test/examples/flappy_bird/simulation-shared/simulation-shared.types").SharedPipeLike | undefined]`
173
+
174
+ Resolves the next two upcoming pipes in front of the bird.
175
+
176
+ Parameters:
177
+
178
+ - `pipes` - - Current pipe list.
179
+ - `birdCenterXPx` - - Bird center x-position.
180
+ - `birdRadiusPx` - - Bird radius.
181
+ - `pipeWidthPx` - - Pipe width.
182
+
183
+ Returns: Tuple of first and second upcoming pipes.