int evaluate(int depth, int alpha, int beta) { int value; /* assert(alpha < beta); */ if (depth < max_depth) value = search(depth, alpha, beta); else value = material_value() + pos_value(); if (depth == 1) { ++num_moves; fprintf(stderr, "%d [%s] => %d\n", num_moves, move_buf, -value); if (best_value == NO_VALUE || -value > best_value || (-value == best_value && strcmp(move_buf, last_best_move_buf) == 0)) { best_value = -value; strcpy(best_move_buf, move_buf); } } return value; }
std::pair<double, double> Alan_Turing_AI::score_board(const Board& board, Color perspective, const Game_Result& move_result) const { if(move_result.game_has_ended()) { if(move_result.winner() == perspective) { return {1000.0, 1000.0}; } else if(move_result.winner() == opposite(perspective)) { return {-1000.0, -1000.0}; } else { return {0.0, 0.0}; } } return std::make_pair(material_value(board, perspective), position_play_value(board, perspective)); }