Not logged inRybka Chess Community Forum
Up Topic Rybka Support & Discussion / Rybka Discussion / Dissecting Queen PSTs (Fruit and R1) from first principles (locked)
- By michiguel (***) Date 2011-08-14 19:58
Queen tables can be derived from rudimentary principles like distance to corner and edge penalties. Below is the code. It is like the B tables without the diagonal bonuses.
I bet more than one program has similar tables like this.

Note that the R1 opening table is completely different than Fruit. I just want to mention this to warn from the exaggeration "10 out of 10 tables were copied". To be honest and accurate, the opening table is related to the endgame table.

Miguel


R1
Opening:
-789  -593  -495  -397  -397  -495  -593  -789
-392  -196   -98     0     0   -98  -196  -392
-294   -98     0    98    98     0   -98  -294
-196     0    98   196   196    98     0  -196
-196     0    98   196   196    98     0  -196
-294   -98     0    98    98     0   -98  -294
-392  -196   -98     0     0   -98  -196  -392
-588  -392  -294  -196  -196  -294  -392  -588

Endgame:
-648  -432  -324  -216  -216  -324  -432  -648
-432  -216  -108     0     0  -108  -216  -432
-324  -108     0   108   108     0  -108  -324
-216     0   108   216   216   108     0  -216
-216     0   108   216   216   108     0  -216
-324  -108     0   108   108     0  -108  -324
-432  -216  -108     0     0  -108  -216  -432
-648  -432  -324  -216  -216  -324  -432  -648

Fruit
Opening:
   -5    -5    -5    -5    -5    -5    -5    -5
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0
    0     0     0     0     0     0     0     0

Endgame:
  -24   -16   -12    -8    -8   -12   -16   -24
  -16    -8    -4     0     0    -4    -8   -16
  -12    -4     0     4     4     0    -4   -12
   -8     0     4     8     8     4     0    -8
   -8     0     4     8     8     4     0    -8
  -12    -4     0     4     4     0    -4   -12
  -16    -8    -4     0     0    -4    -8   -16
  -24   -16   -12    -8    -8   -12   -16   -24


#include <stdio.h>

#define A1 0
#define H1 7

#define square_file(s) (s & 7)
#define square_rank(s) (s >> 3)

#if 1
/* R1 numbers Opening */
static const int QueenTaxicabOpening = 98;
static const int QueenBackRankOpening = 201;
static const int QueenEdgePenaltyOpening = 98;
static const int QueenNormalizeOpening = -392;

/* R1 numbers Endgame */
static const int QueenTaxicabEndgame = 108;
static const int QueenEdgePenaltyEndgame = 108;
static const int QueenNormalizeEndgame = -432;
#endif

#if 0
/* Fruit numbers Opening */
static const int QueenTaxicabOpening = 0;
static const int QueenBackRankOpening = 5;
static const int QueenEdgePenaltyOpening = 0;
static const int QueenNormalizeOpening = 0;

/* Fruit numbers Endgame */
static const int QueenTaxicabEndgame = 4;
static const int QueenEdgePenaltyEndgame = 4;
static const int QueenNormalizeEndgame = -16;
#endif

int TaxiCabDistToCorner(int sq)
{
  int r,f;
  f = square_file(sq);
  r = square_rank(sq);
  /* normalize to first quadrant*/
  if (r > 3) r = 7 - r;
  if (f > 3) f = 7 - f;
  return f + r;
}

int main(void)
{
  static int qo[64], qe[64], sq;

  /* Taxicab PST, distance to closest corner */
  for (sq = 0; sq < 64; sq++) {
    qo[sq] = QueenTaxicabOpening * TaxiCabDistToCorner(sq);
    qe[sq] = QueenTaxicabEndgame * TaxiCabDistToCorner(sq);
  }

  /* Penalties for all four Edges of the qoard */
  /* Rank 1 */
  for (sq = 0; sq < 8; sq++) {
    qo[sq] -= QueenEdgePenaltyOpening + QueenBackRankOpening /* extra for dev. */;
    qe[sq] -= QueenEdgePenaltyEndgame;
  }
  /* A */
  for (sq = 0; sq < 64; sq += 8) {
    qo[sq] -= QueenEdgePenaltyOpening;
    qe[sq] -= QueenEdgePenaltyEndgame;
  }
  /* H */
  for (sq = 7; sq < 64; sq += 8) {
    qo[sq] -= QueenEdgePenaltyOpening;
    qe[sq] -= QueenEdgePenaltyEndgame;
  }
  /* Rank 8 */
  for (sq = 56; sq < 64; sq++) {
    qo[sq] -= QueenEdgePenaltyOpening;
    qe[sq] -= QueenEdgePenaltyEndgame;
  }

  /* General normalization of the PST */
  for (sq = 0; sq < 64; sq++) {
    qo[sq] += QueenNormalizeOpening;
    qe[sq] += QueenNormalizeEndgame;
  }

  /* print, adapted from BH */
  printf("Opening:\n");
  for (sq = 0; sq <= 56; sq += 8) {
    int t;
  for (t = sq; t < sq + 8; t++)
    printf("%5d ", qo[t]);
    printf("\n");
  }
  printf("\n");
  printf("Endgame:\n");
  for (sq = 0; sq <= 56; sq += 8) {
    int t;
    for (t = sq; t < sq + 8; t++)
      printf("%5d ", qe[t]);
    printf("\n");
  }
}
Up Topic Rybka Support & Discussion / Rybka Discussion / Dissecting Queen PSTs (Fruit and R1) from first principles (locked)

Powered by mwForum 2.27.4 © 1999-2012 Markus Wichitill