// [HGM] gen: configurable move generation from Betza notation sent by engine.
+Boolean pieceDefs;
+
// alphabet "abcdefghijklmnopqrstuvwxyz"
char symmetry[] = "FBNW.FFW.NKN.NW.QR....W..N";
char xStep[] = "2110.130.102.10.00....0..2";
if(PieceToChar(piece) == '~')
piece = (ChessSquare) ( DEMOTED piece );
if(filter != EmptySquare && piece != filter) continue;
- if(pieceDesc[piece]) { MovesFromString(board, flags, ff, rf, pieceDesc[piece], callback, closure); continue; } // [HGM] gen
+ if(pieceDefs && pieceDesc[piece]) { // [HGM] gen: use engine-defined moves
+ MovesFromString(board, flags, ff, rf, pieceDesc[piece], callback, closure);
+ continue;
+ }
if(IS_SHOGI(gameInfo.variant))
piece = (ChessSquare) ( SHOGI piece );
return;
}
}
+ } else if(pieceDefs && closure->count > 1) { // [HGM] gen: move is ambiguous under engine-defined rules
+ DisambiguateClosure spare = *closure;
+ pieceDefs = FALSE; spare.count = 0; // See if the (erroneous) built-in rules would resolve that
+ GenLegal(board, flags, DisambiguateCallback, (VOIDSTAR) &spare, closure->pieceIn);
+ if(spare.count == 1) *closure = spare; // It does, so use those in stead (game from file saved before gen patch?)
+ pieceDefs = TRUE;
}
if (c == 'x') c = NULLCHAR; // get rid of any 'x' (which should never happen?)
extern char pieceNickName[(int)EmptySquare];
extern char *pieceDesc[(int)EmptySquare];
extern Board initialPosition;
+extern Boolean pieceDefs;
typedef void (*MoveCallback) P((Board board, int flags, ChessMove kind,
int rf, int ff, int rt, int ft,