Lookup table for mates/tactics

Discussion of chess software programming and technical issues.

Moderator: Ras

rdhoffmann
Posts: 54
Joined: Fri Apr 21, 2023 3:46 pm
Full name: Richard Hoffmann

Lookup table for mates/tactics

Post by rdhoffmann »

Since opening books and endgame tablebases are common for classic alpha-beta engines, I wonder if anyone has tried similar ideas for mates or winning moves in general.

There is at least two approaches I can think of. One would be merely a heuristic, for instance we could strongly filter a given position, look it up in a hash table then decide "this is probably a mate, look further!". So basically we look up mate patterns. Perhaps a neural net could be useful here as well.

The second approach would be to look up a mate position and return immediately without searching the position at all. This would be close to an opening book conceptually, however here we can also filter out pieces - just not many and we have to be very careful about it.

Thoughts?
rdhoffmann
Posts: 54
Joined: Fri Apr 21, 2023 3:46 pm
Full name: Richard Hoffmann

Re: Lookup table for mates/tactics

Post by rdhoffmann »

Here's one endgame example where this idea could be applied.

8/4N3/5K1P/8/2k5/8/2b5/8 w

If we see this position within our search, we could look up only the white pieces and allow the black pieces to be put almost anywhere. The point would be that we need only a few bytes to "solve" this particular position, instead of a few kb containing all possible black piece placements.

Now maybe this idea is too specific to certain positions, not sure.
User avatar
Bo Persson
Posts: 257
Joined: Sat Mar 11, 2006 8:31 am
Location: Malmö, Sweden
Full name: Bo Persson

Re: Lookup table for mates/tactics

Post by Bo Persson »

rdhoffmann wrote: Thu May 25, 2023 6:05 pm we need only a few bytes to "solve" this particular position,
Yes, but how many positions do we need to store to make this useful?

"A few bytes" times a gazillion use cases is still "a lot".
rdhoffmann
Posts: 54
Joined: Fri Apr 21, 2023 3:46 pm
Full name: Richard Hoffmann

Re: Lookup table for mates/tactics

Post by rdhoffmann »

That's a good question, I don't know.

I just thought the idea is so obvious that people must have tried it years or decades ago and either rejected it, or maybe use some variation of it.
User avatar
hgm
Posts: 28353
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Lookup table for mates/tactics

Post by hgm »

The game tree of Chess is way too big to tabulate even a tiny fraction of it. Any position deep in the middle-game has only infinitesimal chance to ever been hit by an actual game. Only close to the start position the lines have not yet diverged so much that this is feasible (opening theory), or in the late end-game, where the number of positions shrinks because few pieces are left.
Witek
Posts: 87
Joined: Thu Oct 07, 2021 12:48 am
Location: Warsaw, Poland
Full name: Michal Witanowski

Re: Lookup table for mates/tactics

Post by Witek »

rdhoffmann wrote: Thu May 25, 2023 6:05 pm Here's one endgame example where this idea could be applied.

8/4N3/5K1P/8/2k5/8/2b5/8 w

If we see this position within our search, we could look up only the white pieces and allow the black pieces to be put almost anywhere. The point would be that we need only a few bytes to "solve" this particular position, instead of a few kb containing all possible black piece placements.

Now maybe this idea is too specific to certain positions, not sure.
The key word is "almost". In this example it's enough to put the black king in front of a pawn and it's a draw. So you'd need more rules to encode this information, but this is what tablebases are for
Author of Caissa Chess Engine: https://github.com/Witek902/Caissa