From 1791a18da3fdc051bdc8d1942827fd30a0cc2333 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Wed, 15 Oct 2014 14:56:09 +0200 Subject: [PATCH] Forbid promotion to pieces with value ending in 3 No piece had that yet in any existing variant, and although Fairy-Max will still always promote to piece #7, the user's promotion choice can now be checked better for legality. --- data/fmax.ini | 4 ++++ fairymax.c | 2 +- 2 files changed, 5 insertions(+), 1 deletions(-) diff --git a/data/fmax.ini b/data/fmax.ini index 88c76a8..a68c328 100644 --- a/data/fmax.ini +++ b/data/fmax.ini @@ -204,6 +204,10 @@ A royal value of -2 is currently used as a kludge to enable an alternative winning condition, namely when the royal piece reaches (and survives in) one of the four central squares. +NOTE: Any piece value that (in decimal notation) ends in '3' will not be +accepted as promotion choice. (And neither will be absolute royalty, +i.e. piece value -1). + The individual bits in the move-mode descriptor have the following meaning: In the last hexadecimal digit: 1 capture allowed (of enemy piece; own pieces always block a move) diff --git a/fairymax.c b/fairymax.c index 2046aaa..9589df7 100644 --- a/fairymax.c +++ b/fairymax.c @@ -896,7 +896,7 @@ printf("# promo = %d (%c) GT = %d\n", prom, prom + '`', GT); GT = (Side == WHITE ? piecetype : blacktype)[line[4]&31]; if(GT) PromPiece = (Side == WHITE ? 7 : 7+pm) - GT, GT |= 32 + Side; {char *c=line; K=c[0]-16*c[1]+799;L=c[2]-16*c[3]+799; } - if(w[GT&15] == -1) L = S; // spoil move for promotion to King + if(w[GT&15] == -1 || w[GT&15]%10 == 3) L = S; // spoil move for promotion to King (or when marked non-promoting) if (m & line[1] != '@') /* doesn't have move syntax */ printf("Error (unknown command): %s\n", command); -- 1.7.0.4