I know that in general chessengines give a 10 cp bonus in the evaluation function for being the side to move (middlegame). I also know that I cannot tune this value using the Texel's tuning method because it will tune it to about 40 cp but this results in worse play.
But how about a bonus when being the side to move when calculating the king-safety, or passed-pawns, or hanging pieces?
King-safety: if the king is under attack AND its the other side to move, the king is even under more pressure.
Passed-pawns: if a passed pawn is at the 7th rank, it is not attacked AND it is whites side to move, it can safely promote. Whereas if it is blacks side to move, maybe it defend the promotion square.
Hanging pieces: if an enemy piece is hanging AND it is my turn to move, I can capture the piece. Whereas if it is the other side to move, it can maybe move the piece or defend it.
Regarding king-safety I again discovered that the tuner will give a big stm bonus which resulted in worse play.
Is this true for all evaluation terms? Should you never look at the stm, except the minor bonus of 10 cp? Or is for these eval terms the stm relevant but the tuner is just way to optimistic?
I also find it hard to understand how the search reacts to big differences which are the result of being the side to move: it searches for positions where it is (by accident) your turn?
(One possible reason I can think of why the tuner gives these huge bonusses is that the test-positions results are games that are played by Stockfish. Maybe Stockfish is just way better when being the side to move than my engine)
side-to-move bonus for several eval terms
Moderator: Ras
-
sandermvdb
- Posts: 160
- Joined: Sat Jan 28, 2017 1:29 pm
- Location: The Netherlands
-
AlvaroBegue
- Posts: 932
- Joined: Tue Mar 09, 2010 3:46 pm
- Location: New York
- Full name: Álvaro Begué (RuyDos)
Re: side-to-move bonus for several eval terms
I only have this for one very specific situation: Unstoppable passed pawn bonus when the opponent only has king and pawns. This is a situation where the score oscillates enormously if you don't take the side to move into account.
Code: Select all
int const escaped_pawn_table[16] = {0, 0, 1, 2, 4, 10, 20, 60, 100, 140, 180, 220, 260, 300, 0, 0};
// ...
// Enemy king outside the square
if (!(square_rule_table_wp[pawn][b.active] & b.bb[BlackKing])) {
if (!(b.bb[BlackKnight] | b.bb[BlackBishop] | b.bb[BlackRook] | b.bb[BlackQueen]))
this_passer_score += escaped_pawn_table[(pawn/8)*2 + (b.active == White)];
-
hgm
- Posts: 28451
- Joined: Fri Mar 10, 2006 10:06 am
- Location: Amsterdam
- Full name: H G Muller
Re: side-to-move bonus for several eval terms
In CrazyWa I use a huge King-Safety bonus (upto 500cP, I think) only for the side to move. It is calculated from the number and power of the pieces in the stm's hand, and the number of empty attacked squares next to the enemy King (where these could be dropped).
The side that is not on move does not get anything. (So I guess it is really an (enemy) King-Unsafety bous.)
This worked amazingly well.
The side that is not on move does not get anything. (So I guess it is really an (enemy) King-Unsafety bous.)
This worked amazingly well.
-
Rebel
- Posts: 7476
- Joined: Thu Aug 18, 2011 12:04 pm
- Full name: Ed Schröder
Re: side-to-move bonus for several eval terms
For the big-boys in eval (passed pawns, king safety, mobility) apply a low STM bonus percentage. I currently use 5% for king safety. Meaning if the evaluation score of the STM king is (say) 100 the score becomes 105.sandermvdb wrote:I know that in general chessengines give a 10 cp bonus in the evaluation function for being the side to move (middlegame). I also know that I cannot tune this value using the Texel's tuning method because it will tune it to about 40 cp but this results in worse play.
But how about a bonus when being the side to move when calculating the king-safety, or passed-pawns, or hanging pieces?
King-safety: if the king is under attack AND its the other side to move, the king is even under more pressure.
Passed-pawns: if a passed pawn is at the 7th rank, it is not attacked AND it is whites side to move, it can safely promote. Whereas if it is blacks side to move, maybe it defend the promotion square.
Hanging pieces: if an enemy piece is hanging AND it is my turn to move, I can capture the piece. Whereas if it is the other side to move, it can maybe move the piece or defend it.
Regarding king-safety I again discovered that the tuner will give a big stm bonus which resulted in worse play.
Is this true for all evaluation terms? Should you never look at the stm, except the minor bonus of 10 cp? Or is for these eval terms the stm relevant but the tuner is just way to optimistic?
I also find it hard to understand how the search reacts to big differences which are the result of being the side to move: it searches for positions where it is (by accident) your turn?
(One possible reason I can think of why the tuner gives these huge bonusses is that the test-positions results are games that are played by Stockfish. Maybe Stockfish is just way better when being the side to move than my engine)