NEATSnakeBrain rename

This commit is contained in:
Michael Peters 2024-08-29 15:58:48 -07:00
parent 08c9a27266
commit 72a761eb3d

View File

@ -1,8 +1,9 @@
import { Genome, NEATBrain } from './neat';
import { Genome } from './neat';
import { BOARD_SQUARES } from './canvas';
import { vec2, Vec2 } from './game-engine';
import { completeBipartiteEdges } from './network';
import { Snake, SnakeGameState } from './types';
import { NEATBrain } from './neat-brain';
function isOutOfBounds(square: Vec2) {
return square.x < 0 || square.x >= BOARD_SQUARES || square.y < 0 || square.y >= BOARD_SQUARES;
@ -54,7 +55,7 @@ const BASE_GENOME_SNAKE_BRAIN_NEAT = _BASE_GENOME_SNAKE_BRAIN_NEAT_EDGES.map((e,
data: { innovation: -_BASE_GENOME_SNAKE_BRAIN_NEAT_EDGES.length + idx, weight: 0, enabled: true },
}));
export class SnakeBrainNEAT {
export class NEATSnakeBrain {
brain: NEATBrain;
constructor(brain: NEATBrain) {
@ -63,7 +64,7 @@ export class SnakeBrainNEAT {
static fromGenome(genome: Genome) {
const brain = NEATBrain.fromGenome(genome);
return new SnakeBrainNEAT(brain);
return new NEATSnakeBrain(brain);
}
think(state: SnakeGameState): Vec2 | 'dead' {