Adding a mate searching thread to my engine

Discussion of chess software programming and technical issues.

Moderator: Ras

User avatar
Steve Maughan
Posts: 1275
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Adding a mate searching thread to my engine

Post by Steve Maughan »

To be clear, the tactical thread would still use the hash table to make cutoffs e.g. if the hash entry is upperbound at +10 and alpha is +mate, then you'd do a cutoff. It just wouldn't "push" it's search results to the hash table unless a genuine mate had been found. What you want avoid is the hash table being filled with practically useless entries that basically say "this position is less than mate".

Steve
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine
Uri Blass
Posts: 10793
Joined: Thu Mar 09, 2006 12:37 am
Location: Tel-Aviv Israel

Re: Adding a mate searching thread to my engine

Post by Uri Blass »

Steve Maughan wrote: Sat Apr 09, 2022 12:26 am To be clear, the tactical thread would still use the hash table to make cutoffs e.g. if the hash entry is upperbound at +10 and alpha is +mate, then you'd do a cutoff. It just wouldn't "push" it's search results to the hash table unless a genuine mate had been found. What you want avoid is the hash table being filled with practically useless entries that basically say "this position is less than mate".

Steve
You also want to avoid searching the same position to the same depth twice by the mate search when there is no mate.
I do not see how you do it if you do not store in the hash table an information like this position is less than a mate assuming you search to depth 9 plies or smaller.
User avatar
Ronald
Posts: 161
Joined: Tue Jan 23, 2018 10:18 am
Location: Rotterdam
Full name: Ronald Friederich

Re: Adding a mate searching thread to my engine

Post by Ronald »

You could try to define a separate hashtable for the mate thread, look in both hashtables for the position, store regular positions in the separate table and store mate scores in both tables.

You can create a separate table fi by using one bit of the index as separator. Drawback is that you halved the space for regular search.
Joerg Oster
Posts: 969
Joined: Fri Mar 10, 2006 4:29 pm
Location: Germany
Full name: Jörg Oster

Re: Adding a mate searching thread to my engine

Post by Joerg Oster »

Cardoso wrote: Fri Apr 08, 2022 12:14 am
dangi12012 wrote: Thu Apr 07, 2022 8:53 pm Let me answer this straightforward:
Return 0 at the leafs.
Remove all pruning.

You will end up with pure alphabeta which should be around 7 lines of code and will find forced wins for you.

If that recursion returns a win it is a forced win IE mate in X


You can still do iterative deepening when the number of open paths remain low
So no heuristics that could possibly help?
About pruning, maybe the only pruning I can make safely is mate distance pruning. I'm going to test that.
This https://github.com/joergoster/Stockfish/tree/huntsman simple approach shows quite some success.
Maybe it can provide some hints for you.
Jörg Oster
User avatar
Steve Maughan
Posts: 1275
Joined: Wed Mar 08, 2006 8:28 pm
Location: Florida, USA

Re: Adding a mate searching thread to my engine

Post by Steve Maughan »

Ronald wrote: Sat Apr 09, 2022 10:05 am You could try to define a separate hashtable for the mate thread, look in both hashtables for the position, store regular positions in the separate table and store mate scores in both tables.

You can create a separate table fi by using one bit of the index as separator. Drawback is that you halved the space for regular search.
Yes — that should work!!
http://www.chessprogramming.net - Juggernaut & Maverick Chess Engine
Cardoso
Posts: 363
Joined: Thu Mar 16, 2006 7:39 pm
Location: Portugal
Full name: Alvaro Cardoso

Re: Adding a mate searching thread to my engine

Post by Cardoso »

Ronald wrote: Sat Apr 09, 2022 10:05 am You could try to define a separate hashtable for the mate thread, look in both hashtables for the position, store regular positions in the separate table and store mate scores in both tables.

You can create a separate table fi by using one bit of the index as separator. Drawback is that you halved the space for regular search.
I already had a separate a separate hashtable for the mate searcher, it just didn't occurred me I should store mate scores in both tables. Thanks Ronald.