Skip to content

Commit c7d0a94

Browse files
committed
When pocicy is too low, extend time
1 parent 252ab0d commit c7d0a94

1 file changed

Lines changed: 24 additions & 2 deletions

File tree

src/UctSearch.cpp

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,6 +1352,7 @@ static bool
13521352
ExtendTime( void )
13531353
{
13541354
int max = 0, second = 0;
1355+
int max_index = 0;
13551356
const int child_num = uct_node[current_root].child_num;
13561357
child_node_t *uct_child = uct_node[current_root].child;
13571358

@@ -1360,6 +1361,7 @@ ExtendTime( void )
13601361
if (uct_child[i].move_count > max) {
13611362
second = max;
13621363
max = uct_child[i].move_count;
1364+
max_index = i;
13631365
} else if (uct_child[i].move_count > second) {
13641366
second = uct_child[i].move_count;
13651367
}
@@ -1368,10 +1370,30 @@ ExtendTime( void )
13681370
// 最善手の探索回数がが次善手の探索回数の
13691371
// 1.2倍未満なら探索延長
13701372
if (max < second * 1.2) {
1373+
if (GetDebugMessageMode()) {
1374+
cerr << "Extend time "
1375+
<< FormatMove(uct_child[max_index].pos) << " max:" << max
1376+
<< " second:" << second << endl;
1377+
}
13711378
return true;
1372-
} else {
1373-
return false;
13741379
}
1380+
1381+
// Extend time if policy value is too low
1382+
if (uct_node[current_root].evaled) {
1383+
if (uct_child[max_index].nnrate < 0.02) {
1384+
if (GetDebugMessageMode()) {
1385+
cerr << "Extend time "
1386+
<< FormatMove(uct_child[max_index].pos) << " policy:" << uct_child[max_index].nnrate << endl;
1387+
}
1388+
return true;
1389+
} else {
1390+
if (GetDebugMessageMode()) {
1391+
cerr << "Stop policy:" << uct_child[max_index].nnrate << endl;
1392+
}
1393+
}
1394+
}
1395+
1396+
return false;
13751397
}
13761398

13771399

0 commit comments

Comments
 (0)