From: H.G. Muller Date: Sun, 31 Oct 2010 12:08:52 +0000 (+0100) Subject: Augment moves of some fairy pieces X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=e6bbc0609a8fd2080b6274af55186a431b851210;p=xboard.git Augment moves of some fairy pieces To get better disambiguation in variants that have to be played with legality testing off, the Elephant is given also one-step moves (making it a so-called Modern Elephant) in -variant fairy and great. The Dragon King (Crowned Rook), which had no moves defined for it outside Shogi at all, has been given Rook moves plus an orthogonal 2-jump, so that it can get SAN moves when used as Dababba or Short Rook. (Illegal moves currently aways force long algebraic notation...) --- diff --git a/moves.c b/moves.c index 89af9a0..d667113 100644 --- a/moves.c +++ b/moves.c @@ -418,6 +418,13 @@ void GenPseudoLegal(board, flags, callback, closure) && !SameColor(board[rf][ff], board[rt][ft])) callback(board, flags, NormalMove, rf, ff, rt, ft, closure); + if(gameInfo.variant != VariantFairy && gameInfo.variant != VariantGreat) continue; + rt = rf + rs; // in unknown variant we assume Modern Elephant, which can also do one step + ft = ff + fs; + if (!(rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT) + && !SameColor(board[rf][ff], board[rt][ft])) + callback(board, flags, NormalMove, + rf, ff, rt, ft, closure); } break; @@ -477,6 +484,19 @@ void GenPseudoLegal(board, flags, callback, closure) } break; + /* Make Dragon-King Dababba & Rook-like outside Shogi, for better disambiguation in variant Fairy */ + case WhiteDragon: + case BlackDragon: + for (d = 0; d <= 1; d++) // Dababba moves that Rook cannot do + for (s = -2; s <= 2; s += 4) { + rt = rf + s * d; + ft = ff + s * (1 - d); + if (rt < 0 || rt >= BOARD_HEIGHT || ft < BOARD_LEFT || ft >= BOARD_RGHT || board[rf+rt>>1][ff+ft>>1] == EmptySquare) continue; + if (SameColor(board[rf][ff], board[rt][ft])) continue; + callback(board, flags, NormalMove, rf, ff, rt, ft, closure); + } + goto doRook; + /* Shogi Dragon King has to continue as Ferz after Rook moves */ case SHOGI WhiteDragon: case SHOGI BlackDragon: @@ -492,6 +512,7 @@ void GenPseudoLegal(board, flags, callback, closure) case SHOGI BlackRook: case WhiteRook: case BlackRook: + doRook: for (d = 0; d <= 1; d++) for (s = -1; s <= 1; s += 2) for (i = 1;; i++) {