Hi I would like to see scores used for different cases...
for example...
in doubled,passed pawns
in control of the center
bad bishops
material balance...
and other thingss
cheers for everyone! [/b]
Moderator: Andres Valverde
pimidrez wrote:Hi I would like to see scores used for different cases...
for example...
in doubled,passed pawns
in control of the center
bad bishops
material balance...
and other thingss
cheers for everyone! [/b]
Ron Murawski wrote:The best way to get a feel for evaluation scoring is by studying open-source chess engines. Take a look at them and you will find they give similar bonuses for the items you mentioned. Some of the engines names to look for:Arasan
There's lots of others, too.
Beowulf
Crafty
EXchess
Faile
Fruit
Glaurung (and Viper)
Kiwi
Sloppy
SlowChess
TSCP
Depth extension(const Position &pos, Move m, bool pvNode,
bool check, bool singleReply, bool mateThreat) {
Depth result = Depth(0);
if(check)
result += CheckExtension[pvNode];
if(singleReply)
result += SingleReplyExtension[pvNode];
if(pos.move_is_pawn_push_to_7th(m))
result += PawnPushTo7thExtension[pvNode];
if(pos.move_is_passed_pawn_push(m))
result += PassedPawnExtension[pvNode];
if(mateThreat)
result += MateThreatExtension[pvNode];
if(pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame
&& (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
- pos.midgame_value_of_piece_on(move_to(m)) == Value(0))
&& !move_promotion(m))
result += PawnEndgameExtension[pvNode];
if(pvNode && pos.move_is_capture(m)
&& pos.type_of_piece_on(move_to(m)) != PAWN && pos.see(m) >= 0)
result += OnePly/2;
return Min(result, OnePly);
}
int extend(SEARCH_BLOCK *sb)
{
int extension;
extension = 0;
/* check extension */
if (in_check())
{
extension += zct->check_extension;
zct->check_extensions_done++;
}
/* one-reply extension */
if (sb->check && sb->last_move - sb->first_move == 1)
{
extension += zct->one_rep_extension;
zct->one_rep_extensions_done++;
}
/* threat move extension */
if (sb->threat)
{
extension += zct->threat_extension;
zct->threat_extensions_done++;
}
/* pawn to 7th extension */
if (board.piece[MOVE_TO(sb->move)] == PAWN && RANK_OF(SQ_FLIP_COLOR(MOVE_TO(sb->move), board.side_ntm)) == RANK_7)
{
extension += zct->passed_pawn_extension;
zct->passed_pawn_extensions_done++;
}
extension = MIN(PLY, extension);
return extension;
}
#ifdef CHECK_EXTENSIONS
if( check ) /* extend the lines */
{
if( result>lastiter-50 && result>-250 )
{
int i, newdch = EXTENSION_BASE-20, inrow=0;
if( Depth <= 100 ) newdch -= 30;
else
if( Depth <= 200 ) newdch -= 20;
for( i=Counter-2; i>0 && G[i].check; i-=2 ) inrow++;
switch( inrow ) /* number of checks in row */
{
case 0: break;
case 1: newdch -= 10; break;
default: newdch -= 30; break;
}
if(n>4) newdch += 6*(n-5);
else newdch -= 20*(5-n);
if( newdch > 60 ) newdch = 60;
else if( newdch < -40 ) newdch = -40;
for( i=0; i!=n; i++ )
m[i].dch = newdch;
}
else /* losing anyway */
{ int i; for( i=0; i!=n; i++ ) m[i].dch = 60; }
}
#endif
#ifdef PAWNSTRIKE_EXTENSIONS
if( piece(G[Counter-1].m.in1) == PAWN )
if(result>lastiter-50 && result>-250) /* winning anyway: dont extend */
{
/* Look at the targets of previous enemy move.
* If it seems to be dangerous, extend all safe
* captures of enemy's last moved pawn. */
int i;
int nex = 0;
int squ = G[Counter-1].m.to;
int t1=0, t2=0;
int newdch = EXTENSION_BASE-49;
if(Ply==1) newdch = (newdch+100) >> 1;
if( Color == WHITE ) /* targets of black p. */
{
if( color(B[squ-11]) == WHITE )
if( B[squ-11] >= KNIGHT )
t1 = squ-11;
if( color(B[squ-9]) == WHITE )
if( B[squ-9] >= KNIGHT )
t2 = squ-9;
}
else
{
if( color(B[squ+11]) == BLACK )
if( B[squ+11] >= KNIGHT )
t1 = squ+11;
if( color(B[squ+9]) == BLACK )
if( B[squ+9] >= KNIGHT )
t2 = squ+9;
}
if( t1 || t2 )
{
/* find all safe captures of the agressor */
for( i=0; i!=n; i++ ) if( m[i].to == squ )
if( piece(m[i].in1) == PAWN
|| ! attacktest( squ, enemy(Color) ) )
{ m[i].dch = newdch; nex ++; }
if( nex == 0 ) /* find all safe escapes */
for( i=0; i!=n; i++ ) if( m[i].dch == 100 )
if( ( t1 && m[i].from == t1 )
|| ( t2 && m[i].from == t2 ) )
if( ! attacktest( m[i].to, enemy(Color) )
|| Values[m[i].in2>>4] >= Values[m[i].in1>>4] )
if( newdch < m[i].dch )
{ m[i].dch = newdch; nex++; }
if( nex > 1 ) for(i=0;i!=n;i++)
if(m[i].dch==newdch) m[i].dch=100;
# undef debug
# ifdef debug
if( nex == 1 )
{
printboard(); printm( G[Counter-1].m, NULL );
puts("");
for( i=0; i!=n; i++ ) if( m[i].dch != 100 )
{
printm( m[i], NULL );
printf("/ %i ", m[i].dch );
}
getchar();
}
# endif
}
}
#endif
....
Zach Wegner wrote:I took another look at Phalanx, and I really have to disagree. I haven't spent that much time looking at it, but the time that I have has been terribly confusing. I personally think both of our engines are much more readable. For example, the extension routines:
Phalanx is badly in need of a beautification and a refactorization.
Well you can count me in as one that prefers Glaurung. My passed pawn eval isn't exactly pretty, but I think it's easy enough to understand what's going on. Whether it evaluates correctly, that's another issue...Tord Romstad wrote:Zach Wegner wrote:I took another look at Phalanx, and I really have to disagree. I haven't spent that much time looking at it, but the time that I have has been terribly confusing. I personally think both of our engines are much more readable. For example, the extension routines:
The coding style in Phalanx is certainly very different from what I would have preferred (for instance, I hate cluttering my code with #ifdef directives), but this is to a large extent a matter of taste. I am fairly sure the majority of C/C++ programmers would vastly prefer Phalanx's programming style over Glaurung's. I still remember the horror and disbelief in Igor Korshunov's eyes when he had a look at my passed pawn evaluation in Lodz last year.
There could be lots of interesting stuff in there, but in the code that I posted and in many other places I have absolutely no idea what's going on. This could be because I'm not really familiar with Phalanx at all and I don't know the context. But for a truly readable program you shouldn't need to know the context, you should be able to just jump in anywhere and know what is going on, assuming you know the basic chess programming theory.I personally don't think the coding style in Phalanx reduces readability, though. It is a fairly simple program, but is packed with interesting ideas and instructive examples of how to implement various techniques. It taught me almost everything I know about chess programming.
It would be nice, if only there was enough time in the world... Phalanx does well enough against ZCT as it is though.I wish someone would start working on it, preferably Dusan Dobes himself (are you there, Dusan?). The search is too old-fashioned and extension-heavy, and I suspect that there are a number of evaluation bugs. With a moderate amount of work, I think Phalanx could be a competitive program even today.
Tord
Return to Programming and Technical Discussions
Users browsing this forum: No registered users and 28 guests