From: Fabian Fichter Date: Wed, 31 Oct 2018 17:38:21 +0000 (+0100) Subject: Add bonus for potential piece promotions X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=d480ad4819b8030804a39095ce137eb18f81d4e5;p=fairystockfish.git Add bonus for potential piece promotions shogi ELO: 21.57 +-20.7 (95%) LOS: 98.0% Total: 1000 W: 490 L: 428 D: 82 euroshogi ELO: 36.62 +-21.1 (95%) LOS: 100.0% Total: 1000 W: 528 L: 423 D: 49 minishogi ELO: 39.08 +-16.9 (95%) LOS: 100.0% Total: 1000 W: 363 L: 251 D: 386 --- diff --git a/src/evaluate.cpp b/src/evaluate.cpp index e985b8a..0235745 100644 --- a/src/evaluate.cpp +++ b/src/evaluate.cpp @@ -341,6 +341,14 @@ namespace { else mobility[Us] += make_score(300, 300) * (mob - 2) / (10 + mob); + // Piece promotion bonus + if (pos.promoted_piece_type(Pt) != NO_PIECE_TYPE) + { + if (promotion_zone_bb(Us, pos.promotion_rank(), pos.max_rank()) & (b | s)) + score += make_score(PieceValue[MG][pos.promoted_piece_type(Pt)] - PieceValue[MG][Pt], + PieceValue[EG][pos.promoted_piece_type(Pt)] - PieceValue[EG][Pt]) / 5; + } + // Penalty if the piece is far from the king if (pos.count(Us)) score -= KingProtector[Pt - 2] * distance(s, pos.square(Us));