Designing a simple snake A.I

Posted by DillPixel on Game Development See other posts from Game Development or by DillPixel
Published on 2012-08-08T16:10:33Z Indexed on 2012/09/07 21:51 UTC
Read the original article Hit count: 276

Filed under:
|
|

I've looked at some stuff online regarding this specific topic, and a lot of the info that I read involved graphs and path finding.

I really don't want to get involved in something too complex & out of my level, and also I don't need my snake to be that intelligent (it will be a large board with the snake not growing in size on every munch).

How could you structure a simpler AI for the snake that gets the job done relatively well? I would be able to get the snake to move towards the food item correctly, but my issue is that I'm not sure how to deal with the snake colliding with itself. Say the snake has a look ahead, and it finds that its tail is in the way, it could change direction, but what happens next?

Any ideas on how to tackle this? Should the snake build an instruction set from every square, or should it think on the go?

© Game Development or respective owner

Related posts about c++

Related posts about game-design