Engine Feedback :)
Moderator: Ras
-
R. Tomasi
- Posts: 307
- Joined: Wed Sep 01, 2021 4:08 pm
- Location: Germany
- Full name: Roland Tomasi
Re: Engine Feedback :)
Technically, I could move the sign-flip into the plyUp() and plyDown() methods. I do not want to do so however, because the framework is intented to be usable for board games with more than 2 players. In that case the sign-flip will have to be replaced by a function that makes the score "subjective", i.e. scoring from the perspective of the player that is on the move. Which is exactly what a sign-flip does in case of 2 players. With more players it get's slightly more complicated, but can be abstracted in the same fashion.
-
Ras
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine Feedback :)
The problem here is that you call this for every move you make in a node. The standard way calls such an adjustment only once before the current node is examined (in the hash table lookup), and once for hash table store when the current node examination is finished.
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 :)
That is true. I do doubt that it makes any measurable difference, though. Especially since it is branchless.Ras wrote: ↑Sat Sep 04, 2021 8:21 pmThe problem here is that you call this for every move you make in a node. The standard way calls such an adjustment only once before the current node is examined (in the hash table lookup), and once for hash table store when the current node examination is finished.
Edit: thinking about it, I think actually the adjustments get called exactly the same amount of times in both variants: you will also have to do it for every move in a node, since (I presume) you will have to lookup up the position after the move was made from the TT.
-
Ras
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine Feedback :)
Branchless? Isn't it somewhat different for positive and negative mate scores? At least, the conversion between node relative and root relative needs that distinction.
No, the latter is already down in the child node. Since I don't use the TT in QS, it means that this last level (at depth==0) doesn't have any TT lookups. Also, the score conversion upon TT lookup is only done if the stored depth draft is sufficient. Otherwise, only the stored hash move (if any) is retrieved.you will also have to do it for every move in a node, since (I presume) you will have to lookup up the position after the move was made from the TT.
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 :)
Take a look at the code I posted. I assure you that it is branchless.
Let me get this straight: you are definitely right, that I will call the methods at least as often as you, maybe even more often. I really doubt that will have any measurable impact on ELO. I guess at the end of the day it is a matter of philosophy and how you define the "score of a position". In my world-view the score of a position should reflect it's score as if I had to play it now, not some moves later in the game.Ras wrote: ↑Sat Sep 04, 2021 8:55 pm No, the latter is already down in the child node. Since I don't use the TT in QS, it means that this last level (at depth==0) doesn't have any TT lookups. Also, the score conversion upon TT lookup is only done if the stored depth draft is sufficient. Otherwise, only the stored hash move (if any) is retrieved.
[Edit: less often => more often]
-
Ras
- Posts: 2703
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Engine Feedback :)
At the price of quite some additional operations though. I'm also surprised that you don't get compiler warnings for using binary & on boolean expressions.
It's also about consistency for me. I'm using distance penalty for positive scores and distance reward for negative scores also on normal eval, not just on mate. Normal positions don't require that score adjustment because their reported score is somewhat arbitrary anyway, unlike mate distances which are an objective score.I guess at the end of the day it is a matter of philosophy and how you define the "score of a position".
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 :)
Well, when I wrote that code I profiled it extensively, actually. It's still faster than any implementation using branches. Concerning the bitwise & operator: it is actually not required to do the adjustments. It's purpose in my code is to make sure that +/- infinity scores do not get adjusted the same way mating scores would.