Symbolic vs KingSlayer

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Underpromotion

Post by hgm »

mvk wrote:Very impressive, well done! +9-0=1 against kingslayer.
Well, no surprise there. Mini-Rodent has king safety, mobility, passers and other pawn structure, King Slayer plays with PST only. Mini-Rodent was announced as 2500+, and I suspect that on that same scale TSCP would be 1700, Fairy-Max 1900, Symbolic 2000, King Slayer 2200. I am not sure PST-only engines could ever get above 2300 Elo. Extreme reductions that make top engines strong probably just backfire if the evaluation is so inaccurate that shallow searches do not give a good prediction for the result of deep searches.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Ratings estimates

Post by sje »

Symbolic on ICC:

Code: Select all

              rating [need] win  loss  draw total   best
Bullet          2515       1324   436    89  1849   2747 (22-Nov-2006) 
Blitz           2295       5696  3423  1064 10183   2822 (14-Mar-2007) 
Standard        2326       6114  4315  1087 11516   2603 (18-Feb-2007)
User avatar
hgm
Posts: 27796
Joined: Fri Mar 10, 2006 10:06 am
Location: Amsterdam
Full name: H G Muller

Re: Ratings estimates

Post by hgm »

Well, obviously no one would quote ICC ratings. I played micro-Max for a few days on ICC, and it was also already above 2200 there. The scale is completely off, I think there are humans there with a rating of over 3000.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

The second match

Post by sje »

The second match has started and Symbolic's score after 60 games is 14 wins / 42 losses / 4 draws = -176 elo, an almost 50 point improvement.

The reasons for the improvement? Changing Symbolic's main transposition table from single bin to double bin (like its perft() table) and tripling its book size to about 1.7 position/move pairs.

But much is also due to randomness from having a limited sample size.

----

Symbolic's double bin code for its main transposition table was copied from the perft() table code. The probe/stash routines:

Code: Select all

bool FTTBase::Probe(const Position& position, FTRec& ftrec)
{
  const Hash addrhash = position.CalcFTBaseHash();
  const usize offset = (addrhash.GetQwrd0() & addrmask);
  const ui slice = CalcSlice(offset);
  const FTTItemPtr probeptr0 = storage + offset;
  const FTTItemPtr probeptr1 = storage + (offset ^ 1);
  bool found;

  IncrProbe();
  SLSliceVec[slice].Lock();

  if (probeptr0->hash == addrhash)
  {
    ftrec = probeptr0->ftrec;
    found = true;
  }
  else
  {
    if (probeptr1->hash == addrhash)
    {
      ftrec = probeptr1->ftrec;
      found = true;
    }
    else
    {
      ftrec.Reset();
      found = false;
    };
  };

  if (EnableTranStats && found)
    IncrMatch();

  SLSliceVec[slice].Unlock();
  return found;
}

void FTTBase::Stash(const Position& position, const FTRec ftrec)
{
  const Hash addrhash = position.CalcFTBaseHash();
  const usize offset = (addrhash.GetQwrd0() & addrmask);
  const ui slice = CalcSlice(offset);
  const FTTItemPtr probeptr0 = storage + offset;
  const FTTItemPtr probeptr1 = storage + (offset ^ 1);
  FTTItemPtr entryptr;

  IncrStash();
  SLSliceVec[slice].Lock();

  if (probeptr0->hash == addrhash)
    entryptr = probeptr0;
  else
  {
    if (probeptr1->hash == addrhash)
      entryptr = probeptr1;
    else
    {
      const bool israre = ((DIPtr->TickCount & 0x07) == 0);

      if &#40;probeptr0->ftrec.draft < probeptr1->ftrec.draft&#41;
      &#123;
        if &#40;israre&#41;
          entryptr = probeptr1;
        else
          entryptr = probeptr0;
      &#125;
      else
      &#123;
        if &#40;israre&#41;
          entryptr = probeptr0;
        else
          entryptr = probeptr1;
      &#125;;
    &#125;;
  &#125;;

  if &#40;EnableTranStats && entryptr->hash.IsReset&#40;))
    IncrUsage&#40;);

  entryptr->hash = addrhash;
  entryptr->ftrec = ftrec;

  SLSliceVec&#91;slice&#93;.Unlock&#40;);
&#125;
Note the use of the israre boolean variable in the Stash() routine. Usually, the entry with the lesser draft is overwritten. But less commonly, the other entry is overwritten instead to avoid geriatric data from clogging up to half the total table space. The israre variable is set true randomly with a one in eight chance using a real time tick counter with a 100 Hz frequency. The 1/8 probability seemed to work well with perft(), but a different, perhaps lower value would be better for regular searching.

KingSlayer has a coin-toss switch in its table code which appears to have a similar role. But it looks like it runs with probability of 0.5, not 0.125. I suppose I could change the code in Symbolic to match, but I think a better approach would be to have the replacement odds selected based on the difference between the draft values of the two table entries.
mvk
Posts: 589
Joined: Tue Jun 04, 2013 10:15 pm

Re: Underpromotion

Post by mvk »

hgm wrote:
mvk wrote:Very impressive, well done!
Well, no surprise there.
I find it impressive that Mini Rodent packs such a complete program in so little code while keeping the source a pleasure to read.
[Account deleted]
PK
Posts: 893
Joined: Mon Jan 15, 2007 11:23 am
Location: Warsza

Re: Underpromotion

Post by PK »

It's nice to hear that I did not spoil Sungorus code too much :) Personally I have found Sungorus code very clear and concise (the quality I wanted to preserve), but lacking from the chess point of view. Especially piece/square tables with fourfold symmetry made engine's play really painful to watch.

Last time I started from the same codebase, though, code got out of hand and became unmaintainable after 4 years (see https://github.com/nescitus/rodent_rewrite). So this time I intend to go much more slowly with adding new features. The goal is to beat Fruit 2.1 with less than 2500 lines of code.
mar
Posts: 2555
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Underpromotion

Post by mar »

PK wrote:The goal is to beat Fruit 2.1 with less than 2500 lines of code.
Well, Stockfish is 5300 lines of code and beats anything out there.
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

Second match completed

Post by sje »

Second match completed

Symbolic vs KingSlayer WLD 22-72-6 (-191 elo)

Games: https://dl.dropboxusercontent.com/u/316 ... 002.pgn.gz
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 7:43 pm

A better complexity metric

Post by sje »

mar wrote:
PK wrote:The goal is to beat Fruit 2.1 with less than 2500 lines of code.
Well, Stockfish is 5300 lines of code and beats anything out there.

Code: Select all

Symbolic sje$ grep \; * | wc -l
   11421
Further:

Code: Select all

Symbolic sje$ grep goto * | wc -l
       0
Symbolic sje$ grep continue * | wc -l
       0
Daniel Anulliero
Posts: 759
Joined: Fri Jan 04, 2013 4:55 pm
Location: Nice

Re: The second match

Post by Daniel Anulliero »

sje wrote:The second match has started and Symbolic's score after 60 games is 14 wins / 42 losses / 4 draws = -176 elo, an almost 50 point improvement.

The reasons for the improvement? Changing Symbolic's main transposition table from single bin to double bin (like its perft() table) and tripling its book size to about 1.7 position/move pairs.

But much is also due to randomness from having a limited sample size.

I think 100 games is too few to mesure improvements between two versions .I play always 800 games with the first move like à book .