do not yet know if one can get this idea working. Currently it is not
yet working. I call it anti-0.00
The problem is the following: On some positions, Onno has a strange
idea who has the upper hand. In reality, Onno should fight for a
draw. But Onno thinks that
- he has the upper hand
- he cannot avoid repetition
This problem occurs with Onno quite often, most likely due to some
problems in eval. But other engines sometimes have this kind of problem
too, especially when they use positive contempt.
As Onno thinks that the position is draw anyway due to repetition, he
will play bad moves. Suppose the real value of the position is -30
from Onno's viewpoint. But Onno thinks it is +20 apart from the
repetition. Onno can make a weak move that reduces the value to +5,
because he thinks there comes the repetition anyway. But this reduces
the real value to -45.
In order to solve this problem, I first implemented contempt. I run
normal searches without contempt (or the contempt given in the UCI
options). If this returns 0.00, I run an additional search with low
contempt (i.e. Onno wants draw) to make Onno go for the draw that is
indicated by the 0.00.
Maybe it is advisable to modify eval so that it does not return 0
coincidently. But at least when working with milli-pawns this hardly
happens anyway.
I also thought about integrating "option to draw the game" somehow in
the position value and do just one search. But I arrived the
conclusion that that is impossible.
Here is my implementation, but it does not yet work properly. What
should be tried:
- Always do that mode first that was put into effect at the previous depth.
- Only switch to draw mode when value 0.00 arose at two or three
consecutive depth.
Code: Select all
// NOT YET WORKING!!
// convert move list into PV list
PV* pv_list = create_pv_list (move_list);
PV* pv_list_draw = create_pv_list (move_list);
d_callback->set_pv (pv_list, move_list.size());
d_callback->set_null_scores (d_null_scores);
// search by iterative deeping
// ----------------------------------------------------------------------
int depth;
int draw_depth = 0;
bool draw = false;
for (depth = 1; depth<SearchBase::c_end_height && !d_terminator->interrupt(); ++depth)
{
// set mode
d_eval_parameter->set_mode (EvalParameter::neutral);
d_trans_map->set_draw_mode (EvalParameter::neutral);
// do the search for given depth
d_callback->send_nodes (d_node_counter->total(), d_tbhit_counter->total());
d_callback->send_depth (depth);
d_terminator->send_depth_start (depth);
root_search (depth, p_board, p_multi_pv, move_list.size(), pv_list);
if (pv_list[0].value()==0)
{
// setup for draw search
EvalParameter::DrawMode draw_mode = p_board.col2mov()==Color::white ? EvalParameter::white_wants_draw : EvalParameter::black_wants_draw;
d_eval_parameter->set_mode (draw_mode);
d_trans_map->set_draw_mode (draw_mode);
// draw research up to current depth
while (draw_depth < depth)
{
++draw_depth;
root_search (draw_depth, p_board, p_multi_pv, move_list.size(), pv_list_draw);
}
// switch to results from draw research
d_callback->set_pv (pv_list_draw, move_list.size());
d_callback->set_null_scores (true);
draw = true;
}
// switch back to normal results
else
{
d_callback->set_pv (pv_list, move_list.size());
d_callback->set_null_scores (d_null_scores);
draw = false;
}
// evaluate result of search
if (d_terminator->interrupt())
break;
d_terminator->send_depth_finished ();
}