I noticed that in Faile, one consider both the "hash move" and the "pv move". Until now, but I am very inexperimented, I thought that once you have the hashtable, you don't use anymore the pv table.
Did I forget something ??
Code: Select all
/* fill the move ordering array: */
/* if searching the pv, give it the highest move ordering, and if not, rely
on the other heuristics: */
if (searching_pv) {
searching_pv = FALSE;
for (i = 0; i < num_moves; i++) {
from = moves[i].from;
target = moves[i].target;
promoted = moves[i].promoted;
captured = moves[i].captured;
/* give captures precedence in move ordering, and order captures by
material gain */
if (captured != npiece)
move_ordering[i] = cap_values[captured]-cap_values[board[from]]+1000;
else
move_ordering[i] = 0;
/* make sure the suggested hash move gets ordered high: */
if (from == h_move->from && target == h_move->target
&& promoted == h_move->promoted) {
move_ordering[i] += INF-10000;
}
/* make the pv have highest move ordering: */
if (from == pv[1][ply].from && target == pv[1][ply].target
&& promoted == pv[1][ply].promoted) {
searching_pv = TRUE;
move_ordering[i] += INF;
}
/* heuristics other than pv (no need to use them on the pv move - it is
already ordered highest) */
else {
/* add the history heuristic bonus: */
move_ordering[i] += (history_h[from][target]>>i_depth);
/* add the killer move heuristic bonuses: */
if (from == killer1[ply].from && target == killer1[ply].target
&& promoted == killer1[ply].promoted)
move_ordering[i] += 1000;
else if (from == killer2[ply].from && target == killer2[ply].target
&& promoted == killer2[ply].promoted)
move_ordering[i] += 500;
else if (from == killer3[ply].from && target == killer3[ply].target
&& promoted == killer3[ply].promoted)
move_ordering[i] += 250;
}
}
}
/* if not searching the pv: */
else {
for (i = 0; i < num_moves; i++) {
from = moves[i].from;
target = moves[i].target;
promoted = moves[i].promoted;
captured = moves[i].captured;
/* give captures precedence in move ordering, and order captures by
material gain */
if (captured != npiece)
move_ordering[i] = cap_values[captured]-cap_values[board[from]]+1000;
else
move_ordering[i] = 0;
/* make sure the suggested hash move gets ordered first: */
if (from == h_move->from && target == h_move->target
&& promoted == h_move->promoted) {
move_ordering[i] += INF+1000;
}
/* heuristics other than pv */
/* add the history heuristic bonus: */
move_ordering[i] += (history_h[from][target]>>i_depth);
/* add the killer move heuristic bonuses: */
if (from == killer1[ply].from && target == killer1[ply].target
&& promoted == killer1[ply].promoted)
move_ordering[i] += 1000;
else if (from == killer2[ply].from && target == killer2[ply].target
&& promoted == killer2[ply].promoted)
move_ordering[i] += 500;
else if (from == killer3[ply].from && target == killer3[ply].target
&& promoted == killer3[ply].promoted)
move_ordering[i] += 250;
}
}
Philippe