endx = rand.nextInt(w); endy = rand.nextInt(h);
if (!m.isObstacle(startx, starty) && !m.isObstacle(endx, endy))
break;
}
AStar algo = new AStar(m, w, h);
Point2I[] path = algo.findPath(startx, starty, endx, endy);
if (path != null)
{
// Check path
for (Point2I step: path)
{