// Return sum of chips in this and pots in // list after this pot. CChips Cpot::getTotalChips() const { if (getNext()) return getChips() + getNext()->getTotalChips(); else return getChips(); }
void Cpot::print() { #ifdef DEBUG_POT_ std::cout << "Chips=" << getChips() << " Stake=" << getStake() << " Bet=" << getBet() << endl; cout << " chips ---> ["; for (int i = 0; i < 9; i++) { cout << chips_[i] << ' '; } cout << chips_[9] << ']' << endl; #endif };
void Cpot::subtractChips(const CChips& c) { // This function subtracts chips from the pot evenly across all players int i = 0; CChips numChips = getChips(); CChips chips(c); CChips oneChip(1, 0); while (chips > 0 && numChips >= chips) { for (i = 0; (chips > 0) && (i < 10); i++) { if (chips_[i] > 0) { chips_[i] -= oneChip; chips -= oneChip; } } } }
//{ //############################################################## //# GLOBALS # //############################################################## global turn = 0; global myChips = getChips(); global mychipsCd = []; global CAT_ATK = "atk"; global CAT_DEF = "def"; global CAT_BUF = "buf"; global CAT_VIE = "vie"; global CAT_DEBUF = "debuf"; //} //{ //############################################################## //# DATA TYPE # //############################################################## /** * renvoie l'élément qui a pour clé key **/ function getItem(key, dict) { for (var item in dict) { if (inArray(item, key)) { return item[1]; } } return null; } /**