tildedave / ra-chess-engine

Golang chess engine I'm hacking up
3 stars 0 forks source link

Tactics #21

Closed tildedave closed 4 years ago

tildedave commented 5 years ago

Okay, engine needs to get better at tactics. Various things I can do (brainstorm):

I'll start with the basic suite in the repo. Failing positions are:

[testWac002 - FAIL] expected=Rxb2 result=c3 (score=-100, nodes=180869499585, depth=12)
[testWcsac002 - FAIL] expected=Re8 result=Qxc4 (score=80, nodes=17816962, depth=6)
[testWac247 - FAIL] expected=Rxb5 result=Qc5 (score=30, nodes=5541963, depth=5)
[testWcsac527 - FAIL] expected=Qxc6 result=hxg4 (score=100, nodes=3226503, depth=6)
[testBwtc39 - FAIL] expected=Qb6 result=Rxb7 (score=-115, nodes=2760507, depth=4)
tildedave commented 5 years ago

testWac002:

image

Engine should see that sacrificing the rook gives two connected passed pawns on the sixth rank. Either should be able to compute that two connected passed pawns on the sixth rank is winning (I've heard grandmasters say that this is worth at least a rook) or it should be able to compute using quiescent search to the end where it queens.

tildedave commented 5 years ago

testWcsac002

image

Engine should be able to recognize that the knight is pinned and so it can't defend the king. This forces the queen off the defense of the knight (overworked).

tildedave commented 5 years ago

testWac247

image

This is a straight-up tactical combination. Rook takes bishop, pawn takes rook, pawn to a6. Can't take the pawn because Qc6 Kb8 Bd6 checkmate.

tildedave commented 5 years ago

Apep doesn't actually solve Wac002 so I might want a different target.

tildedave commented 5 years ago

Looks like the issue with testWcsac002 is that the checkmate is 'delayed' after Queen takes Knight, in that the black queen has some spite checks. Null move might help detect this but also fixing the quiescent search so it runs through checks might be good too. Still have a few parity items to implement from the Apep search and Apep finds it at depth 6.

tildedave commented 5 years ago

Yeah the ghetto quiescent search I added prevents it from analyzing the lines appropriately. I think it's spending way too much time in lines that aren't actually quiescent and I need to just redo this to actually do the extension at the right points.

tildedave commented 5 years ago

Wac002 is interesting. I imagine the issue is that having a queen in the endgame isn't that much more of a material plus than two pawns, especially if the pawns are on the 6th rank and get the extra plus. Gonna see about tuning this.

tildedave commented 4 years ago

Passes 15/16 of the tests at 7s (sometimes 14/16, testWac247 is right at the edge of the search horizon - needs to finish depth 9 search) so I think this is addressed.