int main(int argc, char **argv) { char *handranksfile = DEFAULT_HANDRANKS_FILE; char *hand[NUM_HAND]; char *community[NUM_COMMUNITY]; char *last_arg; int num_community = argc - 3; int num_playing = DEFAULT_NUM_PLAYING; int simulated; double winprob; PokerAI *AI; InitEvaluator(handranksfile); if (argc < 3) { fprintf(stderr, "Usage: ./winprob hand1 hand2 [comm1, .. , comm5] [-nx]\n"); fprintf(stderr, "\tWhere x is the number of opponents (3 by default)\n"); exit(1); } for (int i = 0; i < NUM_HAND; i++) { hand[i] = argv[i + 1]; } for (int i = 0; i < num_community - 1; i++) { community[i] = argv[NUM_HAND + i + 1]; } //Check if the last card is a community card //or a specifier of the number of players last_arg = argv[NUM_HAND + num_community]; if (!strncmp(last_arg, "-n", strlen("-n"))) { num_playing = atoi(last_arg + strlen("-n")); num_community--; } else { community[num_community - 1] = last_arg; } AI = CreatePokerAI(TIMEOUT); SetHand(AI, hand, NUM_HAND); SetCommunity(AI, community, num_community); UpdateGameDeck(&AI->game); AI->game.num_playing = num_playing; winprob = GetWinProbability(AI); simulated = AI->games_simulated; printf("Win probability: %.2lf%%\n", winprob * 100); printf("Games simulated: %dk\n", simulated / 1000); //Clean up resources DestroyPokerAI(AI); return 0; }
Realm::Realm(qint32 id) { m_id = id; SetVersion("0.0.0"); SetCommunity(RealmCommunity(COMMUNITY_INT, "en")); SetHostAddress("127.0.0.1"); SetPortNo(5556); SetPlayerLimit(500); SetName("Wakbox - default Realm"); Lock(true); }
void CCharacterInfo::InitSpecificCharacter (shared_str new_id) { R_ASSERT(new_id.size()); m_SpecificCharacterId = new_id; m_SpecificCharacter.Load(m_SpecificCharacterId); if(Rank().value() == NO_RANK) SetRank(m_SpecificCharacter.Rank()); if(Reputation().value() == NO_REPUTATION) SetReputation(m_SpecificCharacter.Reputation()); if(Community().index() == NO_COMMUNITY_INDEX) SetCommunity(m_SpecificCharacter.Community()); if(!m_StartDialog || !m_StartDialog.size() ) m_StartDialog = m_SpecificCharacter.data()->m_StartDialog; }