I made a 🐍Snake AI 💻
DynamicSquid (5023)

[ currently broken :D ]

Hi!

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!

But.....

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

Enjoy!

You are viewing a single comment. View All
DynamicSquid (5023)

@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