fairy-stockfish / Fairy-Stockfish

chess variant engine supporting Xiangqi, Shogi, Janggi, Makruk, S-Chess, Crazyhouse, Bughouse, and many more
https://fairy-stockfish.github.io/
GNU General Public License v3.0
591 stars 186 forks source link

Missed tactics in Janggi #107

Open ianfab opened 4 years ago

ianfab commented 4 years ago

Sacrifices

Threat of rook sacrifice followed by cannon checkmate at move 20 was missed due to SEE pruning: https://www.pychess.org/uaixp7dB

setoption name UCI_Variant value janggi
position fen r1b2kb1r/4a1R2/2nacc3/4pp3/p6R1/1P1N5/B4PPP1/4C2C1/4K4/3A1ABN1 b - - 0 19
go depth 12

f8d10??


Cannon (anti-)discovered checks

https://www.pychess.org/onOzcPb6

setoption name UCI_Variant value janggi
position fen 3a4C/4k2R1/1cn1a1n2/1pp2R2b/9/r1PPP4/4N1b1P/1C7/2r2A3/cB1AK4 b - - 7 31
go depth 12

e9e10??

https://www.pychess.org/r5A7koEI

setoption name UCI_Variant value janggi
position fen 5ar2/1R2ak3/2R1cc3/2B1p2pb/2pp5/9/1PP2PPP1/6N2/4AK3/1r2C1B2 w - - 3 25
go depth 15

f4e4??

Cannon attacks rook

All findings

https://www.pychess.org/Rbemds4q -- rook sac, cannon mate threat https://www.pychess.org/Zqqb9V8e -- elephant fork https://www.pychess.org/7pXDYjGf -- cannon attacks rook https://www.pychess.org/wW822NT8 -- sac/pin https://www.pychess.org/64iAutVv -- safe/unsafe check bonus https://www.pychess.org/2u2z3T7D -- cannon attacks rook https://www.pychess.org/onOzcPb6 -- cannon discovered check https://www.pychess.org/r5A7koEI -- cannon discovered check https://www.pychess.org/anS3yBS6 -- cannon discovered check https://www.pychess.org/6BLIMiHD -- 50 move rule https://www.pychess.org/6BLIMiHD -- cannon attacks rook https://www.pychess.org/gmzY5sWs -- cannon attacks rook https://www.pychess.org/cvTj1GZo -- cannon attacks rook https://www.pychess.org/0c1SDHnF -- cannon attacks rook https://www.pychess.org/F9UnCKPn -- cannon pin

ianfab commented 3 years ago

Moved from #184:

Comment by @kimqwer2:

SF is not very good at judging the risks of Soldier. The score changes dramatically. It seems like SF is searching randomly. Therefore, there are some cases where errors are not made, and others are. ggggg In the first scene, (-0.32) ---> (-1.66) 3a1a3/4k4/2n1cn3/1pppb2pp/r8/8P/P2PB1rNP/4CC3/3AK4/R4AB1R w -- 0 1

In the second scene, (+0.53) ---> (-1.23) , (-1.99) 3a1a3/4k4/2n1cn3/1pp1bp1pp/r8/8P/P2PB1rNP/4CC3/3AK4/R4AB1R w -- 0 1

Appears many times in a similar structure.

aaaaa In this scene, (+0.39) ---> (-4.60) rnbak1b1r/4a4/6n1c/pp2p3p/1c3p3/6R2/1PPPB1PP1/R1N1C1NC1/4K4/2BA1A3 b - 19 10

@ianfab:

Thanks, the FENs are very helpful. I quickly checked, and to my understanding the justifications for the sacrifices in the two positions are:

  1. Deflecting the pawn to play Eh4 attacking the central cannon.
  2. Deflecting the rook with Ri7 to force checkmate (or regaining the rook with a winning position).

Fairy-SF perhaps does too much pruning for Xiangqi and Janggi and therefore misses some sacrifices, as can also be seen in #107. I already ran some tests on this in the past, but they were not conclusive, so this will need more testing and ideas how to improve it in the future.

kimqwer2 commented 3 years ago

The content is redundant, so I will write it here. Blue does not see the red cannon's movement well in that part. https://www.pychess.org/analysis/janggi?fen=r1bck3r/4aa3/2n1c1n2/p1ppb1pp1/9/R7P/1PP1P1P1R/2NCC1N2/3AA4/2B1K1B2_w_-_-_0_1 1.Pgf4 Ci8 1.Pef4 1.Ci8 1.Cf1 1.Ci8