Skip to content
I made a 🐍Snake AI 💻
Profile icon
has Hacker Plan

[ currently broken :D ]


I made Snake. You can control it using WASD, or the arrow keys. Eat the red apples, and don't crash into the walls or yourself!


When you press space, it uh... helps you out a little :)


You are viewing a single comment. View All
Profile icon

@Coder100 Thanks!! It's just a simplified version of the A* algorithm. What it does is it assigns each cell a value:

gcost = dist(cell, snake) hcost = dist(cell, apple) fcost = gcost + hcost

Cell with the lowest fcost get's chosen.

I spent an entire day tinkering with which algorithm was best, and how to optimize it, and all that stuff, and I ended up with this. It's not the best, but it's something