dijkstra step 2 - Implementing on snake.