Assorted trivial cleanups

- Cleanups by Alain
- Group king attacks and king defenses
- Signature of futility_move_count()
- Use is_discovery_check_on_king()
- Simplify backward definition
- Use static asserts in move generator
- Factor a statement in move generator

No functional change
This commit is contained in:
Stéphane Nicolet
2019-10-19 02:20:38 +02:00
parent 7e89a71624
commit 90c0385724
9 changed files with 30 additions and 35 deletions
+8 -9
View File
@@ -448,16 +448,16 @@ namespace {
int kingFlankAttacks = popcount(b1) + popcount(b2);
kingDanger += kingAttackersCount[Them] * kingAttackersWeight[Them]
+ 69 * kingAttacksCount[Them]
+ 185 * popcount(kingRing[Us] & weak)
- 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
- 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
+ 148 * popcount(unsafeChecks)
+ 98 * popcount(pos.blockers_for_king(Us))
- 873 * !pos.count<QUEEN>(Them)
- 6 * mg_value(score) / 8
+ mg_value(mobility[Them] - mobility[Us])
+ 69 * kingAttacksCount[Them]
+ 3 * kingFlankAttacks * kingFlankAttacks / 8
+ mg_value(mobility[Them] - mobility[Us])
- 873 * !pos.count<QUEEN>(Them)
- 100 * bool(attackedBy[Us][KNIGHT] & attackedBy[Us][KING])
- 35 * bool(attackedBy[Us][BISHOP] & attackedBy[Us][KING])
- 6 * mg_value(score) / 8
- 7;
// Transform the kingDanger units into a Score, and subtract it from the evaluation
@@ -596,7 +596,6 @@ namespace {
assert(!(pos.pieces(Them, PAWN) & forward_file_bb(Us, s + Up)));
int r = relative_rank(Us, s);
File f = file_of(s);
Score bonus = PassedRank[r];
@@ -646,7 +645,7 @@ namespace {
|| (pos.pieces(PAWN) & (s + Up)))
bonus = bonus / 2;
score += bonus - PassedFile * map_to_queenside(f);
score += bonus - PassedFile * map_to_queenside(file_of(s));
}
if (T)
@@ -755,7 +754,7 @@ namespace {
else
sf = std::min(sf, 36 + (pos.opposite_bishops() ? 2 : 7) * pos.count<PAWN>(strongSide));
sf = std::max(0, sf - (pos.rule50_count() - 12) / 4 );
sf = std::max(0, sf - (pos.rule50_count() - 12) / 4);
}
return ScaleFactor(sf);