From: H.G. Muller Date: Mon, 11 Oct 2010 11:50:06 +0000 (+0200) Subject: Fix bugs in Shogi Knight moves and promotions X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=8d865da206fa04e0642d6a134a85b12a068ed0ac;p=capablanca.git Fix bugs in Shogi Knight moves and promotions The legality check for Shogi Knight moves was improperly parenthesized, and in the promotion code KNIGHT was used in stead of HONORABLEHORSE. --- diff --git a/lasker-2.2.3/src/movecheck.c b/lasker-2.2.3/src/movecheck.c index 1f6d69b..30ada65 100644 --- a/lasker-2.2.3/src/movecheck.c +++ b/lasker-2.2.3/src/movecheck.c @@ -218,7 +218,7 @@ static int legal_honorablehorse_move(struct game_state_t * gs, int ff, int fr, i dx = ff - tf; dy = fr - tr; - if (dy == gs->onMove == WHITE ? 2 : -2) { + if (dy == (gs->onMove == WHITE ? -2 : 2)) { if (abs(dx) == 1) return 1; } @@ -1510,7 +1510,7 @@ static int move_calculate(struct game_state_t * gs, struct move_t * mt, int prom switch(piecetype(piece)) { case PAWN: case LANCE: - case KNIGHT: + case HONORABLEHORSE: case SILVER: promote = GOLD; break; case BISHOP: @@ -1521,7 +1521,7 @@ static int move_calculate(struct game_state_t * gs, struct move_t * mt, int prom } } else switch(piecetype(piece)) { // force mandatory promotions - case KNIGHT: + case HONORABLEHORSE: if(mt->toRank == 1 || mt->toRank == gs->files-2) promote = GOLD; case PAWN: case LANCE: @@ -1628,7 +1628,7 @@ int in_check(struct game_state_t * gs) } for (InitPieceLoop(gs->board, &f, &r, gs->onMove); NextPieceLoop(gs->board, &f, &r, gs->onMove, gs->files, gs->ranks);) { - if (legal_move(gs, f, r, kf, kr)) { /* In Check? */ + if (legal_move(gs, f, r, kf, kr)) { /* In Check? */ return 1; } }