maze solving by a wavefront