From f2c2e6d86ba461088f539e7a33804310ea666993 Mon Sep 17 00:00:00 2001 From: Michael Peters Date: Wed, 4 Sep 2024 21:07:52 -0700 Subject: [PATCH] add a small stat --- src/site/snake/canvas.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/site/snake/canvas.ts b/src/site/snake/canvas.ts index 575da20..e08e37e 100644 --- a/src/site/snake/canvas.ts +++ b/src/site/snake/canvas.ts @@ -17,6 +17,7 @@ import { resetGlobalIDs, } from './neat'; import { BASE_GENOME_SNAKE_BRAIN_NEAT, NEATSnakeBrain } from './neat-snake-brain'; +import { mapInvert, mapMap } from './util'; const BOARD_SIZE = 600; // px const SQUARE_SIZE = 30; // px @@ -216,6 +217,7 @@ export default function runCanvas(canvas: HTMLCanvasElement, pipeRef: MutableRef const { nextPopulation, nextReps } = computeNextGeneration(population, fitness, NGC); population = nextPopulation; reps = nextReps; + console.log({ nextPopulationSizes: mapMap(mapInvert(nextPopulation), (k, v) => [k, v.size]) }); trainer = { labs: Array.from(population.keys()).map(g => makeLab(nextLabId++, g)), };