Author: Sergei S. Markoff
Date: 23:57:50 09/26/04
Go up one level in this thread
> But you don't give a draw (0) score here. And what sergie is talking
>about is giving a 0 score.
Oh, no-no. I'm using dividing/adidtions, because not all of this positions are
really drawn.
I have a lot of knowledge like that. It's "inexact" knowledge.
==== begin ====
// remark: c0 is current evaluation.
// getevalq -- special function to determine if king can't stop the pawn
// returns 1 if it can't stop it;
const int b_pawn_compensation[8]={0,100,100,90,75,55,35,0};
const int b_pawn_compensation_out[8]={0,90,90,70,45,25,10,0};
const int pawn_compensation[8]={0,95,95,70,45,30,15,0};
const int pawn_compensation_out[8]={0,60,60,35,15,7,3,0};
int ThreePawnsEval(int c0)
{
if(!passed_b&&!passed_w)
{
if(NumOfPieces[WHITE]==NumOfPieces[BLACK])
if((Majors[WHITE]&&Minors[WHITE])||(Minors[WHITE]>1))
if(Majors[WHITE]==Majors[BLACK])
{
if(NumberOfPawns[WHITE]>NumberOfPawns[BLACK])
{
FIELD pawn_pos=FirstOne(Pawns[WHITE]);
int
out_of_square=getevalq(SideToMove,pawn_pos,KingPos[WHITE],KingPos[BLACK]);
if(Bishops[BLACK])
{
if(out_of_square)
{
c0+=b_pawn_compensation_out[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
else
{
c0+=b_pawn_compensation[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
}
else
{
if(out_of_square)
{
c0+=pawn_compensation_out[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
else
{
c0+=pawn_compensation[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
}
}
else
{
FIELD pawn_pos=LastOne(Pawns[BLACK]);
int
out_of_square=getevalq(ChangeSide(SideToMove),63-pawn_pos,63-KingPos[BLACK],63-KingPos[WHITE]);
if(Bishops[WHITE])
{
if(out_of_square)
{
c0-=b_pawn_compensation_out[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
else
{
c0-=b_pawn_compensation[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
}
else
{
if(out_of_square)
{
c0-=pawn_compensation_out[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
else
{
c0-=pawn_compensation[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
}
}
}
}
return (c0);
}
int OnePawnEval(int c0)
{
if(NumOfPieces[WHITE]==NumOfPieces[BLACK])
if(Majors[WHITE]==Majors[BLACK])
{
if((Majors[WHITE]&&Minors[WHITE])||(Minors[WHITE]>1))
{
if(NumberOfPawns[WHITE])
{
FIELD pawn_pos=LastOne(Pawns[WHITE]);
int
out_of_square=getevalq(SideToMove,pawn_pos,KingPos[WHITE],KingPos[BLACK]);
if(Bishops[BLACK])
{
if(out_of_square)
{
c0+=b_pawn_compensation_out[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
else
{
c0+=b_pawn_compensation[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
}
else
{
if(out_of_square)
{
c0+=pawn_compensation_out[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
else
{
c0+=pawn_compensation[N_HOR(pawn_pos)];
if(c0>-13) c0=-12+(c0>>3);
}
}
}
else
{
FIELD pawn_pos=LastOne(Pawns[BLACK]);
int
out_of_square=getevalq(ChangeSide(SideToMove),63-pawn_pos,63-KingPos[BLACK],63-KingPos[WHITE]);
if(Bishops[WHITE])
{
if(out_of_square)
{
c0-=b_pawn_compensation_out[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
else
{
c0-=b_pawn_compensation[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
}
else
{
if(out_of_square)
{
c0-=pawn_compensation_out[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
else
{
c0-=pawn_compensation[7-N_HOR(pawn_pos)];
if(c0<13) c0=12+(c0>>3);
}
}
}
}
else if(NumOfPieces[WHITE]&&(NumOfPieces[WHITE]<9))
{
if(pawns_w)
{
FIELD sq=FirstOne(Pawns[WHITE]);
if(preventsw[sq]&KingSquare[BLACK]) c0>>=1;
}
else
{
FIELD sq=LastOne(Pawns[BLACK]);
if(preventsb[sq]&KingSquare[WHITE]) c0>>=1;
}
}
}
return (c0);
}
...
{
int total_pawns=NumberOfPawns[WHITE]+NumberOfPawns[BLACK];
if(total_pawns==3) c0=ThreePawnsEval(c0);
else if(total_pawns==1) c0=OnePawnEval(c0);
}
===== end =====
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.