This is an example of a movement algorithm/pattern to win the snake game. With this algorithm it will always run the entire map.
<iframe width="560" height="315" src="https://www.youtube.com/embed/fsR_MFOShEI" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>- Youtube vide: https://www.youtube.com/watch?v=fsR_MFOShEI
- Codepen demo: https://codepen.io/201flaviosilva/pen/QWQqEGq
Clone the project and move it into the HamiltonianCycle
folder:
git clone https://github.com/201flaviosilva-labs/snake-ai.git
cd snake-ai/HamiltonianCycle
Double click in the index.html
file.