Examples

Interactive demos showcasing NeatapticTS concepts in the browser. Each example is self‑contained and built with native ES2023 features – no transpilation.

Tip: Open DevTools console while an example runs to inspect logged telemetry or errors.

asciiMaze (Neuro‑evolving maze agent)

Demonstrates a simple environment where agents must traverse an ASCII maze layout. The population evolves weights / topology over generations; progress prints in real time.

If the demo fails to load, ensure the build step npm run build:ascii-maze has produced docs/assets/ascii-maze.bundle.js.

Behaviour & Telemetry

Programmatic API (ESM)

Import the start function and optionally supply an AbortSignal for cancellation.

import { start } from './asciiMaze/browser-entry.js';

const controller = new AbortController();
const run = await start('#ascii-maze-output', { signal: controller.signal });

const unsubscribe = run.onTelemetry(t => {
  console.log(`Gen ${t.generation} best ${t.bestFitness} (${t.gensPerSecond.toFixed(2)} gen/s)`);
});

// Early stop (either call stop or abort the signal)
// run.stop();
controller.abort();

await run.done;
unsubscribe();

API surface:

Telemetry snapshot (fields may extend):

interface TelemetrySnapshot {
  generation: number;
  bestFitness: number;
  gensPerSecond: number;
  exitReason?: string;          // 'cancelled' | 'aborted' | 'solved' | etc.
  details?: Record<string, any>; // rich metrics bundle
}

Legacy global usage (compatibility):

<script src="/assets/ascii-maze.bundle.js"></script>
<script>
  window.asciiMaze.start(); // preferred
  // window.asciiMazeStart(); // deprecated alias logs a warning
</script>

Embedding Notes

The iframe isolation keeps demo CSS / JS from interfering with site chrome. Now that an ESM start() is exported, future inline embedding can attach directly to a provided container without iframe overhead (see enhancement plan).


Additional examples will appear here as they are added.

Generated from source JSDoc • GitHub