Computer Snakes
Posted: Thu Mar 03, 2011 5:45 pm
I thought it'd be fun to try and make the computer play a game of snake.
These snakes may not have turned out very smart but are still pretty fun to watch! I'm hoping to make their movement a lot smarter in future versions. The biggest issue is just them killing each other because they are only looking 1 step ahead. Instead I'd like them to plot a route to the food every time they have to move.
Features:
- You can let as much snakes play as you want.
- You can place obstacles for the snakes to navigate around
- 2 different drawmodes (drawmode "line" is fairly useless but still fun to try)
- You can manually place food
- Change the speed of the snakes
- Change the amount of bodies the snake should grow when eating
- Chang the scale(how big everything is)
- Option to remove dead snakes
Controls:
Up/down to change settings, left/right to decrease/increase values.
Left mouse button places obstacles, right mouse button removes them.
Middle mouse button places food.
Space pauses the game and enter lets you start/restart
Screenshot of a snake navigating around a simple obstacle (this was made with a higher scale setting):
This is what happens with drawmode "line" and _a lot_ of snakes:
http://wtfrandom.com/love%202011-03-01% ... -50-53.png
A movie I made a while ago and posted on the irc channel:
http://www.youtube.com/watch?v=DNMzVhpc_6s
These snakes may not have turned out very smart but are still pretty fun to watch! I'm hoping to make their movement a lot smarter in future versions. The biggest issue is just them killing each other because they are only looking 1 step ahead. Instead I'd like them to plot a route to the food every time they have to move.
Features:
- You can let as much snakes play as you want.
- You can place obstacles for the snakes to navigate around
- 2 different drawmodes (drawmode "line" is fairly useless but still fun to try)
- You can manually place food
- Change the speed of the snakes
- Change the amount of bodies the snake should grow when eating
- Chang the scale(how big everything is)
- Option to remove dead snakes
Controls:
Up/down to change settings, left/right to decrease/increase values.
Left mouse button places obstacles, right mouse button removes them.
Middle mouse button places food.
Space pauses the game and enter lets you start/restart
Screenshot of a snake navigating around a simple obstacle (this was made with a higher scale setting):
This is what happens with drawmode "line" and _a lot_ of snakes:
http://wtfrandom.com/love%202011-03-01% ... -50-53.png
A movie I made a while ago and posted on the irc channel:
http://www.youtube.com/watch?v=DNMzVhpc_6s