rkiss and other dependencies in syzygy

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: rkiss and other dependencies in syzygy

Post by syzygy »

Don wrote:Then I look and see this:

static RKISS rk;

And not a single reference to it in your code.
It's just a seed for a random generator, but it's not used anymore so I should have removed it. Just delete the line and the include file.

Bitboard is just uint64.
pop_lsb is what it says.
Position is what Stockfish calls its position class. Komodo surely has one but it will be a bit different. What must be extracted is:
- number of pieces of particular type and color;
- squares of those pieces for a particuar type and color;
- material signature (the code assumes you already have one, which seems reasonable, which saves the effort of calculating one);
- side to move;
- 50-move counter.
Somewhat tricky is has_repeated(): does the game history since the last reset of the 50-move counter contain two identical positions. I should have added a comment there.

MoveStack, StateInfo and CheckInfo are just things that Stockfish happens to require to generate and make moves. You know how to do this in Komodo.

Zobrist* is used only for calculating the material signature the way Stockfish does it. You should calculate it the way Komodo does it (in calc_key() and calc_key_from_pcs()).

Basically just delete everything you don't understand but keep the comments.
Last edited by syzygy on Wed Oct 23, 2013 7:39 pm, edited 1 time in total.
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: rkiss and other dependencies in syzygy

Post by Don »

syzygy wrote:
Don wrote:Then I look and see this:

static RKISS rk;

And not a single reference to it in your code.
It's just a seed for a random generator, but it's not used anymore so I should have removed it. Just delete the line and the include file.

Bitboard is just uint64.
pop_lsb is what it says.
Position is what Stockfish calls its position class. Komodo surely has one but it will be a bit different. What must be extracted is:
- number of pieces of particular type and color;
- squares of those pieces for a particuar type and color;
- material signature (the code assumes you already have one, which seems reasonable, which saves the effort of calculating one);
- side to move;
- 50-move counter.
Somewhat tricky is has_repeated(): does the game history since the last reset of the 50-move counter contain two identical positions. I should have added a comment there.

MoveStack, StateInfo and CheckInfo are just things that Stockfish happens to require to generate and make moves. You know how to do this in Komodo.

Basically just delete everything you don't understand but keep the comments.
Ok, I basically removed all the includes that are based on stockfish and implementing your functions one by one the komodo way. And yes, in Komodo I have a position state called "position" - so it's more or less straightforward.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
syzygy
Posts: 5563
Joined: Tue Feb 28, 2012 11:56 pm

Re: rkiss and other dependencies in syzygy

Post by syzygy »

Don wrote:Just so that I don't spin my wheels, which version of Stockfish do I have to download to understand this code? Is the latest official release good enough or do I have to get one of the new development versions?
Maybe it is easiest to look here:
https://github.com/syzygy1/Stockfish

This is an up to date Stockfish with slightly updated probing code. It also has a root_probe_wdl() function that can serve as a fallback in case DTZ tables are not available. In addition, it has an updated initialisation function (Tablebases::init()) that can be invoked with a path to the various tablebase directories. This fits better with the UCI way of doing things.

(Oh, I see I am responding to an older post I had missed earlier.)
User avatar
Don
Posts: 5106
Joined: Tue Apr 29, 2008 4:27 pm

Re: rkiss and other dependencies in syzygy

Post by Don »

syzygy wrote:
Don wrote:Just so that I don't spin my wheels, which version of Stockfish do I have to download to understand this code? Is the latest official release good enough or do I have to get one of the new development versions?
Maybe it is easiest to look here:
https://github.com/syzygy1/Stockfish

This is an up to date Stockfish with slightly updated probing code. It also has a root_probe_wdl() function that can serve as a fallback in case DTZ tables are not available. In addition, it has an updated initialisation function (Tablebases::init()) that can be invoked with a path to the various tablebase directories. This fits better with the UCI way of doing things.

(Oh, I see I am responding to an older post I had missed earlier.)
Thanks, I'll use that one then.

Don
Capital punishment would be more effective as a preventive measure if it were administered prior to the crime.
JohnS
Posts: 215
Joined: Sun Feb 24, 2008 2:08 am

Re: rkiss and other dependencies in syzygy

Post by JohnS »

Don wrote:
static RKISS rk;
Don't know anything about syzygy, but rkiss (kiss) is a random number generator from George Marsaglia: http://www.math.niu.edu/~rusin/known-math/99/RNG.

Rkiss generates random 32-bit real numbers between 0 and 1. You could use lots of other generators instead such as the ones Marsaglia describes presuming the choice is not critical for syzygy.