bagaturchess / Bagatur

Java Chess Engine (UCI compatible)
http://bagaturchess.github.io/Bagatur/
Eclipse Public License 2.0
72 stars 18 forks source link

mate with 2 knights is impossible #12

Closed tissatussa closed 2 years ago

tissatussa commented 2 years ago

8/5n2/3n3p/7K/5k2/8/5P1N/8 w - - 0 1

ncmjcoicikclcjgn

White to move. The only thing White can hope for is to draw .. so Nh2-g4xh6 can always be done (in the meantime Black can give no checks) and Black will have lost the only pawn ! But ShashChess, as ALL engines i've tested up to now, fails to find these moves, it played Kg6 .. then Black played Ne5+ : it freely gave the pawn ?? That's why this game ended in a draw, however all engines give Black a high eval (3 or 4), also without the last Black pawn : they are not aware of the 2-N-can-not-win concept ..

NOTE: give mate with 2 knights has some exception : when the opponent (!) has a pawn on the f-file or c-file (on certain ranks) .. in this diagram this is the case .. but the theory about this is beyond my goal : White should "know" it's a good idea to capture the last pawn.

AlexBrunetti commented 2 years ago

"all engines give Black a high eval (3 or 4)" That's not true, Stockfish says 0 for example. Even my engine says just -0.6. And any decent engine having a decent material imbalance evaluation knows that KNNk is draw.

Alex

tissatussa commented 2 years ago

also see https://en.wikipedia.org/wiki/Two_knights_endgame here you can read:

[...] When the defender has a single pawn, the technique (when it is possible) is to block the pawn with one knight, and use the king and the other knight to force the opposing king into a corner or nearby the blocking knight. Then, when the block on the pawn is removed, the knight that was used to block the pawn can be used to checkmate. [...]

here's a PDF of that page : Two knights endgame - Wikipedia - en.wikipedia.org.pdf

tissatussa commented 2 years ago

@AlexBrunetti i think you're right .. i did test again, see below .. but not all strong engines give 0.00 or alike .. some engines consider Ng4 but then some of them do NOT capture pawn h6 .. not all (strong) engines seem to know KNNk is a draw ..

SF Crystal v3 2 NNUE Hybrid

SF v14 noNNUE

SF v14 NNUE

koivisto_v7 2

nemorino_v6 08_NNUE

pedone_v3 1

komodo_v13 02_noMCTS

rubichess_v2 3dev_noNNUE

rubichess_v2 3dev_NNUE

fire_v8_NN_noMCTS

shashchess_v20_noNNUE

shashchess_v20_NNUE

amoeba_v3 3 1

ethereal_v13 35_noNNUE

xiphos_v0 6 1

berserk_v7_NNUE

slowchess_v2 7

AlexBrunetti commented 2 years ago

My results are different. For example, Berserk 7 at depth 29 you find -4,17 but I have -0.25: position fen 8/5n2/3n3p/7K/5k2/8/5P1N/8 w - - 0 1 go infinite ... info depth 26 seldepth 45 multipv 1 score cp -41 time 7831 nodes 8929642 nps 1140293 tbhits 0 hashfull 884 pv h5g6 f7e5 g6h6 d6f5 h6h5 f5d4 h2f1 d4f3 f1e3 f3d2 e3g2 f4f5 g2e3 f5e4 h5g5 e5f3 g5f6 f3d4 f6e7 d2b3 e3c4 d4f3 e7e6 e4f4 c4d6 b3c1 d6b7 f3g1 b7d6 info depth 27 seldepth 45 multipv 1 score cp -33 lowerbound time 12449 nodes 142 33729 nps 1143363 tbhits 0 hashfull 978 pv h5g6 info depth 27 seldepth 45 multipv 1 score cp -33 time 12512 nodes 14288098 nps 1 141951 tbhits 0 hashfull 978 pv h5g6 f7e5 g6h6 d6f5 h6h5 f5d4 h2f1 d4f3 f1e3 f3d 2 e3g2 f4f5 g2e3 f5e4 f2f4 e5d7 e3g2 e4f5 g2e3 f5f4 h5g6 d7c5 e3c4 d2e4 g6f7 f4f 3 f7e7 f3g2 c4d2 info depth 28 seldepth 45 multipv 1 score cp -33 time 14711 nodes 16810382 nps 1 142708 tbhits 0 hashfull 994 pv h5g6 f7e5 g6h6 d6f5 h6h5 f5d4 h2f1 d4f3 f1e3 f4e 4 h5h6 e5d3 h6g7 f3d4 g7f6 d3c1 e3c4 e4f4 f6e7 d4f3 e7d7 f4e4 d7e6 e4d4 c4e3 f3d 2 e6e7 c1e2 e7e6 d4e4 e6d6 e2c1 info depth 29 seldepth 83 multipv 1 score cp -25 lowerbound time 26380 nodes 305 84771 nps 1159392 tbhits 0 hashfull 1000 pv h5g6 info depth 29 seldepth 83 multipv 1 score cp -25 time 26614 nodes 30843148 nps 1 158906 tbhits 0 hashfull 1000 pv h5g6 f7e5 g6h6 d6f5 h6h5 f5d4 h2f1 d4f3 f1e3 f4 e4 h5h6 e5d3 h6g7 f3d4 g7f6 d3c1 e3c4 e4f4 f6e7 d4f3 e7d7 f4e4 d7e6 e4d4 c4e3 f3 d2 f2f4 d4e3 f4f5 d2e4 f5f6 e4c5 e6e7

How is it possible?

Alex

tissatussa commented 2 years ago

@AlexBrunetti you must know that all my screenshots are with MPV 5 (except Xiphos and Koivisto, which do only MPV 1) .. so, the top moves are best.

tissatussa commented 2 years ago

Here's another example how many engines do NOT know that winning with only 2 knights is impossible : 8/7p/3n3K/1N1nkP2/8/8/8/8 b - - 0 1

position

Black to move. Black MUST do Nf6 to protect the only pawn h7, but many engines like to capture the white knight .. The screenshots below show the evaluations of several strong engines with MPV 5. Only Stockfish v14 NNUE and Critter v1.6a find Nf6 best move.

Bagatur_v2 3


SF_v14_NNUE


Nemorino_v6 08_NNUE


Ethereal_v13 35_noNN


RubiChess_v2 3-dev_no_NNUE


Critter_v1 6a

bagaturchess commented 2 years ago

Happy New Year 2022! I wish good health and good mood! P.S. the version 3.0 is released and your feedback is welcome! ;-) I will close this issue.