Generic A* implementation (game logic is not functional yet)