@@ -90,9 +90,9 @@ namespace {
90
90
}
91
91
92
92
// Evaluation weights, indexed by evaluation term
93
- enum { Mobility, PawnStructure, PassedPawns, Space, KingDangerUs, KingDangerThem };
93
+ enum { Mobility, PawnStructure, PassedPawns, Space, KingSafety };
94
94
const struct Weight { int mg, eg; } Weights[] = {
95
- {289 , 344 }, {233 , 201 }, {221 , 273 }, {46 , 0 }, {271 , 0 }, { 307 , 0 }
95
+ {289 , 344 }, {233 , 201 }, {221 , 273 }, {46 , 0 }, {318 , 0 }
96
96
};
97
97
98
98
typedef Value V;
@@ -150,12 +150,11 @@ namespace {
150
150
S (0 , 0 ), S (0 , 0 ), S (56 , 70 ), S (56 , 70 ), S (76 , 99 ), S (86 , 118 )
151
151
};
152
152
153
- // Hanging[side to move] contains a bonus for each enemy hanging piece
154
- const Score Hanging[ 2 ] = { S (23 , 20 ) , S ( 35 , 45 ) } ;
153
+ // Hanging contains a bonus for each enemy hanging piece
154
+ const Score Hanging = S(23 , 20 );
155
155
156
156
#undef S
157
157
158
- const Score Tempo = make_score(24 , 11 );
159
158
const Score RookOnPawn = make_score(10 , 28 );
160
159
const Score RookOpenFile = make_score(43 , 21 );
161
160
const Score RookSemiopenFile = make_score(19 , 10 );
@@ -194,9 +193,9 @@ namespace {
194
193
const int BishopCheck = 2 ;
195
194
const int KnightCheck = 3 ;
196
195
197
- // KingDanger[Color][ attackUnits] contains the actual king danger weighted
198
- // scores, indexed by color and by a calculated integer number.
199
- Score KingDanger[COLOR_NB][ 128 ];
196
+ // KingDanger[attackUnits] contains the actual king danger weighted
197
+ // scores, indexed by a calculated integer number.
198
+ Score KingDanger[128 ];
200
199
201
200
202
201
// apply_weight() weighs score 'v' by weight 'w' trying to prevent overflow
@@ -426,9 +425,7 @@ namespace {
426
425
| ei.attackedBy [Them][BISHOP] | ei.attackedBy [Them][ROOK]);
427
426
428
427
if (b)
429
- attackUnits += QueenContactCheck
430
- * popcount<Max15>(b)
431
- * (Them == pos.side_to_move () ? 2 : 1 );
428
+ attackUnits += QueenContactCheck * popcount<Max15>(b);
432
429
}
433
430
434
431
// Analyse the enemy's safe rook contact checks. Firstly, find the
@@ -446,9 +443,7 @@ namespace {
446
443
| ei.attackedBy [Them][BISHOP] | ei.attackedBy [Them][QUEEN]);
447
444
448
445
if (b)
449
- attackUnits += RookContactCheck
450
- * popcount<Max15>(b)
451
- * (Them == pos.side_to_move () ? 2 : 1 );
446
+ attackUnits += RookContactCheck * popcount<Max15>(b);
452
447
}
453
448
454
449
// Analyse the enemy's safe distance checks for sliders and knights
@@ -482,7 +477,7 @@ namespace {
482
477
483
478
// Finally, extract the king danger score from the KingDanger[]
484
479
// array and subtract the score from evaluation.
485
- score -= KingDanger[Us == Search::RootColor][ attackUnits];
480
+ score -= KingDanger[attackUnits];
486
481
}
487
482
488
483
if (Trace)
@@ -521,8 +516,7 @@ namespace {
521
516
522
517
b = weakEnemies & ~ei.attackedBy [Them][ALL_PIECES];
523
518
if (b)
524
- score += more_than_one (b) ? Hanging[Us != pos.side_to_move ()] * popcount<Max15>(b)
525
- : Hanging[Us == pos.side_to_move ()];
519
+ score += more_than_one (b) ? Hanging * popcount<Max15>(b) : Hanging;
526
520
}
527
521
528
522
if (Trace)
@@ -677,9 +671,9 @@ namespace {
677
671
Thread* thisThread = pos.this_thread ();
678
672
679
673
// Initialize score by reading the incrementally updated scores included
680
- // in the position object (material + piece square tables) and adding a
681
- // Tempo bonus. Score is computed from the point of view of white.
682
- score = pos.psq_score () + (pos. side_to_move () == WHITE ? Tempo : -Tempo) ;
674
+ // in the position object (material + piece square tables).
675
+ // Score is computed from the point of view of white.
676
+ score = pos.psq_score ();
683
677
684
678
// Probe the material hash table
685
679
ei.mi = Material::probe (pos, thisThread->materialTable , thisThread->endgames );
@@ -831,7 +825,7 @@ namespace {
831
825
<< " | MG EG | MG EG | MG EG \n "
832
826
<< " ---------------------+-------------+-------------+-------------\n " ;
833
827
834
- format_row (ss, " Material, PST, Tempo " , PST);
828
+ format_row (ss, " Material, PST" , PST);
835
829
format_row (ss, " Material imbalance" , IMBALANCE);
836
830
format_row (ss, " Pawns" , PAWN);
837
831
format_row (ss, " Knights" , KNIGHT);
@@ -885,9 +879,7 @@ namespace Eval {
885
879
for (int t = 0 , i = 1 ; i < 100 ; ++i)
886
880
{
887
881
t = int (std::min (Peak, std::min (0.4 * i * i, t + MaxSlope)));
888
-
889
- KingDanger[1 ][i] = apply_weight (make_score (t, 0 ), Weights[KingDangerUs]);
890
- KingDanger[0 ][i] = apply_weight (make_score (t, 0 ), Weights[KingDangerThem]);
882
+ KingDanger[i] = apply_weight (make_score (t, 0 ), Weights[KingSafety]);
891
883
}
892
884
}
893
885
0 commit comments