int used_solve; /* used to suppress completion flash */
int movecount, movetarget;
int lastx, lasty, lastr; /* coordinates of last rotation */
int used_solve; /* used to suppress completion flash */
int movecount, movetarget;
int lastx, lasty, lastr; /* coordinates of last rotation */
ret->lasty = state->lasty;
ret->lastr = state->lastr;
ret->used_solve = state->used_solve;
ret->lasty = state->lasty;
ret->lastr = state->lastr;
ret->used_solve = state->used_solve;
ret->grid = snewn(ret->w * ret->h, int);
memcpy(ret->grid, state->grid, ret->w * ret->h * sizeof(int));
ret->grid = snewn(ret->w * ret->h, int);
memcpy(ret->grid, state->grid, ret->w * ret->h * sizeof(int));
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
qsort(ret->grid, ret->w*ret->h, sizeof(int), compare_int);
for (i = 0; i < ret->w*ret->h; i++)
ret->grid[i] &= ~3;
ret->movecount++;
do_rotate(ret->grid, w, h, n, ret->orientable, x, y, dir);
ret->lastx = x;
ret->movecount++;
do_rotate(ret->grid, w, h, n, ret->orientable, x, y, dir);
ret->lastx = x;