本文整理汇总了C++中CardSet::end方法的典型用法代码示例。如果您正苦于以下问题:C++ CardSet::end方法的具体用法?C++ CardSet::end怎么用?C++ CardSet::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CardSet
的用法示例。
在下文中一共展示了CardSet::end方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char *argv[])
{
// Setup deck of cards
CardSet deck;
for (Rank r = RANK_BEGIN; r != RANK_END; ++r) {
for (Suit s = SUIT_BEGIN; s != SUIT_END; ++s) {
Card card(r, s);
deck.insert(card);
}
}
unsigned long long count = 0;
// Test each starting hand
for (CardSet::const_iterator i = deck.begin(); i != deck.end(); ++i) {
CardSet::const_iterator j = i;
for (++j; j != deck.end(); ++j) {
string hole = Card::pairString(*i, *j);
CardSet test(deck);
Hand hand;
test.erase(*i); hand.append(*i);
test.erase(*j); hand.append(*j);
count++;
board(hole, test, hand);
}
}
cout << "TOTAL: " << count << endl;
printStats();
return 0;
}
示例2: board
void board(const string& hole, const CardSet& deck, const Hand& hand)
{
HandStats s = stats[hole];
for (CardSet::const_iterator i = deck.begin(); i != deck.end(); ++i) {
CardSet::const_iterator j = i;
for (++j; j != deck.end(); ++j) {
CardSet::const_iterator k = j;
for (++k; k != deck.end(); ++k) {
s.count++;
s.outs[ board_rank(hand, *i, *j, *k) ]++;
}
}
}
stats[hole] = s;
}
示例3: 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());
}
示例4: findByPtr
bool Engine::findByPtr(const CardSet& cards, const Card* card)
{
for (CardSet::const_iterator it = cards.begin(); it != cards.end(); ++it) {
if (&*it == card) {
return true;
}
}
return false;
}
示例5: 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());
}