From: Fabian Fichter Date: Fri, 24 Apr 2020 17:56:53 +0000 (+0200) Subject: Prohibit attacks by sittuyin promotion X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=c55fea65e56223b0ce446661b5bc0043c90cea19;p=fairystockfish.git Prohibit attacks by sittuyin promotion Fix interpretation of rule 3.9 c.4 that does not allow captures and attacks by the general as part of promotion moves. Closes #14. --- diff --git a/src/movegen.cpp b/src/movegen.cpp index 665ce4b..bf20c95 100644 --- a/src/movegen.cpp +++ b/src/movegen.cpp @@ -203,7 +203,11 @@ namespace { b &= target; while (b) - *moveList++ = make(from, pop_lsb(&b), pt); + { + Square to = pop_lsb(&b); + if (!(attacks_bb(Us, pt, to, pos.pieces() ^ from) & pos.pieces(Them))) + *moveList++ = make(from, to, pt); + } } } } diff --git a/tests/perft.sh b/tests/perft.sh index 8d88a90..354fc9b 100755 --- a/tests/perft.sh +++ b/tests/perft.sh @@ -57,8 +57,9 @@ if [[ $1 == "" || $1 == "variant" ]]; then expect perft.exp horde startpos 6 5396554 > /dev/null expect perft.exp placement startpos 4 1597696 > /dev/null expect perft.exp sittuyin startpos 3 580096 > /dev/null - expect perft.exp sittuyin "fen 8/8/6R1/s3r3/P5R1/1KP3p1/1F2kr2/8[-] b - - 0 72" 4 657824 > /dev/null - expect perft.exp sittuyin "fen 2r5/6k1/6p1/3s2P1/3npR2/8/p2N2F1/3K4 w - - 1 50" 4 394031 > /dev/null + expect perft.exp sittuyin "fen 8/8/6R1/s3r3/P5R1/1KP3p1/1F2kr2/8[] b - - 0 72" 4 652686 > /dev/null + expect perft.exp sittuyin "fen 2r5/6k1/6p1/3s2P1/3npR2/8/p2N2F1/3K4[] w - - 1 50" 4 373984 > /dev/null + expect perft.exp sittuyin "fen 8/6s1/5P2/3n4/pR2K2S/1P6/1k4p1/8[] w - - 1 50" 4 268869 > /dev/null expect perft.exp seirawan startpos 5 27639803 > /dev/null expect perft.exp seirawan "fen reb1k2r/ppppqppp/2nb1n2/4p3/4P3/N1P2N2/PB1PQPPP/RE2KBHR[h] b KQkqc - 3 7" 5 31463761 > /dev/null fi