Chan Rasjid wrote:Hello,
My program has a hashing bug that I could not resolve after weeks of attempts. If anyone had come across a similar situation in the development of their engine, I would like to know the solution.
With TT hashing enabled, my program plays normally from the start position and does not do strange moves. But when given KQK or KRK positions, it fails to mate and will concede a repetition/fifty-moves draw.
But with TT disabled, it does successfully mate with KQK or KRK. With KRK, it will take some moves to force the lone king into the corner. When it detects mate, matesearch() will be called starting at root. The root search iterates through even depth 2/4/6/8.. to seek the best mate. It will take almost zero second for it to find the next better mate move: mate in 5/4/3/2/1 - checkmate.
...
Hi Chan,
well, first i am not sure if it is the best idea to go with that kind of
special search within gameplay, because imo it could ( should be ) handled
with the normal search. Even to detect a shortest mate might be flagged
in a research and mate bounds for example, if it is that important to you.
But that isnt the topic...
Second, i did not studdied your code snipped, but i want to give you some
general ideas what you can look for when having this kind of problem.
( i try to leave out the obvious things already mentioned, but that
doesnt mean to forget them, even if you think you prooved it 20 times
before

)
* simply try to find and catch artificial mate values inside the search which
are outside the mate bounds. If there are some, locate them...
* make your test frame simple as possible like to disable aspiration
window, or mate detection in QS and things like that
uninitialized variables like bValue in a failSoft frame can cause stupid
things in an aspiration search with artificial windows ( not if done right ).
or simply try out to disable TT-pruning within PV for example.
* to prevent as good as possible search instabilities try out mateDistance
Pruning. This is a general good idea to have it in.
* check out the effect of repetion detection and TT
* combine all this stuff step by step, and you will get it to work
* if your move generator uses special evasion functions, check them
out again if they _really_ work propper. More General make sure
you legal move validation code works proper.
Well, after checking "mating" code sippets i would start looking for
invalid values outside the mate bounds...
Good Luck,
Michael