void step()

in simple_game/simple_bidding.h [103:159]


  void step(int action) override {
    // Any input action has to be legal action. 
    assert(!terminated());

    if (card1_ < 0) {
      // [TODO]: HACK here.
      //   If seqEnumerate is true (e.g. in evaluation mode),
      //   then the environment would alter the nature action to enumerate all
      //   possible
      //        situations (different card1_) and see whether they works.
      if (commOptions_.seqEnumerate) {
        action = numGameFinished_;
      }
      // 0 .. N - 1
      card1_ = action % commOptions_.N;
      card2_ = action / commOptions_.N;
      return;
    }

    bool illegal = false;
    if (publicActions_.empty() && action == kPass) {
      illegal = true;
    }

    // Check if bidding is valid.
    if (publicActions_.size() >= 1) {
      if (action > kPass && lastBid_ >= action) {
        illegal = true;
      } else if (action == kPass) {
        // 1 pass and we end the game.
        terminated_ = true;
        if (lastBid_ == kPass) {
          // no contract.
          reward_ = 0;
        } else {
          int finalContract = 1 << (lastBid_ - 1);
          if (finalContract <= card1_ + card2_) {
            reward_ = finalContract;
          } else {
            // Failed the contract.
            reward_ = 0;
          }
        }
      }
    }

    if (illegal) {
        // illegal action.
        throw std::runtime_error("action " + std::to_string(action) +
                                 " is not a legal action!");
    }

    publicActions_.push_back(action);
    if (action != kPass) {
      lastBid_ = action;
    }
  }