Skip to content

A snake AI compatible with Stembolt's 2017 BattleSnake game server

Notifications You must be signed in to change notification settings

stewartlord/battlesnake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BattleSnake!

Screenshot

Setup and Run

npm install
node .

Algorithm

This snake is a significantly modified version of the 'Battle Constrictor' bounty snake that I co-wrote for BattleSnake 2017. This version should be a fair bit smarter because it saw continued development; whereas the original was rushed to completion for the event.

It uses the A* (A-star) search algorithm to find the best paths to food or nodes adjacent to the snake's tail. Path finding employs a heuristic to avoid walls and enemy snakes. Paths are weighted according to how hungry the snake is, how far away food is and whether or not the goal provides a path back to the snake's tail (i.e. a valid subsequent move). If no valid path to food or the snake's tail can be found, the AI will move the snake in the direction with the most open space.

About

A snake AI compatible with Stembolt's 2017 BattleSnake game server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published