ChessUSA.com TalkChess.com
Hosted by Your Move Chess & Games
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

generate all PSQ tables with 16 numbers
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions Flat
View previous topic :: View next topic  
Author Message
Lucas Braesch



Joined: 31 May 2010
Posts: 2918

PostPost subject: generate all PSQ tables with 16 numbers    Posted: Fri Oct 14, 2011 5:22 pm Reply to topic Reply with quote

I was using the PSQ tables from http://chessprogramming.wikispaces.com/Simplified+evaluation+function. However, this exhaustive representation typically uses 2*6*64=768 parameters: 2 for opening/endgame, 6 for all the pieces, and 64 squares.

So I tried to reduce thie number of parameters as much a possible. Here's my code to generate all PSQ tables (for white)
Code:

static const int center[8]      = {-10,  -5,  +0,  +5,  +5,  +0,  -5, -10};
// in percent of center[]
static const int pawn_file_op   = 100;
static const int knight_center   = 200;
static const int bishop_center   = 50;
static const int queen_center_eg= 80;
static const int king_center_eg   = 100;
static const int rook_file_op   = 60;
static const int king_file_op   = -400;
// multiplied by rank
static const int king_rank_op   = -10;

// PSQ generation

for (int phase = Opening; phase <= EndGame; phase++)
   for (int sq = A1; sq <= H8; sq++) {
      const int r = rank(sq), f = file(sq);
      
      if (phase == Opening) {
         PSQTable[phase][Pawn][sq] = Material[phase][Pawn] + pawn_file_op*center[f]/100;
         PSQTable[phase][Rook][sq] = Material[phase][Rook] + rook_file_op*center[f]/100;
         PSQTable[phase][King][sq] = Material[phase][King] + king_rank_op*r
            + king_file_op*center[min(FileG,max(FileB,f))]/100;      // HACK: A and H files are forced to the same values as B and G
      } else {
         PSQTable[phase][Queen][sq] = Material[phase][Queen] + queen_center_eg * (center[r] + center[f]) / 100;
         PSQTable[phase][King][sq] = Material[phase][King] + king_center_eg * (center[r] + center[f]) / 100;
      }
      
      PSQTable[phase][Knight][sq] = Material[phase][Knight] + knight_center * (center[r] + center[f])/100;
      PSQTable[phase][Bishop][sq] = Material[phase][Bishop] + bishop_center * (center[r] + center[f])/100;
   }


Now that I've massively reduced the number of parameters, there is hope for a brute force optimisation. Has anyone managed to use CLOP+cutechess-cli to optimise eval parameters?
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Subject Author Date/Time
generate all PSQ tables with 16 numbers Lucas Braesch Fri Oct 14, 2011 5:22 pm
      Re: generate all PSQ tables with 16 numbers Ilari Pihlajisto Fri Oct 14, 2011 6:25 pm
            Re: generate all PSQ tables with 16 numbers Lucas Braesch Fri Oct 14, 2011 6:29 pm
      Re: generate all PSQ tables with 16 numbers Miguel A. Ballicora Fri Oct 14, 2011 6:27 pm
            Re: generate all PSQ tables with 16 numbers Robert Hyatt Sat Oct 15, 2011 2:52 am
                  Re: generate all PSQ tables with 16 numbers Miguel A. Ballicora Sat Oct 15, 2011 3:48 am
                        Re: generate all PSQ tables with 16 numbers Robert Hyatt Sat Oct 15, 2011 3:29 pm
                              Re: generate all PSQ tables with 16 numbers Joona Kiiski Sat Oct 15, 2011 5:12 pm
            Re: generate all PSQ tables with 16 numbers Marcel van Kervinck Sat Oct 15, 2011 9:37 pm
                  Re: generate all PSQ tables with 16 numbers Marcel van Kervinck Sat Oct 15, 2011 11:02 pm
Post new topic    TalkChess.com Forum Index -> Computer Chess Club: Programming and Technical Discussions

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group
Enhanced with Moby Threads