1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-30 08:43:09 +00:00

Fix InitKingDanger initialization

Last line was missing.

Also reformat tables constants to be more readable.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-09-22 12:10:09 +02:00
parent 2a3ebc884e
commit 1d8994402b

View file

@ -64,90 +64,103 @@ namespace {
const int WeightPassedPawnsEndgameInternal = 0x100; const int WeightPassedPawnsEndgameInternal = 0x100;
const int WeightKingSafetyInternal = 0x100; const int WeightKingSafetyInternal = 0x100;
// Visually better to define tables constants
typedef Value V;
// Knight mobility bonus in middle game and endgame, indexed by the number // Knight mobility bonus in middle game and endgame, indexed by the number
// of attacked squares not occupied by friendly piecess. // of attacked squares not occupied by friendly piecess.
const Value MidgameKnightMobilityBonus[] = { const Value MidgameKnightMobilityBonus[] = {
Value(-30), Value(-20), Value(-10), Value(0), Value(10), // 0 1 2 3 4 5 6 7 8
Value(20), Value(25), Value(30), Value(30) V(-30), V(-20),V(-10), V(0), V(10), V(20), V(25), V(30), V(30)
}; };
const Value EndgameKnightMobilityBonus[] = { const Value EndgameKnightMobilityBonus[] = {
Value(-30), Value(-20), Value(-10), Value(0), Value(10), // 0 1 2 3 4 5 6 7 8
Value(20), Value(25), Value(30), Value(30) V(-30), V(-20),V(-10), V(0), V(10), V(20), V(25), V(30), V(30)
}; };
// Bishop mobility bonus in middle game and endgame, indexed by the number // Bishop mobility bonus in middle game and endgame, indexed by the number
// of attacked squares not occupied by friendly pieces. X-ray attacks through // of attacked squares not occupied by friendly pieces. X-ray attacks through
// queens are also included. // queens are also included.
const Value MidgameBishopMobilityBonus[] = { const Value MidgameBishopMobilityBonus[] = {
Value(-30), Value(-15), Value(0), Value(15), Value(30), Value(45), // 0 1 2 3 4 5 6 7
Value(58), Value(66), Value(72), Value(76), Value(78), Value(80), V(-30), V(-15), V(0), V(15), V(30), V(45), V(58), V(66),
Value(81), Value(82), Value(83), Value(83) // 8 9 10 11 12 13 14 15
V( 72), V( 76), V(78), V(80), V(81), V(82), V(83), V(83)
}; };
const Value EndgameBishopMobilityBonus[] = { const Value EndgameBishopMobilityBonus[] = {
Value(-30), Value(-15), Value(0), Value(15), Value(30), Value(45), // 0 1 2 3 4 5 6 7
Value(58), Value(66), Value(72), Value(76), Value(78), Value(80), V(-30), V(-15), V(0), V(15), V(30), V(45), V(58), V(66),
Value(81), Value(82), Value(83), Value(83) // 8 9 10 11 12 13 14 15
V( 72), V( 76), V(78), V(80), V(81), V(82), V(83), V(83)
}; };
// Rook mobility bonus in middle game and endgame, indexed by the number // Rook mobility bonus in middle game and endgame, indexed by the number
// of attacked squares not occupied by friendly pieces. X-ray attacks through // of attacked squares not occupied by friendly pieces. X-ray attacks through
// queens and rooks are also included. // queens and rooks are also included.
const Value MidgameRookMobilityBonus[] = { const Value MidgameRookMobilityBonus[] = {
Value(-18), Value(-12), Value(-6), Value(0), Value(6), Value(12), // 0 1 2 3 4 5 6 7
Value(16), Value(21), Value(24), Value(27), Value(28), Value(29), V(-18), V(-12), V(-6), V(0), V(6), V(12), V(16), V(21),
Value(30), Value(31), Value(32), Value(33) // 8 9 10 11 12 13 14 15
V( 24), V( 27), V(28), V(29), V(30), V(31), V(32), V(33)
}; };
const Value EndgameRookMobilityBonus[] = { const Value EndgameRookMobilityBonus[] = {
Value(-30), Value(-18), Value(-6), Value(6), Value(18), Value(30), // 0 1 2 3 4 5 6 7
Value(42), Value(54), Value(66), Value(74), Value(78), Value(80), V(-30), V(-18), V(-6), V(6), V(18), V(30), V(42), V(54),
Value(81), Value(82), Value(83), Value(83) // 8 9 10 11 12 13 14 15
V( 66), V( 74), V(78), V(80), V(81), V(82), V(83), V(83)
}; };
// Queen mobility bonus in middle game and endgame, indexed by the number // Queen mobility bonus in middle game and endgame, indexed by the number
// of attacked squares not occupied by friendly pieces. // of attacked squares not occupied by friendly pieces.
const Value MidgameQueenMobilityBonus[] = { const Value MidgameQueenMobilityBonus[] = {
Value(-10), Value(-8), Value(-6), Value(-4), Value(-2), Value(0), Value(2), // 0 1 2 3 4 5 6 7
Value(4), Value(6), Value(8), Value(10), Value(12), Value(13), Value(14), V(-10), V(-8), V(-6), V(-4), V(-2), V( 0), V( 2), V( 4),
Value(15), Value(16), Value(16), Value(16), Value(16), Value(16), // 8 9 10 11 12 13 14 15
Value(16), Value(16), Value(16), Value(16), Value(16), Value(16), V( 6), V( 8), V(10), V(12), V(13), V(14), V(15), V(16),
Value(16), Value(16), Value(16), Value(16), Value(16), Value(16) // 16 17 18 19 20 21 22 23
V( 16), V(16), V(16), V(16), V(16), V(16), V(16), V(16),
// 24 25 26 27 28 29 30 31
V( 16), V(16), V(16), V(16), V(16), V(16), V(16), V(16)
}; };
const Value EndgameQueenMobilityBonus[] = { const Value EndgameQueenMobilityBonus[] = {
Value(-20), Value(-15), Value(-10), Value(-5), Value(0), Value(5), // 0 1 2 3 4 5 6 7
Value(10), Value(15), Value(19), Value(23), Value(27), Value(29), V(-20),V(-15),V(-10), V(-5), V( 0), V( 5), V(10), V(15),
Value(30), Value(30), Value(30), Value(30), Value(30), Value(30), // 8 9 10 11 12 13 14 15
Value(30), Value(30), Value(30), Value(30), Value(30), Value(30), V( 19), V(23), V(27), V(29), V(30), V(30), V(30), V(30),
Value(30), Value(30), Value(30), Value(30), Value(30), Value(30), // 16 17 18 19 20 21 22 23
Value(30), Value(30) V( 30), V(30), V(30), V(30), V(30), V(30), V(30), V(30),
// 24 25 26 27 28 29 30 31
V( 30), V(30), V(30), V(30), V(30), V(30), V(30), V(30)
}; };
// Outpost bonuses for knights and bishops, indexed by square (from white's // Outpost bonuses for knights and bishops, indexed by square (from white's
// point of view). // point of view).
const Value KnightOutpostBonus[64] = { const Value KnightOutpostBonus[64] = {
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), // A B C D E F G H
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 1
Value(0),Value(0),Value(5),Value(10),Value(10),Value(5),Value(0),Value(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 2
Value(0),Value(5),Value(20),Value(30),Value(30),Value(20),Value(5),Value(0), V(0), V(0), V(5),V(10),V(10), V(5), V(0), V(0), // 3
Value(0),Value(10),Value(30),Value(40),Value(40),Value(30),Value(10),Value(0), V(0), V(5),V(20),V(30),V(30),V(20), V(5), V(0), // 4
Value(0),Value(5),Value(20),Value(20),Value(20),Value(20),Value(5),Value(0), V(0),V(10),V(30),V(40),V(40),V(30),V(10), V(0), // 5
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), V(0), V(5),V(20),V(20),V(20),V(20), V(5), V(0), // 6
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0) V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 7
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0) // 8
}; };
const Value BishopOutpostBonus[64] = { const Value BishopOutpostBonus[64] = {
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), // A B C D E F G H
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 1
Value(0),Value(0),Value(5),Value(5),Value(5),Value(5),Value(0),Value(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 2
Value(0),Value(5),Value(10),Value(10),Value(10),Value(10),Value(5),Value(0), V(0), V(0), V(5), V(5), V(5), V(5), V(0), V(0), // 3
Value(0),Value(10),Value(20),Value(20),Value(20),Value(20),Value(10),Value(0), V(0), V(5),V(10),V(10),V(10),V(10), V(5), V(0), // 4
Value(0),Value(5),Value(8),Value(8),Value(8),Value(8),Value(5),Value(0), V(0),V(10),V(20),V(20),V(20),V(20),V(10), V(0), // 5
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0), V(0), V(5), V(8), V(8), V(8), V(8), V(5), V(0), // 6
Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0),Value(0) V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0), // 7
V(0), V(0), V(0), V(0), V(0), V(0), V(0), V(0) // 8
}; };
// Bonus for unstoppable passed pawns: // Bonus for unstoppable passed pawns:
@ -188,7 +201,6 @@ namespace {
((1ULL << SQ_A8) | (1ULL << SQ_H8)) ((1ULL << SQ_A8) | (1ULL << SQ_H8))
}; };
/// King safety constants and variables. The king safety scores are taken /// King safety constants and variables. The king safety scores are taken
/// from the array SafetyTable[]. Various little "meta-bonuses" measuring /// from the array SafetyTable[]. Various little "meta-bonuses" measuring
/// the strength of the attack are added up into an integer, which is used /// the strength of the attack are added up into an integer, which is used
@ -225,13 +237,13 @@ namespace {
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15
}; };
// SafetyTable[] contains the actual king safety scores. It is initialized // SafetyTable[] contains the actual king safety scores. It is initialized
// in init_safety(). // in init_safety().
Value SafetyTable[100]; Value SafetyTable[100];
// Pawn and material hash tables, indexed by the current thread id: // Pawn and material hash tables, indexed by the current thread id:
PawnInfoTable *PawnTable[8] = {0, 0, 0, 0, 0, 0, 0, 0}; PawnInfoTable *PawnTable[8] = {0, 0, 0, 0, 0, 0, 0, 0};
MaterialInfoTable *MaterialTable[8] = {0, 0, 0, 0, 0, 0, 0, 0}; MaterialInfoTable *MaterialTable[8] = {0, 0, 0, 0, 0, 0, 0, 0};