This project centers on a specialized Snake bot designed to navigate the game board efficiently. It excels at discovering optimal moves and adapting to changing conditions.
- Outperforms similar algorithms with higher success rates.
- Achieves fewer steps than the “almighty” algorithm.
Although this Snake bot outperforms the “almighty” algorithm, it cannot achieve 100% success. The “almighty” algorithm follows a Hamiltonian path from the start, ensuring it covers every cell. In contrast, this bot does not follow a Hamiltonian path, which can lead to situations where most of the cells are occupied, and it's not possible to switch to a state that is a Hamiltonian path (which the snake should reach to complete).
- Build the project via the provided Makefile.
- Run the executable with
./build/esnake. - Alternatively, you can use the
run.shscript to start the Snake game.
You can customize the game by providing command line arguments when running the executable:
- Width: Set the width of the game board.
- Height: Set the height of the game board.
- Seed: Provide a seed for the random number generator to ensure reproducible results.
Example usage:
./bin/esnake [width] [height] [seed]If no arguments are provided, the default values will be used.
- Arrow Keys: Control the snake's direction (when bot mode is off).
- C: Decrease the game speed.
- X: Increase the game speed.
- B: Toggle bot mode on/off. (bot is enabled by default)
Enjoy testing this experiment in AI-driven Snake gameplay!
