Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Most people are going to suggest something like the A* path finding algorithm which is very well documented on the web and I suggest you go and search for any of these suggestions. What you do need to do is modify these algorithms so that they work well within the constraints you have been given. (Suggesting A* and ignoring the 0.1sec limitation isn't very helpful). </p> <p>There are a few points that I think you should consider</p> <ul> <li><p>When you are looking for a path, you should consider not only the other snakes and walls as an obstacle, but also their potential next moves. You don't want the snake heads to collide on the next move. This might require tracking their heads.</p></li> <li><p>You should limit your path search to a certain number of levels deep so that you don't run out of time. If you use the A* algorithm, you should find that the heuristic element will cause most paths to take you in the direction of the point you want to go to. So if you get closer, the next search will potentially be easier.</p></li> <li><p>Point selection isn't exactly that trivial. For example, you shouldn't just choose the nearest point, because you are racing other snakes. You should try to choose the points that you know or think you can get to first. You could simply measure the distance between the snakes and all of the points. Consider that each other snake is attempting to go for the closest point to them, and see if you can beat them because you are closer. Pick points you think you can win.</p></li> <li><p>Considering yourself an obstacle prevents any backwards moves.</p></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload