本文整理汇总了C++中PointSet::length方法的典型用法代码示例。如果您正苦于以下问题:C++ PointSet::length方法的具体用法?C++ PointSet::length怎么用?C++ PointSet::length使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PointSet
的用法示例。
在下文中一共展示了PointSet::length方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init_priors
void Goban::init_priors(Prior priors[]) const
{
const double EQUIV = size;// /2;
priors[PASS].prior = 0.1*EQUIV, priors[PASS].equiv = EQUIV;
for(int i = 0; i < empty_points.length(); ++i){
int p = empty_points[i];
priors[p].prior = 0.5*EQUIV, priors[p].equiv = EQUIV;
}
for(int i = 0; i < empty_points.length(); ++i){
int p = empty_points[i];
if(is_self_atari(p, side)){
priors[p].prior = 0.2*EQUIV, priors[p].equiv = 2*EQUIV;
continue;
}
if(is_surrounded(p, side)){
priors[p].prior = 0.3*EQUIV, priors[p].equiv = EQUIV;
continue;
}
priors[p].prior = 0.5*EQUIV, priors[p].equiv = EQUIV;
if(size > 11){
if(distance_to_edge[p] == 0 && !stones_around(p, 4)){
priors[p].prior = 0.1*EQUIV, priors[p].equiv = EQUIV;
}
else if(distance_to_edge[p] == 3 && !stones_around(p, 4)){
priors[p].prior = 0.9*EQUIV, priors[p].equiv = EQUIV;
}
}
GroupSet<4> neigh;
int nneigh = neighbour_groups(p, neigh);
for(int j = 0; j < nneigh; j++){
if(neigh[j]->has_one_liberty()){
if(neigh[j]->get_color() != side){
priors[p].prior = 1.4*EQUIV, priors[p].equiv = 2*EQUIV;
goto endloop;
}
else{
priors[p].prior = 0.6*EQUIV, priors[p].equiv = EQUIV;
goto endloop;
}
}
}
if(match_mogo_pattern(p, side)){
priors[p].prior = 0.9*EQUIV, priors[p].equiv = EQUIV;
continue;
}
endloop:;
}
if(last_point == 0) return;
PointSet<MAXSIZE2> list;
capture_heuristic(last_point, list);
for(int i = 0; i < list.length(); i++){
priors[list[i]].prior += 3*EQUIV, priors[list[i]].equiv += 3*EQUIV;
}
list.clear();
save_heuristic(last_point, list);
for(int i = 0; i < list.length(); i++){
priors[list[i]].prior += 2*EQUIV, priors[list[i]].equiv += 2*EQUIV;
}
list.clear();
pattern_heuristic(last_point, list);
for(int i = 0; i < list.length(); i++){
priors[list[i]].prior += 2*EQUIV, priors[list[i]].equiv += 2*EQUIV;
}
list.clear();
for(int i = 0; last_point && i < 4; i++){
for(int j = 0; j < 4*(i+1); j++){
int v = within_manhattan[last_point][i][j];
if(v) {
priors[v].prior += (1.0-0.1*i)*EQUIV, priors[v].equiv += EQUIV;
}
}
}
}