void GameState::getValidMoves_(const std::vector<Direction>& prepend, std::vector<Move>& acc) const { for(int dir = DIR_BEGIN; dir < DIR_END; ++dir) { if(canMove(dir)) { GameState newState = *this; newState.move((Direction) dir); std::vector<Direction> sequence = prepend; sequence.push_back((Direction) dir); if(newState.canRebound()) newState.getValidMoves_(sequence, acc); else acc.push_back(Move(std::move(sequence), std::move(newState))); } } }
double ReboundAwareNaive::operator()(const GameState& state) { return (player_ == PLAYER_1 ? naive1(state) : naive2(state)) + r_ * state.canRebound() * (state.whoseTurn() == player_ ? 1 : -1); }