Beispiel #1
0
   sub_match& operator=(const sub_match& that)
   {
      this->first = that.first;
      this->second = that.second;
      matched = that.matched;
#ifdef BOOST_REGEX_MATCH_EXTRA
      if(that.m_captures)
         get_captures() = *(that.m_captures);
#endif
      return *this;
   }
Beispiel #2
0
int Search::capture_quiescence_eval_search(bool white_turn, int alpha, int beta, Board& board) {
	if (board.b[WHITE][KING] == 0) {
		return -10000;
	} else if (board.b[BLACK][KING] == 0) {
		return 10000;
	}

	int static_eval = evaluate(board);
	if (static_eval > alpha && white_turn) {
		return static_eval;
	}
	if (static_eval < beta && !white_turn) {
		return static_eval;
	}

	MoveList capture_moves = get_captures(board, white_turn);
	if (capture_moves.empty()) {
		// the end point of the quiescence search
		return static_eval;
	}
	for (unsigned int i = 0; i < capture_moves.size(); ++i) {
		pick_next_move(capture_moves, i);
		Move move = capture_moves[i];
		quiescence_node_count++;
		make_move(board, move);
		int res = capture_quiescence_eval_search(!white_turn, alpha, beta, board);
		unmake_move(board, move);
		if (res > alpha && white_turn) {
			alpha = res;
		}
		if (res < beta && !white_turn) {
			beta = res;
		}
		if (beta <= alpha || time_to_stop()) {
			break;
		}
	}
	if (white_turn) {
		return alpha;
	}
	return beta;
}