Some A* code written in JS