From: H.G.Muller Date: Tue, 3 Mar 2015 21:17:26 +0000 (+0100) Subject: Fix book encoding of Chu promotion moves X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=143a5473aa9fae9804a781575f4652dcf89f0bbb;p=xboard.git Fix book encoding of Chu promotion moves The Shogi promotion suffix had promotion code 8, which was not available in Chu at all, due to the large board size. So in stead we use code 1 now. Code 10 (or 2 in Chu) is reserved for encoding Lion moves, which currently do not work at all. --- diff --git a/book.c b/book.c index 8872d16..8b4a43c 100644 --- a/book.c +++ b/book.c @@ -502,11 +502,19 @@ move_to_string (char move_s[6], uint16 move) move_s[2] = tf + 'a'; move_s[3] = tr + '1' - (BOARD_HEIGHT > 9); + if(IS_SHOGI(gameInfo.variant) && p) { + if(p == 2) p = 10; // Lion moves, for boards so big that 10 is out of range + else if(p != 7) p = 8; // use '+' for all others that do not explicitly defer + } + // kludge: encode drops as special promotion code if(gameInfo.holdingsSize && p == 9) { move_s[0] = f + '@'; // from square encodes piece type move_s[1] = '@'; // drop symbol p = 0; + } else if(p == 10) { // decode Lion move + + p = 0; } // add promotion piece, if any @@ -716,7 +724,7 @@ char * MovesToText(int count, entry_t *entries) { int i, totalWeight = 0; - char algMove[6]; + char algMove[12]; char *p = (char*) malloc(40*count+1); for(i=0; i