1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Use MVV to score captures when see >=0

This fix a couple of dubious bugs in MVV/LVA
ordering.

Tests seems to confirm now is slightly better.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2008-10-17 06:14:21 +02:00
parent 2943e1ca31
commit 173ecc0acf

View file

@ -125,7 +125,7 @@ Move MovePicker::get_next_move() {
{ {
assert(move_is_ok(mateKiller)); assert(move_is_ok(mateKiller));
if (generate_move_if_legal(pos, mateKiller, pinned) != MOVE_NONE) if (generate_move_if_legal(pos, mateKiller, pinned) != MOVE_NONE)
return ttMove; return mateKiller;
} }
break; break;
@ -218,10 +218,9 @@ void MovePicker::score_captures() {
moves[i].score = pos.see(m); moves[i].score = pos.see(m);
if (moves[i].score >= 0) if (moves[i].score >= 0)
{ {
moves[i].score = move_promotion(m) ? QueenValueMidgame moves[i].score = HistoryMax;
: int(pos.midgame_value_of_piece_on(move_to(m))) moves[i].score += move_promotion(m) ? QueenValueMidgame
-int(pos.type_of_piece_on(move_from(m))); : pos.midgame_value_of_piece_on(move_to(m));
// FIXME second term seems wrong !
} }
} }
} }
@ -267,14 +266,12 @@ void MovePicker::score_evasions() {
void MovePicker::score_qcaptures() { void MovePicker::score_qcaptures() {
// Use MVV/LVA ordering. // Use MVV/LVA ordering
for (int i = 0; i < numOfMoves; i++) for (int i = 0; i < numOfMoves; i++)
{ {
Move m = moves[i].move; Move m = moves[i].move;
moves[i].score = move_promotion(m) ? QueenValueMidgame moves[i].score = move_promotion(m) ? QueenValueMidgame
: int(pos.midgame_value_of_piece_on(move_to(m))) : pos.midgame_value_of_piece_on(move_to(m));
-int(pos.midgame_value_of_piece_on(move_to(m))) / 64;
// FIXME Why second term like that ???
} }
} }
@ -423,10 +420,7 @@ Move MovePicker::pick_move_from_list() {
{ {
move = moves[bestIndex].move; move = moves[bestIndex].move;
moves[bestIndex] = moves[movesPicked++]; moves[bestIndex] = moves[movesPicked++];
// Remember to change the line below if we decide to hash the qsearch! if (move != ttMove && pos.move_is_legal(move, pinned))
// Maybe also postpone the legality check until after futility pruning?
// FIXME !!!
if (/* move != ttMove && */ pos.move_is_legal(move, pinned))
return move; return move;
} }
} }
@ -439,10 +433,8 @@ Move MovePicker::pick_move_from_list() {
// move here? FIXME // move here? FIXME
while (movesPicked < numOfMoves) while (movesPicked < numOfMoves)
{ {
move = moves[movesPicked++].move; move = moves[movesPicked++].move;
// Remember to change the line below if we decide to hash the qsearch! if (move != ttMove && pos.move_is_legal(move, pinned))
// FIXME !!!
if (/* move != ttMove && */ pos.move_is_legal(move, pinned))
return move; return move;
} }
break; break;