int main() { bool debug = true; human_ai hai = human_ai("human"); random_ai rai = random_ai("random_ai"); alpha_beta_ai sai = alpha_beta_ai("super_ai"); if (debug) { play_sr(sai, rai); return 0; } srand((int) time(NULL)); time_t time_s = time(NULL); int n_game = 0; while (true) { play_rr(rai, rai); n_game ++; if (n_game % 100 == 0) { cout << "+"; cout.flush(); } if (n_game % 10000 == 0) { cout << " | " << cache.size(); int sum = 0; for (map<string, int>::iterator iter = cache.begin(); iter != cache.end(); iter ++) { sum += iter->second; } time_t time_e = time(NULL); cout << "/" << sum << " : " << 100 - 100.0*cache.size()/sum << "% | " << time_e - time_s << "seconds \n"; cout.flush(); } } return 0; }
Players::Players(Configuration config) { if(!config.AutoMode) { // first player is human for faster lookup. std::unique_ptr<Player> human(new Player()); human->chips.set(config.StartingChips); human->Name = "You"; std::unique_ptr<HumanAI> human_ai(new HumanAI()); human->AI = std::move(human_ai); this->items.push_back(std::move(human)); } // seed other players for(int i=0;i < config.PlayerNames.size(); i++){ std::unique_ptr<Player> player(new Player()); player->chips.set(config.StartingChips); player->Name = config.PlayerNames[i]; std::unique_ptr<StockAI> stock_ai(new StockAI()); player->AI = std::move(stock_ai); this->items.push_back(std::move(player)); } // set dealer std::default_random_engine generator(std::random_device{}()); std::uniform_int_distribution<int> distribution(0, this->items.size()-1); int startingDealer = distribution(generator); // we set the dealer then iterator one to also properly seed the big and small blinds. this->Dealer = startingDealer; nextDealer(); }