From: H.G. Muller Date: Sat, 3 Mar 2012 22:32:11 +0000 (+0100) Subject: Add disambiguation of move with unique piece X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=a0f11c3028eb6f2911a2abfe2496aed6f33207a5;p=xboard.git Add disambiguation of move with unique piece If no pseudo-legal move of type Xa1 can be found, and only a single piece of type X is on the board, successfully disambiguate the move using that piece. --- diff --git a/moves.c b/moves.c index f8b7857..1c4fe51 100644 --- a/moves.c +++ b/moves.c @@ -1331,14 +1331,23 @@ Disambiguate (Board board, int flags, DisambiguateClosure *closure) GenLegal(board, flags|F_IGNORE_CHECK, DisambiguateCallback, (VOIDSTAR) closure, closure->pieceIn); if (closure->count == 0) { /* No, it's not even that */ + if(!appData.testLegality && closure->pieceIn != EmptySquare) { + int f, r; // if there is only a single piece of the requested type on the board, use that + closure->rt = closure->rtIn, closure->ft = closure->ftIn; + for(r=0; rpieceIn) closure->count++, closure->rf = r, closure->ff = f; + if(closure->count > 1) illegal = 0; // ambiguous + } + if(closure->count == 0) { if (appData.debugMode) { int i, j; for(i=BOARD_HEIGHT-1; i>=0; i--) { for(j=0; j