mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 16:53:09 +00:00
Shortcut sorting when no move is in history
An alternative algorithm to psqt scoring. Still unclear what is the best, more tests needed. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
644db060ae
commit
a03ab94f44
2 changed files with 11 additions and 10 deletions
|
@ -247,35 +247,35 @@ void MovePicker::score_captures() {
|
||||||
|
|
||||||
void MovePicker::score_noncaptures() {
|
void MovePicker::score_noncaptures() {
|
||||||
|
|
||||||
bool all_zero = true;
|
All_zero = true;
|
||||||
for (int i = 0; i < numOfMoves; i++)
|
for (int i = 0; i < numOfMoves; i++)
|
||||||
{
|
{
|
||||||
Move m = moves[i].move;
|
Move m = moves[i].move;
|
||||||
if (m == killer1)
|
if (m == killer1)
|
||||||
{
|
{
|
||||||
moves[i].score = HistoryMax + 2;
|
moves[i].score = HistoryMax + 2;
|
||||||
all_zero = false;
|
All_zero = false;
|
||||||
}
|
}
|
||||||
else if (m == killer2)
|
else if (m == killer2)
|
||||||
{
|
{
|
||||||
moves[i].score = HistoryMax + 1;
|
moves[i].score = HistoryMax + 1;
|
||||||
all_zero = false;
|
All_zero = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
moves[i].score = H.move_ordering_score(pos->piece_on(move_from(m)), m);
|
moves[i].score = H.move_ordering_score(pos->piece_on(move_from(m)), m);
|
||||||
if (all_zero && moves[i].score != 0)
|
if (All_zero && moves[i].score != 0)
|
||||||
all_zero = false;
|
All_zero = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!all_zero)
|
//if (!all_zero)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// If we don't have at least one history score then
|
// If we don't have at least one history score then
|
||||||
// try to order using psq tables difference between
|
// try to order using psq tables difference between
|
||||||
// from square and to square.
|
// from square and to square.
|
||||||
for (int i = 0; i < numOfMoves; i++)
|
//for (int i = 0; i < numOfMoves; i++)
|
||||||
moves[i].score = pos->mg_pst_delta(moves[i].move);
|
// moves[i].score = pos->mg_pst_delta(moves[i].move);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MovePicker::score_evasions() {
|
void MovePicker::score_evasions() {
|
||||||
|
@ -359,7 +359,7 @@ Move MovePicker::pick_move_from_list() {
|
||||||
// the entire move list for the best move. If many moves have already
|
// the entire move list for the best move. If many moves have already
|
||||||
// been searched and it is not a PV node, we are probably failing low
|
// been searched and it is not a PV node, we are probably failing low
|
||||||
// anyway, so we just pick the first move from the list.
|
// anyway, so we just pick the first move from the list.
|
||||||
if(pvNode || movesPicked < 12) {
|
if(!All_zero && (pvNode || movesPicked < 12)) {
|
||||||
bestIndex = -1;
|
bestIndex = -1;
|
||||||
for(int i = movesPicked; i < numOfMoves; i++)
|
for(int i = movesPicked; i < numOfMoves; i++)
|
||||||
if(moves[i].score > bestScore) {
|
if(moves[i].score > bestScore) {
|
||||||
|
|
|
@ -87,6 +87,7 @@ private:
|
||||||
int numOfMoves, numOfBadCaptures;
|
int numOfMoves, numOfBadCaptures;
|
||||||
int movesPicked, badCapturesPicked;
|
int movesPicked, badCapturesPicked;
|
||||||
bool finished;
|
bool finished;
|
||||||
|
bool All_zero;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue