mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
Retire PieceValueXXX[] getters
They don't add any value given that the corresponding table has global visibility anyhow. No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
b5bbc1f713
commit
f2e78d9f84
5 changed files with 12 additions and 20 deletions
|
@ -138,7 +138,7 @@ MovePicker::MovePicker(const Position& p, Move ttm, const History& h, PieceType
|
|||
assert (!pos.in_check());
|
||||
|
||||
// In ProbCut we consider only captures better than parent's move
|
||||
captureThreshold = piece_value_midgame(Piece(parentCapture));
|
||||
captureThreshold = PieceValueMidgame[Piece(parentCapture)];
|
||||
phasePtr = ProbCutTable;
|
||||
|
||||
if ( ttm != MOVE_NONE
|
||||
|
@ -251,11 +251,11 @@ void MovePicker::score_captures() {
|
|||
for (MoveStack* cur = moves; cur != lastMove; cur++)
|
||||
{
|
||||
m = cur->move;
|
||||
cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
|
||||
cur->score = PieceValueMidgame[pos.piece_on(move_to(m))]
|
||||
- type_of(pos.piece_on(move_from(m)));
|
||||
|
||||
if (is_promotion(m))
|
||||
cur->score += piece_value_midgame(Piece(promotion_piece_type(m)));
|
||||
cur->score += PieceValueMidgame[Piece(promotion_piece_type(m))];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +290,7 @@ void MovePicker::score_evasions() {
|
|||
if ((seeScore = pos.see_sign(m)) < 0)
|
||||
cur->score = seeScore - History::MaxValue; // Be sure we are at the bottom
|
||||
else if (pos.is_capture(m))
|
||||
cur->score = piece_value_midgame(pos.piece_on(move_to(m)))
|
||||
cur->score = PieceValueMidgame[pos.piece_on(move_to(m))]
|
||||
- type_of(pos.piece_on(move_from(m))) + History::MaxValue;
|
||||
else
|
||||
cur->score = H.value(pos.piece_on(move_from(m)), move_to(m));
|
||||
|
|
|
@ -1351,7 +1351,7 @@ int Position::see_sign(Move m) const {
|
|||
// Early return if SEE cannot be negative because captured piece value
|
||||
// is not less then capturing one. Note that king moves always return
|
||||
// here because king midgame value is set to 0.
|
||||
if (piece_value_midgame(piece_on(to)) >= piece_value_midgame(piece_on(from)))
|
||||
if (PieceValueMidgame[piece_on(to)] >= PieceValueMidgame[piece_on(from)])
|
||||
return 1;
|
||||
|
||||
return see(m);
|
||||
|
@ -1558,7 +1558,7 @@ Key Position::compute_material_key() const {
|
|||
|
||||
for (Color c = WHITE; c <= BLACK; c++)
|
||||
for (PieceType pt = PAWN; pt <= QUEEN; pt++)
|
||||
for (int i = 0, cnt = piece_count(c, pt); i < cnt; i++)
|
||||
for (int i = 0; i < piece_count(c, pt); i++)
|
||||
result ^= zobrist[c][pt][i];
|
||||
|
||||
return result;
|
||||
|
@ -1682,7 +1682,7 @@ void Position::init() {
|
|||
|
||||
for (Piece p = WP; p <= WK; p++)
|
||||
{
|
||||
Score ps = make_score(piece_value_midgame(p), piece_value_endgame(p));
|
||||
Score ps = make_score(PieceValueMidgame[p], PieceValueEndgame[p]);
|
||||
|
||||
for (Square s = SQ_A1; s <= SQ_H8; s++)
|
||||
{
|
||||
|
|
|
@ -263,7 +263,7 @@ private:
|
|||
|
||||
// Static variables
|
||||
static Score pieceSquareTable[16][64]; // [piece][square]
|
||||
static Key zobrist[2][8][64]; // [color][pieceType][square]
|
||||
static Key zobrist[2][8][64]; // [color][pieceType][square]/[piece count]
|
||||
static Key zobEp[64]; // [square]
|
||||
static Key zobCastle[16]; // [castleRight]
|
||||
static Key zobSideToMove;
|
||||
|
|
|
@ -284,7 +284,7 @@ namespace {
|
|||
if ( captureOrPromotion
|
||||
&& type_of(pos.piece_on(move_to(m))) != PAWN
|
||||
&& ( pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
|
||||
- piece_value_midgame(pos.piece_on(move_to(m))) == VALUE_ZERO)
|
||||
- PieceValueMidgame[pos.piece_on(move_to(m))] == VALUE_ZERO)
|
||||
&& !is_special(m))
|
||||
{
|
||||
result += PawnEndgameExtension[PvNode];
|
||||
|
@ -1399,7 +1399,7 @@ split_point_start: // At split points actual search starts from here
|
|||
&& !pos.is_passed_pawn_push(move))
|
||||
{
|
||||
futilityValue = futilityBase
|
||||
+ piece_value_endgame(pos.piece_on(move_to(move)))
|
||||
+ PieceValueEndgame[pos.piece_on(move_to(move))]
|
||||
+ (is_enpassant(move) ? PawnValueEndgame : VALUE_ZERO);
|
||||
|
||||
if (futilityValue < beta)
|
||||
|
@ -1532,7 +1532,7 @@ split_point_start: // At split points actual search starts from here
|
|||
while (b)
|
||||
{
|
||||
victimSq = pop_1st_bit(&b);
|
||||
futilityValue = futilityBase + piece_value_endgame(pos.piece_on(victimSq));
|
||||
futilityValue = futilityBase + PieceValueEndgame[pos.piece_on(victimSq)];
|
||||
|
||||
// Note that here we generate illegal "double move"!
|
||||
if ( futilityValue >= beta
|
||||
|
@ -1656,7 +1656,7 @@ split_point_start: // At split points actual search starts from here
|
|||
// Case 2: If the threatened piece has value less than or equal to the
|
||||
// value of the threatening piece, don't prune moves which defend it.
|
||||
if ( pos.is_capture(threat)
|
||||
&& ( piece_value_midgame(pos.piece_on(tfrom)) >= piece_value_midgame(pos.piece_on(tto))
|
||||
&& ( PieceValueMidgame[pos.piece_on(tfrom)] >= PieceValueMidgame[pos.piece_on(tto)]
|
||||
|| type_of(pos.piece_on(tfrom)) == KING)
|
||||
&& pos.move_attacks_square(m, tto))
|
||||
return true;
|
||||
|
|
|
@ -350,14 +350,6 @@ extern const Value PieceValueMidgame[17];
|
|||
extern const Value PieceValueEndgame[17];
|
||||
extern int SquareDistance[64][64];
|
||||
|
||||
inline Value piece_value_midgame(Piece p) {
|
||||
return PieceValueMidgame[p];
|
||||
}
|
||||
|
||||
inline Value piece_value_endgame(Piece p) {
|
||||
return PieceValueEndgame[p];
|
||||
}
|
||||
|
||||
inline Value value_mate_in(int ply) {
|
||||
return VALUE_MATE - ply;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue