mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00
MovePicker:find bad captures during scoring
Instead of pospone until picking. No functional change and probably no performance change but it is needed for following patch. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
940c53c366
commit
2ed22e4fc8
1 changed files with 12 additions and 21 deletions
|
@ -212,6 +212,8 @@ void MovePicker::score_captures() {
|
||||||
// where it is possible to recapture with the hanging piece). Exchanging
|
// where it is possible to recapture with the hanging piece). Exchanging
|
||||||
// big pieces before capturing a hanging piece probably helps to reduce
|
// big pieces before capturing a hanging piece probably helps to reduce
|
||||||
// the subtree size.
|
// the subtree size.
|
||||||
|
// While scoring captures it moves all captures with negative SEE values
|
||||||
|
// to the badCaptures[] array.
|
||||||
Move m;
|
Move m;
|
||||||
int seeValue;
|
int seeValue;
|
||||||
|
|
||||||
|
@ -226,8 +228,15 @@ void MovePicker::score_captures() {
|
||||||
else
|
else
|
||||||
moves[i].score = int(pos.midgame_value_of_piece_on(move_to(m)))
|
moves[i].score = int(pos.midgame_value_of_piece_on(move_to(m)))
|
||||||
-int(pos.type_of_piece_on(move_from(m)));
|
-int(pos.type_of_piece_on(move_from(m)));
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Losing capture, move it to the badCaptures[] array
|
||||||
|
assert(numOfBadCaptures < 63);
|
||||||
moves[i].score = seeValue;
|
moves[i].score = seeValue;
|
||||||
|
badCaptures[numOfBadCaptures++] = moves[i];
|
||||||
|
moves[i--] = moves[--numOfMoves];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,9 +359,6 @@ int MovePicker::find_best_index(Bitboard* squares, int values[]) {
|
||||||
/// from a list of generated moves (moves[] or badCaptures[], depending on
|
/// from a list of generated moves (moves[] or badCaptures[], depending on
|
||||||
/// the current move generation phase). It takes care not to return the
|
/// the current move generation phase). It takes care not to return the
|
||||||
/// transposition table move if that has already been serched previously.
|
/// transposition table move if that has already been serched previously.
|
||||||
/// While picking captures in the PH_GOOD_CAPTURES phase (i.e. while picking
|
|
||||||
/// non-losing captures in the main search), it moves all captures with
|
|
||||||
/// negative SEE values to the badCaptures[] array.
|
|
||||||
|
|
||||||
Move MovePicker::pick_move_from_list() {
|
Move MovePicker::pick_move_from_list() {
|
||||||
|
|
||||||
|
@ -366,23 +372,8 @@ Move MovePicker::pick_move_from_list() {
|
||||||
|
|
||||||
while (movesPicked < numOfMoves)
|
while (movesPicked < numOfMoves)
|
||||||
{
|
{
|
||||||
int bestScore = -10000000;
|
bestIndex = find_best_index();
|
||||||
bestIndex = -1;
|
|
||||||
for (int i = movesPicked; i < numOfMoves; i++)
|
|
||||||
{
|
|
||||||
if (moves[i].score < 0)
|
|
||||||
{
|
|
||||||
// Losing capture, move it to the badCaptures[] array
|
|
||||||
assert(numOfBadCaptures < 63);
|
|
||||||
badCaptures[numOfBadCaptures++] = moves[i];
|
|
||||||
moves[i--] = moves[--numOfMoves];
|
|
||||||
}
|
|
||||||
else if (moves[i].score > bestScore)
|
|
||||||
{
|
|
||||||
bestIndex = i;
|
|
||||||
bestScore = moves[i].score;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (bestIndex != -1) // Found a good capture
|
if (bestIndex != -1) // Found a good capture
|
||||||
{
|
{
|
||||||
move = moves[bestIndex].move;
|
move = moves[bestIndex].move;
|
||||||
|
|
Loading…
Add table
Reference in a new issue