add a small stat

This commit is contained in:
Michael Peters 2024-09-04 21:07:52 -07:00
parent a69af98250
commit f2c2e6d86b

View File

@ -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)),
};