|
31 | 31 |
|
32 | 32 | namespace { |
33 | 33 |
|
| 34 | + const Bitboard LongDiagonals = 0x8142241818244281ULL; // A1..H8 | H1..A8 |
| 35 | + const Bitboard Center = (FileDBB | FileEBB) & (Rank4BB | Rank5BB); |
| 36 | + const Bitboard QueenSide = FileABB | FileBBB | FileCBB | FileDBB; |
| 37 | + const Bitboard CenterFiles = FileCBB | FileDBB | FileEBB | FileFBB; |
| 38 | + const Bitboard KingSide = FileEBB | FileFBB | FileGBB | FileHBB; |
| 39 | + |
| 40 | + const Bitboard KingFlank[FILE_NB] = { |
| 41 | + QueenSide, QueenSide, QueenSide, CenterFiles, CenterFiles, KingSide, KingSide, KingSide |
| 42 | + }; |
| 43 | + |
34 | 44 | namespace Trace { |
35 | 45 |
|
36 | 46 | enum Tracing {NO_TRACE, TRACE}; |
@@ -204,6 +214,7 @@ namespace { |
204 | 214 | // Assorted bonuses and penalties used by evaluation |
205 | 215 | const Score MinorBehindPawn = S( 16, 0); |
206 | 216 | const Score BishopPawns = S( 8, 12); |
| 217 | + const Score LongRangedBishop = S( 22, 0); |
207 | 218 | const Score RookOnPawn = S( 8, 24); |
208 | 219 | const Score TrappedRook = S( 92, 0); |
209 | 220 | const Score WeakQueen = S( 50, 10); |
@@ -338,10 +349,18 @@ namespace { |
338 | 349 | && (pos.pieces(PAWN) & (s + pawn_push(Us)))) |
339 | 350 | score += MinorBehindPawn; |
340 | 351 |
|
341 | | - // Penalty for pawns on the same color square as the bishop |
342 | 352 | if (Pt == BISHOP) |
| 353 | + { |
| 354 | + // Penalty for pawns on the same color square as the bishop |
343 | 355 | score -= BishopPawns * pe->pawns_on_same_color_squares(Us, s); |
344 | 356 |
|
| 357 | + // Bonus for bishop on a long diagonal without pawns in the center |
| 358 | + if ( (LongDiagonals & s) |
| 359 | + && !(attackedBy[Them][PAWN] & s) |
| 360 | + && !(Center & PseudoAttacks[BISHOP][s] & pos.pieces(PAWN))) |
| 361 | + score += LongRangedBishop; |
| 362 | + } |
| 363 | + |
345 | 364 | // An important Chess960 pattern: A cornered bishop blocked by a friendly |
346 | 365 | // pawn diagonally in front of it is a very serious problem, especially |
347 | 366 | // when that pawn is also blocked. |
@@ -396,14 +415,6 @@ namespace { |
396 | 415 |
|
397 | 416 | // evaluate_king() assigns bonuses and penalties to a king of a given color |
398 | 417 |
|
399 | | - const Bitboard QueenSide = FileABB | FileBBB | FileCBB | FileDBB; |
400 | | - const Bitboard CenterFiles = FileCBB | FileDBB | FileEBB | FileFBB; |
401 | | - const Bitboard KingSide = FileEBB | FileFBB | FileGBB | FileHBB; |
402 | | - |
403 | | - const Bitboard KingFlank[FILE_NB] = { |
404 | | - QueenSide, QueenSide, QueenSide, CenterFiles, CenterFiles, KingSide, KingSide, KingSide |
405 | | - }; |
406 | | - |
407 | 418 | template<Tracing T> template<Color Us> |
408 | 419 | Score Evaluation<T>::evaluate_king() { |
409 | 420 |
|
|
0 commit comments