示例#1
0
Bid SpecificBidAi::bid(Ai const& ai)
{
  Contracts const& contracts = ai.rules().contracts();
  if (ai.last_non_pass().is_pass() && bid_ < contracts.reserved_bids()) {
    return Bid(0);
  }
  if (bid_ >= ai.last_non_pass() &&
     (bid_ > ai.last_non_pass() || ai.position() == position_forehand)) {
    return bid_;
  }
  return Bid::pass;
}
示例#2
0
void SpecificBidAi::reset(Ai const& ai)
{
  if (bid_name_ == "pass") {
    bid_ = Bid::pass;
  } else {
    Contracts const& contracts = ai.rules().contracts();
    bid_ = contracts.index_by_bid_name(bid_name_);
    if (bid_.is_pass()) {
      throw AiError("SpecificBidAi: no such bid '"+bid_name_+"'");
    }
  }
}