if (g->moveList[i].piecePromotionTo) {
switch(g->moveList[i].moveString[0]) { // [HGM] return original piece type rather than just TRUE
case 'P': return PAWN;
- case 'N': return KNIGHT;
+ case 'N': return HONORABLEHORSE; // !!! this is Shogi, so no KNIGHT !!!
case 'B': return BISHOP;
case 'R': return ROOK;
case 'L': return LANCE;
{
struct player *pp = &player_globals.parray[p];
struct game *gg;
- int g, result, len, i;
+ int g, result, len, i, f;
struct move_t move;
unsigned now = 0;
}
pp->promote = NOPIECE; // [HGM] this seemed to be uninitialized, which caused spurious promotion in Shogi
if ((len = strlen(command)) > 1) {
- if (command[len - 2] == '=') {
+ if (command[len - 2] == '=' || gg->game_state.drops == 2 && command[len - 2] == '/') { // [HGM] encode gating as promotion
printf("promo '%s'\n", command);
- switch (tolower(command[strlen(command) - 1])) {
+ switch (tolower(command[len - 1])) {
case 'n':
pp->promote = KNIGHT;
break;
pp->promote = MASTODON;
break;
// Shogi promotions
+ case 'h':
+ pp->promote = DRAGONHORSE;
+ break;
+ case 'd':
+ pp->promote = DRAGONKING;
+ break;
case '^':
case '+':
pp->promote = GOLD;
if (game_globals.garray[g].numHalfMoves < 8) /* can't have three repeats any quicker. */
return 0;
- for (move_num = game_globals.garray[g].game_state.lastIrreversable;
+ for (move_num = game_globals.garray[g].game_state.lastIrreversable - 1; // [HGM] FEN stored in moveList[numHalfMoves-1] !
move_num < game_globals.garray[g].numHalfMoves - 1; move_num++) {
pos = GetFENpos (g, move_num);
if (strlen(pos1) == strlen(pos) && !strcmp(pos1, pos))
flag1++;
if (strlen(pos2) == strlen(pos) && !strcmp(pos2, pos))
flag2++;
+printf("%2d. %d-%d %s %s %s\n", move_num, flag1, flag2, pos1,pos2,pos);
}
if (flag1 >= 3 || flag2 >= 3) {
if ((pend = find_pend(pp->opponent, p, PEND_DRAW)) != NULL) {