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


C++ CardSet类代码示例

本文整理汇总了C++中CardSet的典型用法代码示例。如果您正苦于以下问题:C++ CardSet类的具体用法?C++ CardSet怎么用?C++ CardSet使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CardSet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: tr

void OracleImporter::httpRequestFinished(int requestId, bool error)
{
	if (error) {
		QMessageBox::information(0, tr("HTTP"), tr("Error."));
		return;
	}
	if (requestId != reqId)
		return;

	CardSet *set = new CardSet(setsToDownload[setIndex].getShortName(), setsToDownload[setIndex].getLongName());
	if (!setHash.contains(set->getShortName()))
		setHash.insert(set->getShortName(), set);
	
	buffer->seek(0);
	buffer->close();
	int cards = importTextSpoiler(set, buffer->data());
	++setIndex;
	
	if (setIndex == setsToDownload.size()) {
		emit setIndexChanged(cards, setIndex, QString());
		setIndex = -1;
	} else {
		downloadNextFile();
		emit setIndexChanged(cards, setIndex, setsToDownload[setIndex].getLongName());
	}
}
开发者ID:CitadelSoftware,项目名称:Cockatrice,代码行数:26,代码来源:oracleimporter.cpp

示例2: clear

int OracleImporter::startImport()
{
    clear();

    int setCards = 0, setIndex= 0;
    QListIterator<SetToDownload> it(allSets);
    const SetToDownload * curSet;

    // add an empty set for tokens
    CardSet *tokenSet = new CardSet(TOKENS_SETNAME, tr("Dummy set containing tokens"), "Tokens");
    sets.insert(TOKENS_SETNAME, tokenSet);

    while (it.hasNext())
    {
        curSet = & it.next();
        if(!curSet->getImport())
            continue;
            
        CardSet *set = new CardSet(curSet->getShortName(), curSet->getLongName(), curSet->getSetType(), curSet->getReleaseDate());
        if (!sets.contains(set->getShortName()))
            sets.insert(set->getShortName(), set);

        int setCards = importTextSpoiler(set, curSet->getCards());

        ++setIndex;
            
        emit setIndexChanged(setCards, setIndex, curSet->getLongName());
    }
    
    emit setIndexChanged(setCards, setIndex, QString());

    // total number of sets
    return setIndex;
}
开发者ID:MustyMustelidae,项目名称:Cockatrice,代码行数:34,代码来源:oracleimporter.cpp

示例3: while

void CardDatabase::loadSetsFromXml(QXmlStreamReader &xml)
{
    while (!xml.atEnd()) {
        if (xml.readNext() == QXmlStreamReader::EndElement)
            break;
        if (xml.name() == "set") {
            QString shortName, longName, setType;
            QDate releaseDate;
            while (!xml.atEnd()) {
                if (xml.readNext() == QXmlStreamReader::EndElement)
                    break;
                if (xml.name() == "name")
                    shortName = xml.readElementText();
                else if (xml.name() == "longname")
                    longName = xml.readElementText();
                else if (xml.name() == "settype")
                    setType = xml.readElementText();
                else if (xml.name() == "releasedate")
                    releaseDate = QDate::fromString(xml.readElementText(), Qt::ISODate);
            }

            CardSet * newSet = getSet(shortName);
            newSet->setLongName(longName);
            newSet->setSetType(setType);
            newSet->setReleaseDate(releaseDate);
        }
    }
}
开发者ID:cafeinecake,项目名称:Cockatrice,代码行数:28,代码来源:carddatabase.cpp

示例4: clear

int OracleImporter::startImport()
{
    clear();

    int setCards = 0, setIndex= 0;
    QListIterator<SetToDownload> it(allSets);
    const SetToDownload * curSet;

    while (it.hasNext())
    {
        curSet = & it.next();
        if(!curSet->getImport())
            continue;

        CardSet *set = new CardSet(curSet->getShortName(), curSet->getLongName());
        if (!setHash.contains(set->getShortName()))
            setHash.insert(set->getShortName(), set);

        int setCards = importTextSpoiler(set, curSet->getCards());

        ++setIndex;

        emit setIndexChanged(setCards, setIndex, curSet->getLongName());
    }

    emit setIndexChanged(setCards, setIndex, QString());

    // total number of sets
    return setIndex;
}
开发者ID:BeardAnnihilator,项目名称:Cockatrice,代码行数:30,代码来源:oracleimporter.cpp

示例5: 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

示例6: Deck

bool Engine::setDeck(const Deck &deck)
{
    if (mDeck) {
        // already set
        return false;
    }

    if (deck.empty()) {
        // nothing to do with empty card set
        return false;
    }

    if (mPlayers.size() < 2) {
        // add more players
        return false;
    }

    mDeck = new Deck(deck);

    CardSet cards;

    cards.insert(deck.begin(), deck.end());

    std::for_each(mGameObservers.begin(), mGameObservers.end(), GameStartNotification(mDeck->trumpSuit(), mGeneratedIds, cards));

    return true;
}
开发者ID:na1x,项目名称:DeCore,代码行数:27,代码来源:engine.cpp

示例7: TEST

TEST(CardSetTest, fill)
{
    using namespace pokerstove;
    CardSet all;
    all.fill();
    EXPECT_EQ(STANDARD_DECK_SIZE, all.size());
}
开发者ID:Argonnite,项目名称:pokerstove,代码行数:7,代码来源:CardSet.test.cpp

示例8: 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;
}
开发者ID:una1veritas,项目名称:Students-Experiments,代码行数:28,代码来源:Dealer.cpp

示例9: cardSet

CardSet PokerHand::cardSet () const
{
  CardSet cs;
  for (uint8_t i=0; i<_ncards; i++)
    cs.insert (Card(_cards[i]));
  return cs;
}
开发者ID:Kurtal,项目名称:pokerstove,代码行数:7,代码来源:PokerHand.cpp

示例10: findSuitPermutation

CardSet pokerstove::canonizeToBoard(const CardSet& board, const CardSet& hand)
{
    CardSet cboard = board.canonize();
    vector<int> perms = findSuitPermutation(board, cboard);
    CardSet chand = hand.rotateSuits(perms[0],perms[1],perms[2],perms[3]);
    return chand;
}
开发者ID:riccitensor,项目名称:pokerstove,代码行数:7,代码来源:CardSet.cpp

示例11: 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

示例12: 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

示例13: at

void SetList::enableAll()
{
    for (int i = 0; i < size(); ++i)
    {
        CardSet *set = at(i);
        set->setIsKnown(true);
        set->setEnabled(true);
    }
}
开发者ID:cafeinecake,项目名称:Cockatrice,代码行数:9,代码来源:carddatabase.cpp

示例14: CardSet

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

示例15: QVariant

QVariant SetsModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid() || (index.column() >= 2) || (index.row() >= rowCount()) || (role != Qt::DisplayRole))
        return QVariant();

    CardSet *set = sets[index.row()];
    switch (index.column()) {
        case 0: return set->getShortName();
        case 1: return set->getLongName();
        default: return QVariant();
    }
}
开发者ID:Akira586,项目名称:Cockatrice,代码行数:12,代码来源:setsmodel.cpp


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