pensquid / yobmef

Weird toy chess engine written *very much from scratch* in Rust.
14 stars 1 forks source link

Fix blunders #25

Open UlisseMini opened 3 years ago

UlisseMini commented 3 years ago

Currently yobmef plays c3d5 at depth 1,2,3 and 4 in this position 1rbq1rk1/ppbn1pp1/4p2p/1P1pP3/3P2P1/PQN1BN2/1K3P1P/3R3R w - - 0 1 image

Engine output:

info depth 1 score cp 277 nodes 6895 nps 59223 time 116 pv g4g5 g7g6
info depth 2 score cp 318 nodes 17956 nps 64715 time 277 pv h1g1 f7f6 c3d5 f6e5 e3h6
info depth 3 score cp 256 nodes 224218 nps 60598 time 3700 pv h2h4 d7b6 b2b1 c7d6
info depth 4 score cp 297 nodes 702758 nps 63436 time 11078 pv c3d5 e6d5 b3d5 f8e8 d1d3 d7e5 d4e5 d8d5 d3d5 c8g4 e3h6

This line makes no sense, also I'm a bit worried about the long PV (are we updating PV in quiescence search?)

I assume there is a bug in quiessence, since this is exactly what that's supposed to fix.

UlisseMini commented 3 years ago

Another blunder https://lichess.org/svIhta0Y/black#20

info depth 1 score cp -160 nodes 4376 nps 45843 time 95 pv d5e3 f2e3 b4d2
info depth 2 score cp -160 nodes 14680 nps 65282 time 224 pv d5e3 f2e3 b4d2
info depth 3 score cp -55 nodes 67016 nps 71053 time 943 pv e5e4 d2c4 c6c5 f1g1
info depth 4 score cp -50 nodes 321017 nps 76194 time 4213 pv d5e3 f2e3 a8b8 d4e5 a7a6 a2a3 d8d2
info depth 5 score cp -50 nodes 1495731 nps 74786 time 20000 pv d5e3 f2e3 b4d2 c1d2 c6c5 d4e5 d8d2
bestmove d5e3

d8d2 smells of the horizon effect, but there's no jump in eval, strange. the real question is how can it like sacrificing its knight so much?

UlisseMini commented 3 years ago

image r1bq1rk1/ppp1bpp1/2np1n1p/4p3/2B1P2B/2NP4/PPP1NPPP/R2Q1RK1 w - - 0 1

info depth 1 score cp 110 nodes 1189 nps 22773 time 52 pv c4f7 f8f7 h4f6
info depth 2 score cp 110 nodes 4392 nps 44158 time 99 pv c4f7 f8f7 h4f6
info depth 3 score cp 15 nodes 104904 nps 68571 time 1529 pv h4f6 e7f6 d3d4 d6d5 c3d5
info depth 4 score cp 15 nodes 500558 nps 70108 time 7139 pv c4f7 g8f7 e2c1 f6e4 h4e7 f7e7 d3e4
info depth 5 score cp 15 nodes 1388553 nps 69427 time 20000 pv c4f7 g8f7 a2a3 d6d5 b2b4 d5e4 h4f6
bestmove c4f7

Very weird, even at high depth

edit: It was stopping the search from running out of time, I should really fix it so it doesn't print "depth 5" when its secretly depth 4.

info depth 1 score cp 110 nodes 1189 nps 22773 time 52 pv c4f7 f8f7 h4f6
info depth 2 score cp 110 nodes 4392 nps 44158 time 99 pv c4f7 f8f7 h4f6
info depth 3 score cp 15 nodes 104904 nps 68571 time 1529 pv h4f6 e7f6 d3d4 d6d5 c3d5
info depth 4 score cp 15 nodes 500558 nps 70108 time 7139 pv c4f7 g8f7 e2c1 f6e4 h4e7 f7e7 d3e4
info depth 5 score cp 20 nodes 1653399 nps 68737 time 24053 pv d3d4 d6d5 e4d5 c6d4 e2d4 e5d4
info depth 6 score cp 20 nodes 12886147 nps 69420 time 185624 pv d3d4 c8g4 d4d5 c6d4 h4g3 d4e2 c4e2

So when it actually reaches high depth it sees the error, it takes too long though. It should see it immediately when it loses material.

UlisseMini commented 3 years ago

image 4r1k1/ppp3pp/8/3p4/3Pn3/2PKP1B1/PP6/6R1 b - - 0 1

info depth 1 score cp -220 nodes 254 nps 33173 time 7 pv e4g3 g1g3
info depth 2 score cp -200 nodes 1866 nps 73026 time 25 pv e4g3 g1g3 a7a6
info depth 3 score cp -200 nodes 11567 nps 95134 time 121 pv e4g3 g1g3 a7a6 e3e4
info depth 4 score cp -195 nodes 61139 nps 97422 time 627 pv e4f2 g3f2 e8f8 c3c4 f8f2 <-- e4f2??
info depth 5 score cp -175 nodes 453929 nps 104828 time 4330 pv e4g3 g1g3 e8f8 d3c2 f8f1 e3e4
info depth 6 score cp -180 nodes 1723926 nps 104510 time 16495 pv e4g3 g1g3 a7a6 a2a3 a6a5 d3c2 a5a4

Knight blunder with no compensation, it seems to think it can recapture the bishop and white won't stop it, this must be a bug in quiescence of some sort