本文整理汇总了C++中board::get_black_count方法的典型用法代码示例。如果您正苦于以下问题:C++ board::get_black_count方法的具体用法?C++ board::get_black_count怎么用?C++ board::get_black_count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类board
的用法示例。
在下文中一共展示了board::get_black_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: end_eval
evaluate::score evaluate::end_eval(const board&b , int turn)
{
score s ;
location_list::location move ;
location_list::iterator iter ;
location_list move_list ;
board buffer_b ;
#pragma omp atomic
evaluate::ecount++ ;
gen_move::generate_move(b, turn, move_list) ;
if(move_list.is_empty()) {
gen_move::generate_move(b, (turn+1)%2, move_list) ;
if(move_list.is_empty()) {
if(side == board::BLACK)
return b.get_black_count() >= b.get_white_count() ? 9999990 : -9999990 ;
else
return b.get_white_count() >= b.get_black_count() ? 9999990 : -9999990 ;
} else {
turn = (turn + 1) % 2 ;
}
}
if(side == turn) {
for(iter = move_list.begin() ; iter != move_list.end() ; iter++) {
buffer_b = b ;
move = *iter ;
buffer_b.move_at(move, turn) ;
s = end_eval(buffer_b, (turn+1)%2) ;
if(s > 0) return s ;
}
return -9999990 ;
} else {
for(iter = move_list.begin() ; iter != move_list.end() ; iter++) {
buffer_b = b ;
move = *iter ;
buffer_b.move_at(move, turn) ;
s = end_eval(buffer_b, (turn+1)%2) ;
if(s < 0) return s ;
}
return 9999990 ;
}
}
示例2: eval
evaluate::score evaluate::eval(const board& b, board::piece side, int turn)
{
score s ;
int turn_num ;
assert(side == board::BLACK || side == board::WHITE) ;
turn_num = b.get_black_count() + b.get_white_count() ;
this->side = side ;
if(turn_num >= 48) return end_eval(b, turn) ;
s = recur_eval(b, turn, level, turn_num, -9999999) ;
return s ;
}
示例3: piece_count
evaluate::score evaluate::piece_count(const board& b, int turn_num)
{
int count, count2 ;
score s ;
if(side == board::BLACK) {
count = b.get_black_count() ;
count2 = b.get_white_count() ;
} else if(side == board::WHITE) {
count = b.get_white_count() ;
count2 = b.get_black_count() ;
} else {
return -9999991 ;
}
if(count == 0) return -9999994 ;
if(count2 ==0) return 9999994 ;
if(turn_num == 64) {
if(count > count2) {
return 9999994 ;
} else if(count < count2) {
return -9999994;
} else {
return 0 ;
}
}
s = count - count2 ;
if(turn_num < 40) {
if((count+count2) / count > count + count2 - 10) {
s *= 2 ;
} else {
s *= -2 ;
}
} else {
s *= 3 ;
}
return s ;
}