本文整理汇总了C++中CardSet::size方法的典型用法代码示例。如果您正苦于以下问题:C++ CardSet::size方法的具体用法?C++ CardSet::size怎么用?C++ CardSet::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CardSet
的用法示例。
在下文中一共展示了CardSet::size方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cardsPickedUp
void Observer::cardsPickedUp(const PlayerId *playerId, const CardSet &cardSet)
{
mPlayersCards[playerId] += cardSet.size();
CardSet& set = mCurrentRoundData->mPickedUpCards[playerId];
unsigned int oldSize = set.size();
set.insert(cardSet.begin(), cardSet.end());
assert(oldSize + cardSet.size() == set.size());
}
示例2: cardsDropped
void Observer::cardsDropped(const PlayerId *playerId, const CardSet &cardSet)
{
mPlayersCards[playerId] -= cardSet.size();
if (mCurrentRoundData->mDroppedCards.find(playerId) == mCurrentRoundData->mDroppedCards.end()) {
mCurrentRoundData->mDroppedCards[playerId] = CardSet();
}
CardSet& set = mCurrentRoundData->mDroppedCards[playerId];
unsigned int oldSize = set.size();
set.insert(cardSet.begin(), cardSet.end());
assert(oldSize + cardSet.size() == set.size());
}
示例3: checkRankUniqueness
bool Dealer::checkRankUniqueness(CardSet & cs) {
int j = 0;
if (cs.size() == 0)
return false;
if (cs[j].isJoker())
j++;
for (int i = j+1; i < cs.size(); i++) {
if (cs[i].isJoker()){continue;} // 追加:途中にJkrを許す
if (cs[j].getNumber() != cs[i].getNumber() )
return false;
}
return true;
}
示例4: accept
bool Dealer::accept(CardSet & opened) {
Card openedRank;
if (discarded.isEmpty() && opened.isEmpty() )
return false; // regarded as "pass for empty discard pile."
if (!discarded.isEmpty() && discarded.size() != opened.size()) // the number of cards must be match. no five cards w/ Jkr allowed.
return false;
if (!checkRankUniqueness(opened))
return false;
openedRank = getCardRank(opened);
if (!discarded.isEmpty()) // 場にカードがでていないのであれば無条件に受理
if (!openedRank.isGreaterThan(discardedRank))
return false;
// passed all the checks.
discarded.makeEmpty(); //clear();
discarded.insert(opened); // discarded.insertAll(opened);
opened.makeEmpty(); //clear();
discardedRank=openedRank;
return true;
}
示例5:
TEST(CardSetTest, fill)
{
using namespace pokerstove;
CardSet all;
all.fill();
EXPECT_EQ(STANDARD_DECK_SIZE, all.size());
}
示例6: getLegalCards
CardSet* Rules::getLegalCards(MatchState& iMatchState, const CardSet& iCardSet)
{
if (iMatchState.isFirstRound())
{
return (CardSet*)&iCardSet;
}
CardSet* legalCardSet = iCardSet.getCardsBySuit(iMatchState._masterSuit);
//cout << "legal cards: " << endl;
//UserInterface::showPlayerCards(*legalCardSet);
if(legalCardSet->size() == 0)
return (CardSet*)&iCardSet;
else
return legalCardSet;
}
示例7: computeScienceScore
unsigned int World::computeScienceScore(const CardSet& board, char guild) const
{
unsigned int compass = 0, gear = 0, tablet = 0;
switch (guild)
{
case 'n':
break;
case 'c':
compass++;
break;
case 'g':
gear++;
break;
case 't':
tablet++;
break;
default:
break;
}
for (unsigned int i = 0; i < board.size(); i++)
{
const GreenCard& card = (GreenCard&) (*board[i]);
if (card.m_color == GREEN)
{
//std::cout << card.m_name << "()()" << std::endl;
if (card.getType() == 'c')
compass++;
if (card.getType() == 'g')
gear++;
if (card.getType() == 't')
tablet++;
}
}
//std::cout << "c:" << compass << " g:" << gear << " t:" << tablet << std::endl;
unsigned int res = compass*compass + gear*gear + tablet*tablet + 7*std::min(compass, std::min(gear, tablet));
return res;
}
示例8: getCardRank
Card Dealer::getCardRank(CardSet & cs){
for (int i = 0; i < cs.size(); i++) {
if (!cs[i].isJoker()){return cs[i];}
}
return cs[0];
}
示例9: cardsGone
void Observer::cardsGone(const CardSet &cardSet)
{
mGameCardsCount -= cardSet.size();
}