Hanging Pieces Evaluation
Posted: 26 Jul 2006, 10:30
Hi everyone,
I am implementing an evaluation for hanging pieces but it is disabled for my released versions since I think that it makes my program weaker. It performs well on some positions but the decline in NPS is so big that any increase in knowledge is countered by the low NPS. I think that this can be improved. I might have set some inferior weights on it. Here is the source code. Am I doing this right? Or is there something better? Or hanging pieces is just a waste of time? I observed it searches less nodes at a fixed ply compared to the version not implementing it.
The "swap" function is a Static Exchange Evaluator. It returns the material value of gain or loss on its evaluation. For example it would return a -325 if the knight is hanging, and 325 if it is adequately defended. The "open" and "end" array is being scaled by material at the end of eval. NEWMOVE is a macro for creating a new move with this parameters: NEWMOVE(from,to,piece,captured,promoted).
Edsel
I am implementing an evaluation for hanging pieces but it is disabled for my released versions since I think that it makes my program weaker. It performs well on some positions but the decline in NPS is so big that any increase in knowledge is countered by the low NPS. I think that this can be improved. I might have set some inferior weights on it. Here is the source code. Am I doing this right? Or is there something better? Or hanging pieces is just a waste of time? I observed it searches less nodes at a fixed ply compared to the version not implementing it.
- Code: Select all
u64 h, d; int f, c, x, y;
/* penalty for hanging pieces and bonus if it is adequately defended */
h = (pieces[WHITE][ALL]&~pieces[WHITE][KING]&~pieces[WHITE][PAWN])
|(pieces[BLACK][ALL]&~pieces[BLACK][KING]&~pieces[BLACK][PAWN]);
while(h){
f = fastlsb(h);
d = bitmask000[f];
h ^= d;
c = getcolor(d);
x = NEWMOVE(f,f,getpiece(d,c),0,0);
y = swap(x,c);
opn[c] += y/10;
end[c] += y/10;
}
The "swap" function is a Static Exchange Evaluator. It returns the material value of gain or loss on its evaluation. For example it would return a -325 if the knight is hanging, and 325 if it is adequately defended. The "open" and "end" array is being scaled by material at the end of eval. NEWMOVE is a macro for creating a new move with this parameters: NEWMOVE(from,to,piece,captured,promoted).
Edsel