From 68fc8bb38eeea2ddfe9ac5115060eb6723ee4533 Mon Sep 17 00:00:00 2001 From: Andrey Sofronov Date: Thu, 4 Nov 2010 03:57:48 +0200 Subject: [PATCH] evaluate: bonus for unstoppable pawns --- evaluate.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/evaluate.c b/evaluate.c index 7cd9dac..f21dc8c 100644 --- a/evaluate.c +++ b/evaluate.c @@ -327,6 +327,8 @@ static int doubled_penalty_eg[9] = {0, 0, -45, -39, -33, -28, -23, -16, -12}; /* penalty for backward pawns */ static int backward_penalty_op = -8; static int backward_penalty_eg = -10; +/* bonus for unstoppable */ +static int unstoppable_bonus = 777; static void evaluate_pawns(int side) @@ -471,6 +473,24 @@ evaluate_pawns(int side) square = bit_scan_clear(&bb); score_eg += 5 - distance[square][brd.kings[side]] * 5 + distance[square][brd.kings[xside]] * 5; + + /* check for unstoppable passers */ + if (!material_pieces[xside] && + !(forward_ray[side][square] & complete)) { + int promotion_square; + if (side == WHITE) + promotion_square = _FILE(square) + 56; + else + promotion_square = _FILE(square); + int distance_diff = + distance[promotion_square][brd.kings[xside]] - + distance[promotion_square][square]; + if (distance_diff > 1) { + score_eg += unstoppable_bonus; + } else if (side && distance_diff == 1 && side == brd.wtm) { + score_eg += unstoppable_bonus; + } + } } pawn_score[OPENING][side] += score_op; -- 2.11.4.GIT