Want to play snake? Go ahead! ---> Take me to it. Try to beat my highscore of 97!
Recently, I looked at the code I had written, and thought: I could do better now. So I have.
I still want to make a bot for snake, although I've lost interest in the other goals.
This project started two years ago when I made a snake game while learning JavaScript.
Recently I looked at the code I had written, and cringed. So I made a fresh version of the game 'snake' with my current knowledge.
The fresh version is called 'snake.html', which references 'snake.js'. The old version is called 'SnakeGameOld.html', which references 'SnakeGameOld.js'. The code has not been touched for two years, and will never be updated.
The end goal is to develop an algorithm that will beat the snake game everytime. (With A*)
The restrictions to the algorithm are similar to a humans, in the sense that the information given to it is limited. Only including:
‣ A one dimensional array of objects representing the segments of the snake,
in order from tail to head, each containing an 'x' and 'y' property.
‣ An object representing the location of the apple,
containing two integer properties 'x' and 'y'.
In addition, it is only allowed to affect the game by simulating user-input.
Things I plan to add to the code:
‣ A settings panel for the user, possible variables they could change:
‣ Game speed.
‣ Number of columns.
‣ Number of rows.
‣ Colors.
‣ Use an icon for the apple.
‣ Draw only what is needed to the canvas.
‣ A 'playerBot' which is described above.
‣ Make an implementation in Java.
This entire document is subject to change at any time. (Especially if I make typos.)