This release is 136 versions behind 0.168.1 — the latest version of @stsoftware/neat-ai. Jump to latest
@stsoftware/neat-ai@0.121.0Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Built and signed on GitHub Actions
NEAT Neural Network. This project is a unique implementation of a neural network based on the NEAT (NeuroEvolution of Augmenting Topologies) algorithm, written in DenoJS using TypeScript.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566import type { CreatureInternal } from "../src/architecture/CreatureInterfaces.ts"; import { assert, assertEquals } from "jsr:@std/assert@^1.0.8"; import { Creature } from "../src/Creature.ts"; ((globalThis as unknown) as { DEBUG: boolean }).DEBUG = true; Deno.test("generateUUID", () => { const creature: CreatureInternal = { neurons: [ { bias: 0, index: 5, type: "hidden", squash: "IDENTITY", }, { bias: 0.1, index: 6, type: "output", squash: "IDENTITY", }, { bias: 0.2, index: 7, type: "output", squash: "IDENTITY", }, ], synapses: [ { weight: -0.1, from: 1, to: 5, }, { weight: 0.2, from: 4, to: 7, }, { weight: 0.1, from: 5, to: 6, }, ], input: 5, output: 2, tags: [ { name: "hello", value: "world" }, ], score: -0.1111, }; const n1 = Creature.fromJSON(creature); n1.neurons.forEach((n) => { assert(n.uuid, "Must have a UUID"); }); const j1 = n1.exportJSON(); const n2 = Creature.fromJSON(j1); for (let i = 0; i < n1.neurons.length; i++) { assertEquals(n1.neurons[i].uuid, n2.neurons[i].uuid); } });