implemented A* algorithm for the snake AI