Skip to main content

Module snake

Module snake 

Source
Expand description

Multi-player Snake environment

A competitive N-player snake game where agents compete for food.

  • Grid-based world
  • Each snake grows when eating food
  • Game ends when all snakes die (collision with wall/self/others)
  • Rewards: +1 for food, -1 for death, small time penalty to encourage efficiency

Structs§

Food
Food pellet in the game
GameState
Game state for rendering
Position
Position on the grid
Snake
Individual snake in the game
SnakeEnv
Multi-agent Snake environment.

Enums§

Cell
Game cell content
Direction
Direction a snake can move

Functions§

make_snake_env
Create single-agent snake environment

Type Aliases§

SnakeEnvSingle
Backward-compatible alias for SnakeEnv; kept so older training scripts that imported SnakeEnvSingle continue to compile. Prefer SnakeEnv in new code.