X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fposition.cpp;h=7166e8f1e8cf1aca22a216d46be5671556948ddb;hp=326720b0184cde110dfdd9a6d28004bf3f936d82;hb=351ef5c85b6d4b9c71e9da367f0be5ab6e6f8117;hpb=be2925b3c5ef79685f9290414a96efab18bf3a8a diff --git a/src/position.cpp b/src/position.cpp index 326720b0..7166e8f1 100644 --- a/src/position.cpp +++ b/src/position.cpp @@ -45,7 +45,7 @@ Key Position::zobExclusion; Score Position::PieceSquareTable[16][64]; // Material values arrays, indexed by Piece -const Value Position::PieceValueMidgame[17] = { +const Value PieceValueMidgame[17] = { VALUE_ZERO, PawnValueMidgame, KnightValueMidgame, BishopValueMidgame, RookValueMidgame, QueenValueMidgame, VALUE_ZERO, @@ -54,7 +54,7 @@ const Value Position::PieceValueMidgame[17] = { RookValueMidgame, QueenValueMidgame }; -const Value Position::PieceValueEndgame[17] = { +const Value PieceValueEndgame[17] = { VALUE_ZERO, PawnValueEndgame, KnightValueEndgame, BishopValueEndgame, RookValueEndgame, QueenValueEndgame, VALUE_ZERO, @@ -63,13 +63,6 @@ const Value Position::PieceValueEndgame[17] = { RookValueEndgame, QueenValueEndgame }; -// Material values array used by SEE, indexed by PieceType -const Value Position::seeValues[] = { - VALUE_ZERO, - PawnValueMidgame, KnightValueMidgame, BishopValueMidgame, - RookValueMidgame, QueenValueMidgame, QueenValueMidgame*10 -}; - namespace { @@ -1485,7 +1478,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 (midgame_value_of_piece_on(to) >= midgame_value_of_piece_on(from)) + if (piece_value_midgame(piece_on(to)) >= piece_value_midgame(piece_on(from))) return 1; return see(m); @@ -1534,7 +1527,7 @@ int Position::see(Move m) const { stm = opposite_color(color_of_piece_on(from)); stmAttackers = attackers & pieces_of_color(stm); if (!stmAttackers) - return seeValues[capturedType]; + return PieceValueMidgame[capturedType]; // The destination square is defended, which makes things rather more // difficult to compute. We proceed by building up a "swap list" containing @@ -1542,7 +1535,7 @@ int Position::see(Move m) const { // destination square, where the sides alternately capture, and always // capture with the least valuable piece. After each capture, we look for // new X-ray attacks from behind the capturing piece. - swapList[0] = seeValues[capturedType]; + swapList[0] = PieceValueMidgame[capturedType]; capturedType = type_of_piece_on(from); do { @@ -1563,7 +1556,7 @@ int Position::see(Move m) const { // Add the new entry to the swap list assert(slIndex < 32); - swapList[slIndex] = -swapList[slIndex - 1] + seeValues[capturedType]; + swapList[slIndex] = -swapList[slIndex - 1] + PieceValueMidgame[capturedType]; slIndex++; // Remember the value of the capturing piece, and change the side to