Normalizing the eval

Discussion of chess software programming and technical issues.

Moderators: hgm, Rebel, chrisw

Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Normalizing the eval

Post by Michael Sherwin »

Code: Select all

void Normalize() { 
  s32 sq; 
  s32 highWN; 
  s32 highBN; 
  s32 highWB; 
  s32 highBB; 
  s32 highWR; 
  s32 highBR; 
  s32 highWQ; 
  s32 highBQ; 
  s32 limit;

  highWN = -INFINITY; 
  highBN = -INFINITY; 
  highWB = -INFINITY; 
  highBB = -INFINITY; 
  highWR = -INFINITY; 
  highBR = -INFINITY; 
  highWQ = -INFINITY; 
  highBQ = -INFINITY;

  limit = 90;

  for&#40;sq = A1; sq <= H8; sq++) &#123; 
    if&#40;wKnightTbl&#91;sq&#93; > highWN&#41; highWN = wKnightTbl&#91;sq&#93;; 
    if&#40;bKnightTbl&#91;sq&#93; > highBN&#41; highBN = bKnightTbl&#91;sq&#93;; 
    if&#40;wBishopTbl&#91;sq&#93; > highWB&#41; highWB = wBishopTbl&#91;sq&#93;; 
    if&#40;bBishopTbl&#91;sq&#93; > highBB&#41; highBB = bBishopTbl&#91;sq&#93;; 
    if&#40;wRookTbl&#91;sq&#93;   > highWR&#41; highWR = wRookTbl&#91;sq&#93;; 
    if&#40;bRookTbl&#91;sq&#93;   > highBR&#41; highBR = bRookTbl&#91;sq&#93;; 
    if&#40;wQueenTbl&#91;sq&#93;  > highWQ&#41; highWQ = wQueenTbl&#91;sq&#93;; 
    if&#40;bQueenTbl&#91;sq&#93;  > highBQ&#41; highBQ = bQueenTbl&#91;sq&#93;; 
  &#125; 

  for&#40;sq = A1; sq <= H8; sq++) &#123; 
    if&#40;highWN > limit&#41; wKnightTbl&#91;sq&#93; *= &#40;limit / highWN&#41;; 
    if&#40;highBN > limit&#41; bKnightTbl&#91;sq&#93; *= &#40;limit / highBN&#41;; 
    if&#40;highWB > limit&#41; wBishopTbl&#91;sq&#93; *= &#40;limit / highWB&#41;; 
    if&#40;highBB > limit&#41; bBishopTbl&#91;sq&#93; *= &#40;limit / highBB&#41;; 
    if&#40;highWR > limit&#41; wRookTbl&#91;sq&#93;   *= &#40;limit / highWR&#41;; 
    if&#40;highBR > limit&#41; bRookTbl&#91;sq&#93;   *= &#40;limit / highBR&#41;; 
    if&#40;highWQ > limit&#41; wQueenTbl&#91;sq&#93;  *= &#40;limit / highWQ&#41;; 
    if&#40;highBQ > limit&#41; bQueenTbl&#91;sq&#93;  *= &#40;limit / highBQ&#41;; 
  &#125;
&#125;
I have limit set to 90 centi pawns for all pieces. My question is, do I need different limits for different piece types, game stages, circumstances and what is the best guess for those values. Thanks!

I should add that the eval for each piece is all accumulated into the piece square tables.

Code: Select all

    // Knight Tables
    moves = knight&#91;sq&#93; & ~aPieces;
    trgts = knight&#91;sq&#93; & &#40;bRooks | bQueens | bKings&#41;;
    wKnightTbl&#91;sq&#93; = PopCnt&#40;moves&#41; * 4 + PopCnt&#40;trgts&#41; * 8;
    wKnightTbl&#91;sq&#93; += (&#40;cenRow + cenRow&#41; * &#40;cenCol + cenCol&#41; + row * 3&#41;;
    if&#40;cenCol == 0&#41; wKnightTbl&#91;sq&#93; -= 20;
    g = evalHistTblg&#91;WN&#93;&#91;sq&#93;; n = evalHistTbln&#91;WN&#93;&#91;sq&#93;;
    wKnightTbl&#91;sq&#93; += &#40;n > 99 ? g/n &#58; 0&#41;;
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through
Michael Sherwin
Posts: 3196
Joined: Fri May 26, 2006 3:00 am
Location: WY, USA
Full name: Michael Sherwin

Re: Normalizing the eval

Post by Michael Sherwin »

First quick test of above idea. RomiChess vs Monolith. Best previous result Romi 53%. Early results for this test.

RomiChess64P3o - Monolith_03_x64 : 21.0/31 16-5-10 (=010=1101=1110011==1==1111=11==) 68% +131
:D

Will see if it holds up.
If you are on a sidewalk and the covid goes beep beep
Just step aside or you might have a bit of heat
Covid covid runs through the town all day
Can the people ever change their ways
Sherwin the covid's after you
Sherwin if it catches you you're through