int main () { int numPlayers, numGames; FILE *fprob = fopen ("PokerHandProbabilities.txt", "w"); FILE *fgame = fopen ("PokerGameResults.txt", "w"); srand ((unsigned) time (NULL)); findProb (fprob); printf ("Welcome to 5-Card Poker Simulation!\n"); printf ("For hand probabilites, see \"PokerHandProbabilities.txt\"\n\n"); printf ("How many players would you like to simulate (between %i and %i)?\n", MIN_PLAYERS, MAX_PLAYERS); do { scanf ("%i", &numPlayers); } while ((numPlayers > MAX_PLAYERS || numPlayers < MIN_PLAYERS) && printf ("Invalid number! Please try another. \n")); printf ("How many games would you like to simulate?\n"); scanf ("%i", &numGames); simGame (fgame, numPlayers, numGames); printf ("\nYour games have been simulated! Results can be found in \"PokerGameResults.txt\""); return 0; }
void Payne::getNext(const std::vector<unsigned int> & list, Timer & time, int bank, int enemyBank, int turn_num, bool lost_turn){ std::ostringstream out; std::vector <std::pair<double,unsigned>> probs = findProb(allLocs,time); double min(2); double factor(1); double factor2(1); int index = 0; int TOP_CHOICES = 10; std::sort(probs.begin(), probs.end(), eval ); // check if any in list are top ten std::vector <std::pair<double, unsigned> > avail; for(int s = 0; s < TOP_CHOICES; s++) { std::cout << probs[s].second << std::endl; for(int x = 0; x < list.size(); x++) { if(probs[s].second == list[x]) avail.push_back(probs[s]); } } std::sort(avail.begin(), avail.end(), eval); bool byteMe = false; if(avail.size() == 0) { std::cout << "no good squares" << std::endl; bidSquare = mp->get(list[0]); byteMe = true; } else { bidSquare = mp->get(avail[0].second); //bids first item in list } std::cout << "bidding on " << bidSquare.num << std::endl; out << "Min " << min << '\n'; if (min > 0.5) min = 0.5; if((min * this->owned) < 0.15 ){ bid = (0.5 - min) * (50); } else { bid = 4; } if (bid > bank) bid = bank/2; //if(bid == 0) if(lost_turn) lostBids++; else if(lostBids > 2) lostBids--; bid += 2 * lostBids; if (bid > bank) bid = bank/2; if(byteMe == true) { bid = 1; } out << "Enemy bank " << enemyBank << '\n'; out << "Bid " << bid << '\n'; std::cout << out.str(); }