diff --git a/src/site/snake/snake-brain-neat.ts b/src/site/snake/neat-snake-brain.ts similarity index 96% rename from src/site/snake/snake-brain-neat.ts rename to src/site/snake/neat-snake-brain.ts index 8ea89c5..5d83cb2 100644 --- a/src/site/snake/snake-brain-neat.ts +++ b/src/site/snake/neat-snake-brain.ts @@ -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' {