当前位置: 首页>>代码示例>>C++>>正文


C++ CardSet::end方法代码示例

本文整理汇总了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;
}
开发者ID:grom358,项目名称:poker-stats,代码行数:32,代码来源:main.cpp

示例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;
}
开发者ID:grom358,项目名称:poker-stats,代码行数:15,代码来源:main.cpp

示例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());
}
开发者ID:na1x,项目名称:DeCore,代码行数:8,代码来源:observer.cpp

示例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;
}
开发者ID:na1x,项目名称:DeCore,代码行数:9,代码来源:engine.cpp

示例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());
}
开发者ID:na1x,项目名称:DeCore,代码行数:11,代码来源:observer.cpp


注:本文中的CardSet::end方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。