From: H.G.Muller Date: Mon, 21 Mar 2016 12:16:46 +0000 (+0100) Subject: Fix built-in Lion move X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=00556ac3560be0593108590342e5d44595743821;p=xboard.git Fix built-in Lion move The 3-leg patch had uncovered a latent bug in the built-in move generation for Lions/Falcons/Eagles, which would qualify moves as FirstLeg even when the kill-square was already set. --- diff --git a/moves.c b/moves.c index e6e316a..ca2625c 100644 --- a/moves.c +++ b/moves.c @@ -618,12 +618,12 @@ Bishop (Board board, int flags, int rf, int ff, MoveCallback callback, VOIDSTAR void Sting (Board board, int flags, int rf, int ff, int dy, int dx, MoveCallback callback, VOIDSTAR closure) -{ // Lion-like move of Horned Falcon and Souring Eagle +{ // Lion-like move of Horned Falcon and Soaring Eagle int ft = ff + dx, rt = rf + dy; if (rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT) return; legNr += 2; if (!SameColor(board[rf][ff], board[rt][ft])) - callback(board, flags, board[rt][ft] != EmptySquare ? FirstLeg : NormalMove, rf, ff, rt, ft, closure); + callback(board, flags, killX < 0 && board[rt][ft] != EmptySquare ? FirstLeg : NormalMove, rf, ff, rt, ft, closure); legNr -= 2; ft += dx; rt += dy; if (rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT) return; @@ -1263,7 +1263,7 @@ GenPseudoLegal (Board board, int flags, MoveCallback callback, VOIDSTAR closure, if (rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT) continue; if (!(ff == ft && rf == rt) && SameColor(board[rf][ff], board[rt][ft])) continue; i = (killX >= 0 && (rt-killY)*(rt-killY) + (killX-ft)*(killX-ft) < 3); legNr += 2*i; - callback(board, flags, (rt-rf)*(rt-rf) + (ff-ft)*(ff-ft) < 3 && board[rt][ft] != EmptySquare ? FirstLeg : NormalMove, + callback(board, flags, (rt-rf)*(rt-rf) + (ff-ft)*(ff-ft) < 3 && board[rt][ft] != EmptySquare && !i ? FirstLeg : NormalMove, rf, ff, rt, ft, closure); legNr -= 2*i; }