Computer Chess Club Archives


Search

Terms

Messages

Subject: What is wrong with this tablebase code?

Author: Todd Segal

Date: 21:23:25 05/11/02


This is just a hack for a board with 2 K's and one Q (a sure win) and I always
get the same wrong probing value. Is there anything wrong with the code?

Thanks!

- Todd Segal


#include <stdlib.h>
#include <stdio.h>
/* Macros necessary for tbindex to function */
#define NEW //Use Nalimov new function
#define XX 127 //Out of bounds
#define DEBUG 1
#define T41_INCLUDE

typedef unsigned int INDEX;
typedef unsigned int square;
int turn = 0;
INDEX SqFindKing(square *p) { if (turn == 0)
{ turn = 1; return 32; } else return 31; }
INDEX SqFindOne (square *pcs, int p) { return 7;}
INDEX SqFindFirst (square *pcs, int p) { return 11;}
INDEX SqFindSecond (square *pcs, int p) { return 13;}
INDEX SqFindThird (square *pcs, int p) { return 20;}

#include "tbindex.cpp"

int main()
{
  int num = IInitializeTb("YOUR TB DIR");
  printf("NUMBER of TB's %d\n", num);

  int counts[10];

  counts[0] = 0;
  counts[1] = 0;
  counts[2] = 0;
  counts[3] = 0;
  counts[4] = 1;
  counts[5] = 0;
  counts[6] = 0;
  counts[7] = 0;
  counts[8] = 0;
  counts[9] = 0;

  int iTb = IDescFindFromCounters(counts);
  printf("This is the correct TB: %d\n", iTb);

  printf("Are both of them registered...?: ");
  if (FRegistered(iTb, 0) && FRegistered(iTb, 1))
    printf("true\n");
  else
    printf("false\n");

  int flip = 0;
  square w[24], b[24];
  for (int i = 0; i < 24; i++)
    w[i] = b[i] = 13;

  int eP = 127;

  INDEX index = PfnIndCalc(iTb, 1) (w, b, eP, flip);
  printf("The index value is....%d\n", index);

  int tbscore = L_TbtProbeTable(iTb, 0, index);
  printf ("And the score is %d\n", tbscore);

  return 1;
}



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.