bool CSymbolEngineTableLimits::EvaluateSymbol(const char *name, double *result, bool log /* = false */) { FAST_EXIT_ON_OPENPPL_SYMBOLS(name); if (memcmp(name, "bet", 3)==0) { if (memcmp(name, "bet", 3)==0 && strlen(name)==3) { *result = bet(); return true; } else if (memcmp(name, "bet", 3)==0 && strlen(name)==4) { char betround = name[3]; if ((betround >= '1') && (betround <= '4')) { *result = bet(name[3]-'0'); return true; } } // Invalid symbol return false; } if (memcmp(name, "bblind", 6)==0 && strlen(name)==6) { *result = bblind(); } else if (memcmp(name, "sblind", 6)==0 && strlen(name)==6) { *result = sblind(); } else if (memcmp(name, "ante", 4)==0 && strlen(name)==4) { *result = ante(); } else if (memcmp(name, "buyin", 5)==0 && strlen(name)==5) { *result = buyin(); } else { // Symbol of a different symbol-engine return false; } // Valid symbol return true; }
void PokerDriver::runAnte() { int a = ante(); for (int i = 0; i < m_Players.size(); i++) { Player *player = m_Players.front(); if(player->ante(a, GAME_DISPLAY) == Player::FOLD) { continue; } m_PotMoney += player->getMoneyInPot(); rotatePlayers(); cout << "Ante_" << i << "_SUCCESS" << endl; } }
void Cplm::mainLoop() { CStrOut message; int i = 0; // If a player left in the middle of hand, it might // happen that the pot still has money - if so, give // the chips here to the player if (!inGame_ && (table_->countPlayers(PLAYER_STATE_ACTIVE) < 2 || table_->numPlayersSittingIn() < 2 || CTournament::Inst()->pause())) { doCleanup(); Sys_Sleep(2000); if (!CTournament::Inst()->isTournament()) { // Players are sitting out CpduAnnounce pdu(table_); pdu.sendAnnounce("Waiting for players to sit in"); Sys_Sleep(2000); } return; } else { // The game thread function calls this repeatedly. // It only gets this far when there's enough players for a game. // First off, get the game number, and setLog all of the current players. memcpy((void*)¤tInstr_, pgl_->fetchInstr(), sizeof(pgl_instr_t)); switch (currentInstr_.opcode) { case (Instr_NOP): break; case (Instr_Deal): deal(); break; // Deal Cards To All Active Players case (Instr_Ante): // Do ANTE { table_->setGameNumber(); CpduGameNumber::SendGameNumber(table_); for (i = 0; i < 10; i++) { CPlayer* player = table_->getPlayerFromSlot(i); if (player) { message << CStrOut::Clear << "Seat " << i << ": " << player->getUsername() << " (" << player->getChips() << " in chips)"; table_->setLog(message.str()); } } ante(); } break; case (Instr_Draw): draw(); break; // Allow Players to Draw Cards case (Instr_Bet): bet(); break; // Do a betting Round case (Instr_Showdown): showdown(); break; // Do Showdown/Announce default: printf("Unknown operation %d!\n", (int)currentInstr_.opcode); break; } } }