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


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

本文整理汇总了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());
}
开发者ID:na1x,项目名称:DeCore,代码行数:8,代码来源:observer.cpp

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

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

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

示例5:

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

示例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;
}
开发者ID:jggaspar,项目名称:orion,代码行数:14,代码来源:rules.cpp

示例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;
}
开发者ID:dseerutt,项目名称:7Wonders,代码行数:37,代码来源:World.cpp

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

示例9: cardsGone

void Observer::cardsGone(const CardSet &cardSet)
{
    mGameCardsCount -= cardSet.size();
}
开发者ID:na1x,项目名称:DeCore,代码行数:4,代码来源:observer.cpp


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