News:

Building a 3D Ray Tracer  By stevmjon

Main Menu

A.I. For Snake Game???

Started by ScottieB, January 24, 2015, 02:41:24 PM

Previous topic - Next topic

ScottieB

Can anyone help me with the A.I. for a snake game.
I understand A* Pathfinding but that not enough not the whole picture.  There's missing pieces of that puzzle.
Does anyone know how to program anything like this here?
I tried only material but it's inconclusive or over my head.
A* is shortest path to target with obsticale avoidance but it's still missing stuff.
You would think that AI Would be most important here not so much just fancy graphics.
Please if anyone can help explain or even has coded this before please share some thooughts or maybe help me understand some codeing.
Thanks!!!
ScottieB

monkeybot

what do you want it to do? you probably need several  layers of AI to make something seem intelligent.

ATLUS


kevin


Tracing a line between the source and target(s), to see if the target is even visible would be a starting place.  And by visible, I mean nothing solid is in the way such as the players tail, or a wall or something.   If there's a direct line of sight, then that's your path.   A flood fill can also be used to check the target is even reachable from the sources location.   



ScottieB

#4
Kevin's reply was more what I was looking for.

1.) A* Shortest path
2.) Give up on 1.) if no direct path from head to tail.  S0 it doesn't trap itself or hit anything else.

So 2.) is a safe move.

3.) If nothing in the way proceed to target.

My question so far about this is what is the snake suppose to do when there is no safe move to the apple or anything else.

Random??? I not sure but this seems to be how it works so far.

Maybe,  There's a way to consume empty spaces that are useable to avoid being trapped but how can this be implemented.
Also It make sense to say that If our ai snake blocks our path he will be more competive.

So my real question is how to make this kind of stuff happen maybe someone has ideas on how this can be done.
Thanks
ScottieB

BlinkOk

http://www.sourcecodester.com/visual-basic-net/4800/snake.html