pushcache (cache, *board, *xcursor, *ycursor, queen);
*board = copyboard (*board);
dopetmove (*board, xcursor, ycursor, direction);
- queen = direction;
+ if (queen == -1) {
+ queen = direction;
+ }
} else if (testqueenjump (*board, *xcursor, *ycursor, direction)) {
pushcache (cache, *board, *xcursor, *ycursor, queen);
*board = copyboard (*board);
case 'x':
if (cache->board) {
board = popcache (cache, &xcursor, &ycursor, &queen);
- mode = 1;
+ if (mode == 2) {
+ mode = 1;
+ }
}
break;
//case ERR:
_element (board, x + 2, y + 2, 'S');
}
break;
- case 4: /* 0 -> 1, 3*/
+ case 4: /* 0 -> 1, 3 */
if (isempty (board, x, y, 1, 0)) {
_element (board, x + 1, y - 1, 'S');
}
_element (board, x + (1 + d), y + (1 + d), 'S');
}
break;
- case 5: /* 1 -> 0, 2*/
+ case 5: /* 1 -> 0, 2 */
if (isempty (board, x, y, 1, 1)) {
_element (board, x - 1, y - 1, 'S');
}
}
if (ret) {
int id = getid (board, x, y);
- ret = ispet (board, x, y, 1 - id, 1 + delta, mode) && isempty (board, x, y, 2 + delta, mode);
+ ret = (ispet (board, x, y, 1 - id, 1 + delta, mode) ||
+ isqueen (board, x, y, 1 - id, 1 + delta, mode)) &&
+ isempty (board, x, y, 2 + delta, mode);
}
return ret;
}