From f607e83b0ddee4505e6c661550409b369390c8c8 Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Sat, 10 Jan 2026 10:33:54 +1100 Subject: [PATCH] Update config --- src/apps/SnakeAI/SnakeAI.tsx | 6 +++--- src/lib/snakeAI/game.ts | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/apps/SnakeAI/SnakeAI.tsx b/src/apps/SnakeAI/SnakeAI.tsx index 79972f8..cf2a0bc 100644 --- a/src/apps/SnakeAI/SnakeAI.tsx +++ b/src/apps/SnakeAI/SnakeAI.tsx @@ -17,11 +17,11 @@ import type { EvolutionConfig } from '../../lib/snakeAI/types'; import './SnakeAI.css'; const DEFAULT_CONFIG: EvolutionConfig = { - populationSize: 25, + populationSize: 36, mutationRate: 0.1, eliteCount: 5, gridSize: 20, - maxGameSteps: 500, + maxGameSteps: 20000, }; export default function SnakeAI() { @@ -130,7 +130,7 @@ export default function SnakeAI() { individuals={population.individuals} gridSize={config.gridSize} count={config.populationSize} - columns={5} + columns={6} /> diff --git a/src/lib/snakeAI/game.ts b/src/lib/snakeAI/game.ts index 8c75cc8..3c316df 100644 --- a/src/lib/snakeAI/game.ts +++ b/src/lib/snakeAI/game.ts @@ -36,7 +36,7 @@ export function createGame(gridSize: number = 20): GameState { export function step(state: GameState, action: Action): GameState { if (!state.alive) return state; - const STARVATION_LIMIT = 200; // Die if no food for 200 steps + const STARVATION_LIMIT = 100; // Die if no food for 100 steps // Update direction based on action (turn left/right or go straight) const newDirection = (state.direction + action + 4) % 4;