CookieCat Monday release schedule

Discussion of chess software programming and technical issues.

Moderators: hgm, Harvey Williamson, bob

Forum rules
This textbox is used to restore diagrams posted with the [d] tag before the upgrade.
Post Reply
User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

CookieCat Monday release schedule

Post by sje » Mon Dec 19, 2011 10:14 pm

CookieCat has gotten some fixes and some additions. The most notable addition is the tablebase initialization and class probe code. However, the tablebase file probe code is not there yet, so I'll wait until next Monday 2011.12.26 for a source release. With some luck, I might even get the PGN parser and the opening book ready, too.

Some new code:

Code: Select all

  type

    { Tablebase descriptor record; one per tablebase class }

    tbdrtype =
      record
        tbc:       tbctype;                       { Tablebase class }
        osmsigvec: osmsigvectype;                 { One side material signature vector }
        msig:      msigtype;                      { Material signature key; not color reversed }
        mancount:  Integer;                       { Man count (total) }
        mcvec:     array [colorrtype] of Integer; { Man counts indexed by color }
        fold:      foldtype;                      { Folding mode }
        foldslot:  tbslottype;                    { Slot to be folded }
        name:      String;                        { Class name }
        fnvec:     array [colorrtype] of String   { TB filenames indexed by color on the move }
      end;

    { Tablebase material signature mapping descriptor record; two per tablebase class }

    tbmsmtype =
      record
        tbc:   tbctype;  { Tablebase class }
        msig:  msigtype; { Material signature key; may be color reversed }
        isrev: Boolean   { Reversed sense flag }
      end;

    { Tablebase file }

    tbftype    = file of ui8type;
    tbfptrtype = ^tbftype;

    { Tablebase file record }

    tbfrtype =
      record
        isbroken: Boolean;    { True if open failed }
        name:     String;     { File name }
        tbfptr:   tbfptrtype  { Pointer to file }
      end;

    { Tablebase file record vector }

    tbfrvectype    = array [tbctype, colorrtype] of tbfrtype;
    tbfrvecptrtype = ^tbfrvectype;

  function PosProbeTablebaseSignatureVector(var pos: postype): tbcmsxtype;
    var
      myresult: tbcmsxtype;
      b0, b1, probe: si32type;
  begin
    myresult := tbcmsnil;
    b0 := 0;
    b1 := tbcmsmax;
    repeat
      probe := (b0 + b1) div 2;
      if pos.msig = tbmsmvec[probe].msig then
        myresult := tbcmstype(probe)
      else
        if pos.msig < tbmsmvec&#91;probe&#93;.msig then
          b1 &#58;= probe - 1
        else
          b0 &#58;= probe + 1
    until &#40;myresult <> tbcmsnil&#41; or &#40;b0 > b1&#41;;
    PosProbeTablebaseSignatureVector &#58;= myresult
  end; &#123; PosProbeTablebaseSignatureVector &#125;

User avatar
sje
Posts: 4675
Joined: Mon Mar 13, 2006 6:43 pm

CookieCat tablebase implementation

Post by sje » Wed Dec 21, 2011 11:13 pm

I have finished the second half of CookieCat's tablebase implementation, so now both the initialization and the probe code are both up and running. There are still a few rough edges, but it seems to work so it will be in the next source release.

A CookieCat game played in less than a second and starting from a maximum DTM position in KRPKR:

Code: Select all

&#91;Event "Unknown event"&#93;
&#91;Site "Unknown site"&#93;
&#91;Date "2011.12.21"&#93;
&#91;Round "-"&#93;
&#91;White "Unknown player"&#93;
&#91;Black "Unknown player"&#93;
&#91;Result "1-0"&#93;
&#91;FEN "7k/8/8/8/8/3R4/1P6/r5K1 w - - 0 1"&#93;

1 Kf2 Kg7 2 Ke3 Kf6 3 Kd4 Ke6 4 Kc5 Ra5+ 5 Kb6 Ra8 6 Kb7 Ra5 7 Rd2 Ra2 8 Kc6 Ra6+ 9 Kb5 Ra8 10 Rh2
Rf8 11 Kc6 Rb8 12 Rh6+ Ke7 13 Rh7+ Ke6 14 Rh2 Ke7 15 Kc7 Rb3 16 Re2+ Kf7 17 Kc6 Rb8 18 Kc5 Rc8+ 19
Kb4 Rb8+ 20 Kc3 Rc8+ 21 Kd2 Rb8 22 Kc2 Rc8+ 23 Kb1 Rb8 24 Re3 Rd8 25 Kc2 Rc8+ 26 Kd3 Rb8 27 Kc3
Rc8+ 28 Kd4 Rd8+ 29 Kc5 Rc8+ 30 Kd6 Rb8 31 b3 Rb5 32 Kc6 Rb8 33 Rd3 Kf8 34 Kc5 Ke7 35 b4 Rc8+ 36
Kb5 Rb8+ 37 Ka4 Ra8+ 38 Kb3 Rb8 39 Rd4 Ke6 40 Kc4 Ke5 41 R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