From 8d865da206fa04e0642d6a134a85b12a068ed0ac Mon Sep 17 00:00:00 2001 From: H.G. Muller Date: Mon, 11 Oct 2010 13:50:06 +0200 Subject: [PATCH] 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. --- lasker-2.2.3/src/movecheck.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) 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; } } -- 1.7.0.4