Hi there!
I've taken all of your advice from my post last night and stripped my engine down to the bare minimum - basic evaluation and nothing too crazy in search - and am starting to slowly test each addition I've made.
I just made my engine's code public on github and would love any feedback/suggestions/bug finds that you could provide me with! From what you've told me, my engine should perform at least in the 2500 CCRL elo range.
Have a blessed day!
- Ori
Engine Feedback :)
Moderator: Ras
-
Mergi
- Posts: 127
- Joined: Sat Aug 21, 2021 9:55 pm
- Full name: Jen
Re: Engine Feedback :)
Hey! I had just a very quick glance over the search code, and one thing i noticed is that when you are saving/probing from the TT, you don't seem adjust your mate scores to always be of absolute length from the root position you are currently searching. This can lead to some very nasty bugs in the endgame, when you have a mate score in the TT from a previous search, and you might mistakenly think it's x moves long, since that was the length when you put it in your TT in some previous search, but now in fact, it might be of a different length.
-
j.t.
- Posts: 268
- Joined: Wed Jun 16, 2021 2:08 am
- Location: Berlin
- Full name: Jost Triller
Re: Engine Feedback :)
I just want to note that sometimes a lot of the playing strength depends on details. You can find engines with the same features (delta pruning, razoring, singular extensions, futility pruning, LMR, etc.), that perform wildly differently.
-
amanjpro
- Posts: 883
- Joined: Sat Mar 13, 2021 1:47 am
- Full name: Amanj Sherwany
Re: Engine Feedback :)
My engine is doing the same... And I have not seen any strange behavior yet, even though I watch lots of games of my engine.Mergi wrote: ↑Thu Aug 26, 2021 11:46 am Hey! I had just a very quick glance over the search code, and one thing i noticed is that when you are saving/probing from the TT, you don't seem adjust your mate scores to always be of absolute length from the root position you are currently searching. This can lead to some very nasty bugs in the endgame, when you have a mate score in the TT from a previous search, and you might mistakenly think it's x moves long, since that was the length when you put it in your TT in some previous search, but now in fact, it might be of a different length.
But I agree with you, this is an issue that needs attention... I hope I fix mine before next release
-
Mergi
- Posts: 127
- Joined: Sat Aug 21, 2021 9:55 pm
- Full name: Jen
Re: Engine Feedback :)
The issue with TT mate scores is somewhat alleviated (read: more obscured and harder to debug) if the engine is re-searching PV nodes, like OP does. However in some cases, for example if the PV changes, this can lead to wrong cutoffs in the tree if you have alphas/betas with now incorrect mate score stored in the TT as well.
-
oriyonay
- Posts: 32
- Joined: Tue Jun 01, 2021 5:46 am
- Full name: ori yonay
Re: Engine Feedback :)
Thank you for the response! I'm not sure I'm exactly understanding what the problem is exactly and how to fix it - how should I be handling mate scores?Mergi wrote: ↑Thu Aug 26, 2021 7:12 pmThe issue with TT mate scores is somewhat alleviated (read: more obscured and harder to debug) if the engine is re-searching PV nodes, like OP does. However in some cases, for example if the PV changes, this can lead to wrong cutoffs in the tree if you have alphas/betas with now incorrect mate score stored in the TT as well.
-
Ras
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine Feedback :)
Problem: you store the mate distance relative to your current root node. In the next turn, you are one full move further in the game, and the old mate distance stored in the TT is now wrong. What was a mate-in-6 in the turn before is now a mate-in-4.
Solution: when you store into the TT, you convert from root relative distance to node relative distance, and when reading, you convert from node distance to root distance.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
R. Tomasi
- Posts: 307
- Joined: Wed Sep 01, 2021 4:08 pm
- Location: Germany
- Full name: Roland Tomasi
Re: Engine Feedback :)
I may be missunderstanding the problem, so don't shoot me if what I say is wrong. But isn't a simple remedy to that problem to implement mate scores in a way that represents the distance of the mate from the the position that corresponds to the score? I simply fail to imagine in what context distances from the root help in any way? Am I overlooking something?Ras wrote: ↑Fri Aug 27, 2021 12:22 amProblem: you store the mate distance relative to your current root node. In the next turn, you are one full move further in the game, and the old mate distance stored in the TT is now wrong. What was a mate-in-6 in the turn before is now a mate-in-4.
Solution: when you store into the TT, you convert from root relative distance to node relative distance, and when reading, you convert from node distance to root distance.
-
Ras
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine Feedback :)
Then how do you propagate a mate score found at the leaves back to the root? Do you change the score at each level?
In the end, you need to select a root move in order to continue the game. You'll want to select the shortest mate because otherwise, you may not make progress towards actually delivering checkmate.I simply fail to imagine in what context distances from the root help in any way?
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
R. Tomasi
- Posts: 307
- Joined: Wed Sep 01, 2021 4:08 pm
- Location: Germany
- Full name: Roland Tomasi
Re: Engine Feedback :)
Yes, that's exactly what I do. My score class has a plyUp() method and a plyDown() method.
Certainly. The shortest mate gives the highest score. So it get's selected by the AB search automatically.Ras wrote: ↑Sat Sep 04, 2021 8:07 pmIn the end, you need to select a root move in order to continue the game. You'll want to select the shortest mate because otherwise, you may not make progress towards actually delivering checkmate.I simply fail to imagine in what context distances from the root help in any way?
It looks like that in my source code:
Code: Select all
sc = -subnode.search(-beta.plyDown(), -alpha.plyDown(), depthType(-1), depth + 1, principalVariation, str, allowStoreTT).plyUp();
Code: Select all
constexpr auto plyUp() const noexcept
{
return score(m_Value + ((m_Value < LOSINGVALUE) & (m_Value > MINVALUE)) - ((m_Value > WINNINGVALUE) & (m_Value < MAXVALUE)), 0);
}
constexpr auto plyDown() const noexcept
{
return score(m_Value - ((m_Value < LOSINGVALUE) & (m_Value > (MINVALUE + 1))) + ((m_Value > WINNINGVALUE) & (m_Value < (MAXVALUE - 1))), 0);
}