@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
@@ -26,7 +26,12 @@ import {
26
26
  isProfilingDetailsEnabled,
27
27
  profilingStartTimestamp,
28
28
  } from './rngAndTiming';
29
- import type { NetworkNode, NetworkConnection } from '../interfaces';
29
+ import type {
30
+ EvolutionGenomeLike,
31
+ MutationOperationLike,
32
+ NetworkConnection,
33
+ NetworkNode,
34
+ } from './evolutionEngine.types';
30
35
 
31
36
  /** Shared empty array to avoid repeated allocations for missing/invalid arrays. */
32
37
  // Type assertion: Empty array for generic fallback when arrays are invalid
@@ -51,32 +56,11 @@ const BIAS_RESET_HALF_RANGE = 0.1;
51
56
  /** Half-range for connection weight reset in anti-collapse recovery (±0.2). */
52
57
  const CONN_WEIGHT_RESET_HALF_RANGE = 0.2;
53
58
 
54
- // ========== Type Definitions for Runtime Network Structures ==========
55
-
56
- /** Network genome with dynamic runtime properties */
57
- interface RuntimeGenome {
58
- nodes?: NetworkNode[];
59
- connections?: NetworkConnection[];
60
- clone?: () => RuntimeGenome;
61
- mutate?: (method: unknown) => void;
62
- _id?: number;
63
- _parentId?: number;
64
- [key: string]: unknown;
65
- }
66
-
67
- /** Mutation operation from NEAT driver */
68
- interface MutationOperation {
69
- length?: number;
70
- [key: string]: unknown;
71
- }
72
-
73
59
  /** Typed or array-based index buffer for sorting */
74
60
  type IndexBuffer = Uint32Array | Int32Array | number[];
75
61
 
76
- // ========== End Type Definitions ==========
77
-
78
62
  /** Cached reference to mutation ops array (invalidated if driver replaces the reference). */
79
- let cachedMutationOps: MutationOperation[] | null = null;
63
+ let cachedMutationOps: MutationOperationLike[] | null = null;
80
64
 
81
65
  /**
82
66
  * Update plateau state based on current fitness vs baseline.
@@ -601,7 +585,7 @@ export const registerClone = (
601
585
 
602
586
  // Optionally track parent ID.
603
587
  if (parentId != null) {
604
- const runtimeClone = clone as RuntimeGenome;
588
+ const runtimeClone = clone as EvolutionGenomeLike;
605
589
  runtimeClone._parentId = parentId;
606
590
  }
607
591
  } catch {
@@ -664,7 +648,7 @@ export const createChildFromParent = (
664
648
  if (!clone && typeof parent.clone === 'function') {
665
649
  clone = parent.clone();
666
650
  if (clone) {
667
- const runtimeParent = parent as RuntimeGenome;
651
+ const runtimeParent = parent as EvolutionGenomeLike;
668
652
  registerClone(neat, clone, runtimeParent?._id);
669
653
  }
670
654
  }
@@ -984,15 +968,15 @@ const getMutationOps = (
984
968
 
985
969
  if (candidate && cachedMutationOps !== candidate) {
986
970
  if (Array.isArray(candidate)) {
987
- cachedMutationOps = candidate as MutationOperation[];
971
+ cachedMutationOps = candidate as MutationOperationLike[];
988
972
  } else if (candidate && typeof candidate === 'object') {
989
- const maybeMutation = candidate as MutationOperation;
973
+ const maybeMutation = candidate as MutationOperationLike;
990
974
  const maybeLen = maybeMutation.length;
991
975
  if (maybeLen != null && Number.isFinite(maybeLen) && maybeLen >= 0) {
992
- cachedMutationOps = candidate as MutationOperation[];
976
+ cachedMutationOps = candidate as MutationOperationLike[];
993
977
  } else {
994
978
  cachedMutationOps = Object.values(
995
- candidate as Record<string, MutationOperation>,
979
+ candidate as Record<string, MutationOperationLike>,
996
980
  );
997
981
  }
998
982
  } else {
@@ -1038,7 +1022,7 @@ export const ensureOutputIdentity = (
1038
1022
  genomeIndex < populationRef.length;
1039
1023
  genomeIndex++
1040
1024
  ) {
1041
- const genome = populationRef[genomeIndex] as RuntimeGenome;
1025
+ const genome = populationRef[genomeIndex] as EvolutionGenomeLike;
1042
1026
  if (!genome) continue;
1043
1027
 
1044
1028
  const nodesRef: NetworkNode[] = Array.isArray(genome.nodes)
@@ -1300,7 +1284,7 @@ export const pruneSaturatedHiddenOutputs = (
1300
1284
  try {
1301
1285
  const pruneProfilingEnabled = isProfilingDetailsEnabled(state);
1302
1286
  const startProfile = pruneProfilingEnabled ? profilingStartTimestamp() : 0;
1303
- const runtimeGenome = genome as RuntimeGenome;
1287
+ const runtimeGenome = genome as EvolutionGenomeLike;
1304
1288
  const nodesRef = runtimeGenome?.nodes ?? EMPTY_VEC;
1305
1289
 
1306
1290
  const outputCount = getNodeIndicesByType(nodesRef, 'output');
@@ -1465,7 +1449,7 @@ export const antiCollapseRecovery = (
1465
1449
  let totalBiasResets = 0;
1466
1450
 
1467
1451
  for (let sampleIndex = 0; sampleIndex < sampledCount; sampleIndex++) {
1468
- const genome = pooledSampleBuffer[sampleIndex] as RuntimeGenome;
1452
+ const genome = pooledSampleBuffer[sampleIndex] as EvolutionGenomeLike;
1469
1453
  if (!genome) continue;
1470
1454
 
1471
1455
  try {
@@ -1515,7 +1499,7 @@ export const reinitializeGenomeOutputsAndWeights = (
1515
1499
  genome: unknown,
1516
1500
  ): { connReset: number; biasReset: number } => {
1517
1501
  try {
1518
- const runtimeGenome = genome as RuntimeGenome;
1502
+ const runtimeGenome = genome as EvolutionGenomeLike;
1519
1503
  const nodesList: NetworkNode[] = Array.isArray(runtimeGenome?.nodes)
1520
1504
  ? runtimeGenome.nodes
1521
1505
  : [];
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  import type { Neat, Network } from '../../../../src/neataptic';
19
- import { EngineState } from './engineState';
19
+ import type { EngineState } from './engineState';
20
20
  import { drawFastRandom, resolveRngParameters } from './rngAndTiming';
21
21
 
22
22
  /** Weight initialization minimum value for warm-start connections. */
@@ -5,9 +5,8 @@
5
5
  * shared state without relying on class statics.
6
6
  */
7
7
 
8
+ import type { EngineState, RngCacheParameters } from './engineState.types';
8
9
  import {
9
- EngineState,
10
- RngCacheParameters,
11
10
  DEFAULT_RNG_CACHE_BATCH_SIZE,
12
11
  ensureRngCacheBatch,
13
12
  reseedRngState,
@@ -7,7 +7,7 @@
7
7
  * 3. Centralise RNG parameter resolution for sampling paths to keep behaviour deterministic under shared state.
8
8
  */
9
9
 
10
- import { EngineState } from './engineState';
10
+ import type { EngineState } from './engineState.types';
11
11
  import { drawFastRandom, resolveRngParameters } from './rngAndTiming';
12
12
  import { MazeUtils } from '../mazeUtils';
13
13
 
@@ -5,11 +5,8 @@
5
5
  * shared {@link EngineState}. They keep the façade lean by encapsulating heuristics for logits
6
6
  * ring sizing, telemetry scratch sizing, and connection flag pooling.
7
7
  */
8
- import {
9
- EngineState,
10
- TelemetryScratchRequest,
11
- initialiseTelemetryScratch,
12
- } from './engineState';
8
+ import type { EngineState, TelemetryScratchRequest } from './engineState.types';
9
+ import { initialiseTelemetryScratch } from './engineState';
13
10
 
14
11
  /**
15
12
  * Shape describing the parameters used when ensuring the logits ring capacity.
@@ -1,36 +1,14 @@
1
+ import type { EvolutionHostAdapter } from './evolutionEngine.types';
2
+
1
3
  /**
2
- * setupHelpers.ts
4
+ * Setup helpers for the ASCII maze evolution engine.
3
5
  *
4
- * Environment and setup utilities for the evolution engine.
5
- // Return return async (): Promise<void> => {
6
- // Polling loop: after each tick, if the cooperative pause flag is set, wait another tick.
7
- // This keeps CPU usage minimal while allowing the host to pause/resume the evolution loop.
8
- while (true) {
9
- await preferredTick();
10
- // Note: using a permissive read of the global pause flag; undefined => not paused.
11
- if (!(globalThis as Record<string, unknown>).asciiMazePaused) return;
12
- // otherwise continue and await another tick before re-checking
13
- }
14
- };
15
- };flush function used by the evolution loop.
16
- return async (): Promise<void> => {
17
- // Polling loop: after each tick, if the cooperative pause flag is set, wait another tick.
18
- // This keeps CPU usage minimal while allowing the host to pause/resume the evolution loop.
19
- while (true) {
20
- await preferredTick();
21
- // Note: using a permissive read of the global pause flag; undefined => not paused.
22
- if (!(globalThis as Record<string, unknown>).asciiMazePaused) return;
23
- // otherwise continue and await another tick before re-checking
24
- }
25
- };
26
- };ibilities:
27
- * - Create cooperative frame-yielding functions for async evolution loops
28
- * - Initialize Node.js filesystem persistence helpers (fs, path)
29
- * - Build resilient logging writers with fallback chains
6
+ * Responsibilities:
7
+ * - Create cooperative frame-yielding helpers for async evolution loops.
8
+ * - Initialize Node.js persistence helpers when available.
9
+ * - Build resilient logging writers with dashboard and console fallbacks.
30
10
  *
31
- * All functions are pure/side-effect-free except where explicitly documented.
32
- *
33
- * @module setupHelpers
11
+ * @module evolutionEngine/setupHelpers
34
12
  */
35
13
 
36
14
  /**
@@ -66,22 +44,24 @@ export interface DashboardManagerLike {
66
44
  * Behaviour:
67
45
  * - Prefers `requestAnimationFrame` when available (browser hosts)
68
46
  * - Falls back to `setImmediate` when available (Node) or `setTimeout(...,0)` otherwise
69
- * - Respects a cooperative pause flag (`globalThis.asciiMazePaused`) by polling between ticks
70
- * without busy-waiting. The returned function resolves once a single new frame/tick is available
71
- * and the pause flag is not set
47
+ * - Respects an optional host adapter pause callback by polling between ticks without busy-waiting
48
+ * - Resolves once a single new frame or tick is available and the host is not paused
72
49
  *
73
50
  * Steps:
74
51
  * 1. Choose the preferred tick function based on the host runtime
75
- * 2. When called, await the preferred tick; if `asciiMazePaused` is true poll again after the tick
52
+ * 2. When called, await the preferred tick; if the host adapter reports pause, poll again after the tick
76
53
  * 3. Resolve once a tick passed while not paused
77
54
  *
55
+ * @param hostAdapter - Optional host adapter that owns cooperative pause state.
78
56
  * @returns A function that yields cooperatively to the next animation frame / tick.
79
57
  *
80
58
  * @example
81
59
  * const flushToFrame = makeFlushToFrame();
82
60
  * await flushToFrame(); // yields to next frame/tick
83
61
  */
84
- export const makeFlushToFrame = (): (() => Promise<void>) => {
62
+ export const makeFlushToFrame = (
63
+ hostAdapter?: EvolutionHostAdapter,
64
+ ): (() => Promise<void>) => {
85
65
  // Helper factories for the three tick primitives; each returns a Promise that resolves on the next tick.
86
66
  const rafTick = () =>
87
67
  new Promise<void>((resolve) =>
@@ -117,13 +97,26 @@ export const makeFlushToFrame = (): (() => Promise<void>) => {
117
97
  // This keeps CPU usage minimal while allowing the host to pause/resume the evolution loop.
118
98
  while (true) {
119
99
  await preferredTick();
120
- // Note: using a permissive read of the global pause flag; undefined => not paused.
121
- if (!(globalThis as Record<string, unknown>).asciiMazePaused) return;
100
+ if (!isPauseRequested(hostAdapter)) return;
122
101
  // otherwise continue and await another tick before re-checking
123
102
  }
124
103
  };
125
104
  };
126
105
 
106
+ /**
107
+ * Read host-controlled pause state without letting host errors break the engine.
108
+ *
109
+ * @param hostAdapter - Optional host adapter implementing pause polling.
110
+ * @returns True when the host asks the engine to remain paused.
111
+ */
112
+ function isPauseRequested(hostAdapter?: EvolutionHostAdapter): boolean {
113
+ try {
114
+ return hostAdapter?.isPauseRequested?.() === true;
115
+ } catch {
116
+ return false;
117
+ }
118
+ }
119
+
127
120
  /**
128
121
  * Initialize persistence helpers (Node `fs` & `path`) when available and ensure the target
129
122
  * directory exists. This helper intentionally does nothing in browser-like hosts.
@@ -7,56 +7,18 @@
7
7
  */
8
8
  import type { Neat, Network } from '../../../../src/neataptic';
9
9
  import type { GenomeDetailed } from '../../../../src/neat/neat.types';
10
+ import type { EngineState } from './engineState.types';
11
+ import type {
12
+ EvolutionGenomeLike,
13
+ NetworkNode,
14
+ TelemetryNeatLike,
15
+ } from './evolutionEngine.types';
10
16
  import {
11
- EngineState,
12
17
  ensureVisitedHashCapacity,
13
18
  initialiseTelemetryScratch,
14
19
  } from './engineState';
15
20
  import { getTail, sampleIntoScratch } from './sampling';
16
21
 
17
- /**
18
- * Runtime type for NEAT instance with dynamic properties.
19
- * NEAT instances may have population, getTelemetry and other runtime methods.
20
- */
21
- interface RuntimeNeat {
22
- population?: unknown[];
23
- getTelemetry?: () => unknown;
24
- [key: string]: unknown;
25
- }
26
-
27
- /**
28
- * Runtime type for network connection with dynamic properties.
29
- * Connections may have enabled, weight, and other runtime-added fields.
30
- */
31
- interface RuntimeConnection {
32
- enabled?: boolean;
33
- weight?: number;
34
- [key: string]: unknown;
35
- }
36
-
37
- /**
38
- * Runtime type for NEAT genome/network with dynamic properties.
39
- * Genomes may have nodes, connections, score, species and runtime tracking fields.
40
- */
41
- interface RuntimeGenome {
42
- nodes?: RuntimeNode[];
43
- connections?: RuntimeConnection[];
44
- score?: number;
45
- species?: number | null;
46
- _lastStepOutputs?: unknown[];
47
- [key: string]: unknown;
48
- }
49
-
50
- /**
51
- * Runtime type for network node with dynamic properties.
52
- * Nodes may have type, bias, and other runtime-added fields.
53
- */
54
- interface RuntimeNode {
55
- type?: string;
56
- bias?: number;
57
- [key: string]: unknown;
58
- }
59
-
60
22
  /**
61
23
  * Telemetry tag emitted when logging action-entropy statistics.
62
24
  * @example
@@ -122,8 +84,6 @@ type TelemetryWriter = (message: string) => void;
122
84
  interface GenerationResult {
123
85
  /** Path taken by the agent (array of [x, y] coordinate pairs). */
124
86
  path?: ReadonlyArray<[number, number]>;
125
- /** Additional properties may exist but are not strongly typed. */
126
- [key: string]: unknown;
127
87
  }
128
88
 
129
89
  /**
@@ -208,7 +168,7 @@ export const logOutputBiasStats = ({
208
168
  }: LogOutputBiasParams): void => {
209
169
  if (typeof safeWrite !== 'function') return;
210
170
 
211
- const runtimeFittest = fittest as RuntimeGenome | undefined;
171
+ const runtimeFittest = fittest as EvolutionGenomeLike | undefined;
212
172
  const nodeList = runtimeFittest?.nodes ?? [];
213
173
 
214
174
  try {
@@ -279,7 +239,7 @@ export const logLogitsAndCollapse = ({
279
239
 
280
240
  try {
281
241
  // Step 1: Obtain the recent logits history from the fittest candidate.
282
- const runtimeFittest = fittest as RuntimeGenome | undefined;
242
+ const runtimeFittest = fittest as EvolutionGenomeLike | undefined;
283
243
  const logitsHistory: number[][] =
284
244
  (runtimeFittest?._lastStepOutputs as number[][]) ?? EMPTY_VECTOR;
285
245
  if (logitsHistory.length === 0) return;
@@ -414,7 +374,7 @@ export const logDiversity = ({
414
374
  sampleSize = DEFAULT_SAMPLE_SIZE,
415
375
  }: LogDiversityParams): void => {
416
376
  if (typeof safeWrite !== 'function') return;
417
- const runtimeNeat = neat as RuntimeNeat | undefined;
377
+ const runtimeNeat = neat as TelemetryNeatLike | undefined;
418
378
  if (!runtimeNeat || !Array.isArray(runtimeNeat.population)) return;
419
379
 
420
380
  try {
@@ -452,7 +412,7 @@ export const collectTelemetryTail = (
452
412
  tailLength = 10,
453
413
  ): unknown => {
454
414
  // Step 1: Guard against missing telemetry providers so callers can skip optional handling.
455
- const runtimeNeat = neat as RuntimeNeat | undefined;
415
+ const runtimeNeat = neat as TelemetryNeatLike | undefined;
456
416
  if (!runtimeNeat || typeof runtimeNeat.getTelemetry !== 'function')
457
417
  return undefined;
458
418
 
@@ -671,7 +631,7 @@ const countDistinctCoordinatesHashed = (
671
631
  */
672
632
  const computeDiversityMetrics = (
673
633
  state: EngineState,
674
- neat: RuntimeNeat,
634
+ neat: TelemetryNeatLike,
675
635
  sampleSize: number,
676
636
  ): { speciesUniqueCount: number; simpson: number; weightStd: number } => {
677
637
  // Step 1: Normalise the population reference to a safe array view.
@@ -700,7 +660,7 @@ const computeDiversityMetrics = (
700
660
  let speciesUniqueCount = 0;
701
661
  let individualCount = 0;
702
662
  for (let genomeIndex = 0; genomeIndex < populationLength; genomeIndex++) {
703
- const genome = population[genomeIndex] as RuntimeGenome | undefined;
663
+ const genome = population[genomeIndex] as EvolutionGenomeLike | undefined;
704
664
  const speciesId =
705
665
  (genome && genome.species != null ? genome.species : -1) | 0;
706
666
 
@@ -751,16 +711,14 @@ const computeDiversityMetrics = (
751
711
  for (let sampleIndex = 0; sampleIndex < sampledLength; sampleIndex++) {
752
712
  const genome = sampleBuffer[sampleIndex] as GenomeDetailed | undefined;
753
713
  const connections = Array.isArray(genome?.connections)
754
- ? (genome.connections as RuntimeConnection[])
714
+ ? genome.connections
755
715
  : EMPTY_VECTOR;
756
716
  for (
757
717
  let connectionIndex = 0;
758
718
  connectionIndex < connections.length;
759
719
  connectionIndex++
760
720
  ) {
761
- const connection = connections[connectionIndex] as
762
- | RuntimeConnection
763
- | undefined;
721
+ const connection = connections[connectionIndex];
764
722
  if (connection && connection.enabled !== false) {
765
723
  const weight = Number.isFinite(connection.weight)
766
724
  ? connection.weight!
@@ -786,7 +744,7 @@ const computeDiversityMetrics = (
786
744
  /** Gather indices of nodes matching `nodeType` into the pooled scratch buffer. */
787
745
  const collectNodeIndicesByType = (
788
746
  state: EngineState,
789
- nodes: RuntimeNode[] | undefined,
747
+ nodes: NetworkNode[] | undefined,
790
748
  nodeType: string,
791
749
  ): number => {
792
750
  // Step 1: Exit early when the node list is absent or already empty.
@@ -818,7 +776,7 @@ const collectNodeIndicesByType = (
818
776
  /** Compute mean, standard deviation and CSV string for output-node biases. */
819
777
  const computeOutputBiasStats = (
820
778
  state: EngineState,
821
- nodes: RuntimeNode[],
779
+ nodes: NetworkNode[],
822
780
  outputCount: number,
823
781
  ): { mean: number; std: number; biasesStr: string } => {
824
782
  // Step 1: Initialise telemetry scratch sized to the output-node count.
@@ -17,8 +17,8 @@
17
17
 
18
18
  import type { Neat, Network } from '../../../../src/neataptic';
19
19
  import { methods } from '../../../../src/neataptic';
20
- import type { RngCacheParameters } from './engineState';
21
- import { EngineState, initialiseTelemetryScratch } from './engineState';
20
+ import type { EngineState, RngCacheParameters } from './engineState.types';
21
+ import { initialiseTelemetryScratch } from './engineState';
22
22
  import { drawFastRandom, readHighResolutionTime } from './rngAndTiming';
23
23
  import { sampleArray } from './sampling';
24
24
 
@@ -29,52 +29,19 @@ import {
29
29
  prepareLoopHelpers,
30
30
  emitProfileSummary,
31
31
  } from './evolutionEngine/evolutionLoop';
32
+ import { resolveMazeEvolutionPhaseOutcome as resolveMazeEvolutionPhaseOutcomeImpl } from './evolutionEngine/curriculumPhase';
32
33
  import { printNetworkStructure } from './evolutionEngine/networkInspection';
33
- import { INetwork, IRunMazeEvolutionOptions } from './interfaces';
34
+ import type { INetwork } from './interfaces';
35
+ import type {
36
+ IRunMazeEvolutionOptions,
37
+ MazeEvolutionCurriculumPhaseOutcome,
38
+ MazeEvolutionRunResult,
39
+ NetworkConnection,
40
+ NetworkNode,
41
+ SpeciesHistoryHost,
42
+ } from './evolutionEngine/evolutionEngine.types';
34
43
  import type Network from '../../../src/architecture/network';
35
44
 
36
- /**
37
- * Runtime type for network node with dynamic properties.
38
- * Nodes may have type, connections, and other runtime-added fields.
39
- */
40
- interface RuntimeNetworkNode {
41
- type?: string;
42
- connections?: {
43
- out?: RuntimeNetworkConnection[];
44
- [key: string]: unknown;
45
- };
46
- [key: string]: unknown;
47
- }
48
-
49
- /**
50
- * Runtime type for network connection with dynamic properties.
51
- * Connections track from/to nodes and enabled state.
52
- */
53
- interface RuntimeNetworkConnection {
54
- from?: RuntimeNetworkNode;
55
- to?: RuntimeNetworkNode;
56
- enabled?: boolean;
57
- [key: string]: unknown;
58
- }
59
-
60
- /**
61
- * Runtime type for evolution result with dynamic exit reason.
62
- * Results may include exitReason from simulation outcomes.
63
- */
64
- interface RuntimeEvolutionResult {
65
- exitReason?: string;
66
- [key: string]: unknown;
67
- }
68
-
69
- /**
70
- * Runtime type for EvolutionEngine class with dynamic properties.
71
- * Engine may have _speciesHistory for telemetry tracking.
72
- */
73
- interface RuntimeEvolutionEngine {
74
- _speciesHistory?: unknown[];
75
- [key: string]: unknown;
76
- }
77
-
78
45
  /**
79
46
  * EvolutionEngine: Thin façade for NEAT-based maze solving.
80
47
  *
@@ -91,6 +58,7 @@ interface RuntimeEvolutionEngine {
91
58
  *
92
59
  * Public API (frozen entry points):
93
60
  * - `runMazeEvolution(options)`: Main entry point for maze solving
61
+ * - `resolveMazeEvolutionPhaseOutcome(result, previousBest, minProgressToPass)`: Shared curriculum-phase interpretation helper
94
62
  * - `printNetworkStructure(network)`: Debug utility for network topology
95
63
  * - `setDeterministic(seed?)`: Enable deterministic mode
96
64
  * - `clearDeterministic()`: Disable deterministic mode
@@ -195,7 +163,7 @@ export class EvolutionEngine {
195
163
  * @internal - Small helper used by various engine methods; retained for internal use.
196
164
  */
197
165
  static #getNodeIndicesByType(
198
- nodes: RuntimeNetworkNode[] | undefined,
166
+ nodes: NetworkNode[] | undefined,
199
167
  type: string,
200
168
  ): number {
201
169
  if (!Array.isArray(nodes) || nodes.length === 0) return 0;
@@ -221,10 +189,10 @@ export class EvolutionEngine {
221
189
  * @internal - Small helper used by network analysis methods; retained for internal use.
222
190
  */
223
191
  static #collectHiddenToOutputConns(
224
- hiddenNode: RuntimeNetworkNode,
225
- nodesRef: RuntimeNetworkNode[],
192
+ hiddenNode: NetworkNode,
193
+ nodesRef: NetworkNode[],
226
194
  outputCount: number,
227
- ): RuntimeNetworkConnection[] {
195
+ ): NetworkConnection[] {
228
196
  if (
229
197
  !hiddenNode?.connections ||
230
198
  !Array.isArray(nodesRef) ||
@@ -243,9 +211,7 @@ export class EvolutionEngine {
243
211
  hiddenOutBuffer.length = 0;
244
212
  const outgoing = hiddenNode.connections.out ?? EvolutionEngine.#EMPTY_VEC;
245
213
  for (let outIndex = 0; outIndex < outgoing.length; outIndex++) {
246
- const candidate = outgoing[
247
- outIndex
248
- ] as unknown as RuntimeNetworkConnection;
214
+ const candidate = outgoing[outIndex] as unknown as NetworkConnection;
249
215
  if (!candidate || candidate.enabled === false) continue;
250
216
  for (
251
217
  let outputIndex = 0;
@@ -295,7 +261,9 @@ export class EvolutionEngine {
295
261
  * console.log(`Best score: ${result.bestResult.score}`);
296
262
  * EvolutionEngine.printNetworkStructure(result.bestNetwork);
297
263
  */
298
- static async runMazeEvolution(options: IRunMazeEvolutionOptions) {
264
+ static async runMazeEvolution(
265
+ options: IRunMazeEvolutionOptions,
266
+ ): Promise<MazeEvolutionRunResult> {
299
267
  // 1) Normalise and validate options (descriptive names, defaulting).
300
268
  const opts = normalizeRunOptions(
301
269
  options,
@@ -443,7 +411,7 @@ export class EvolutionEngine {
443
411
  REDUCED_TELEMETRY: EvolutionEngine.#STATE.toggles.reducedTelemetry,
444
412
  DISABLE_BALDWIN: EvolutionEngine.#STATE.toggles.disableBaldwinPhase,
445
413
  },
446
- ((EvolutionEngine as unknown as RuntimeEvolutionEngine)
414
+ ((EvolutionEngine as unknown as SpeciesHistoryHost)
447
415
  ._speciesHistory as unknown as number[]) ??
448
416
  (EvolutionEngine.#EMPTY_VEC as unknown as number[]),
449
417
  );
@@ -484,9 +452,7 @@ export class EvolutionEngine {
484
452
  bestNetwork,
485
453
  bestResult,
486
454
  neat,
487
- exitReason:
488
- (bestResult as unknown as RuntimeEvolutionResult).exitReason ??
489
- 'incomplete',
455
+ exitReason: bestResult?.exitReason ?? 'incomplete',
490
456
  };
491
457
  }
492
458
 
@@ -520,3 +486,37 @@ export class EvolutionEngine {
520
486
  printNetworkStructure(EvolutionEngine.#STATE, network);
521
487
  }
522
488
  }
489
+
490
+ /**
491
+ * Stable curriculum-phase compatibility surface exposed from the engine facade.
492
+ *
493
+ * @remarks
494
+ * The implementation lives in `evolutionEngine/curriculumPhase.ts`, but
495
+ * callers that already import from `./evolutionEngine` should keep using this
496
+ * façade export so the dedicated engine folder retains ownership without
497
+ * forcing import churn across browser-entry, tests, or downstream examples.
498
+ *
499
+ * @param evolutionResult - Stable engine result returned by `runMazeEvolution()`.
500
+ * @param previousBestNetwork - Previously carried curriculum winner, if one exists.
501
+ * @param minProgressToPass - Progress threshold required before the curriculum advances.
502
+ * @returns Shared curriculum outcome describing solve status and next carry-over winner.
503
+ *
504
+ * @example
505
+ * ```ts
506
+ * const phaseOutcome = resolveMazeEvolutionPhaseOutcome(result, previousBest, 95);
507
+ * if (phaseOutcome.solved) {
508
+ * previousBest = phaseOutcome.nextBestNetwork;
509
+ * }
510
+ * ```
511
+ */
512
+ export const resolveMazeEvolutionPhaseOutcome = (
513
+ evolutionResult: MazeEvolutionRunResult,
514
+ previousBestNetwork: INetwork | undefined,
515
+ minProgressToPass: number,
516
+ ): MazeEvolutionCurriculumPhaseOutcome => {
517
+ return resolveMazeEvolutionPhaseOutcomeImpl(
518
+ evolutionResult,
519
+ previousBestNetwork,
520
+ minProgressToPass,
521
+ );
522
+ };
@@ -1,10 +1,10 @@
1
1
  // Fitness evaluation logic for maze solving
2
2
  // Exports: FitnessEvaluator class with static methods
3
3
 
4
- import { INetwork } from './interfaces'; // Added INetwork import
4
+ import type { INetwork } from './interfaces';
5
5
  import { MazeUtils } from './mazeUtils';
6
6
  import { MazeMovement } from './mazeMovement';
7
- import { IFitnessEvaluationContext } from './interfaces';
7
+ import type { IFitnessEvaluationContext } from './fitness.types';
8
8
 
9
9
  /**
10
10
  * The `FitnessEvaluator` class is responsible for calculating the fitness of a neural network