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


C++ Card函数代码示例

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


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

示例1: main

int main()
{
	const char* counting = "counting";
	Player *cplayer = player_factory(counting);

	Hand chand;
	Hand chand1;
	Hand chand2;

	//I added this comment line

	Card c = Card(Card::ACE, Card::SPADES);
	Card d = Card(Card::FIVE, Card::CLUBS);

	Card f = Card(Card::SIX, Card::CLUBS);

	Card g = Card(Card::TWO, Card::CLUBS);

	Card e = Card(Card::FOUR, Card::SPADES);

	chand.add_card(c);
	chand.add_card(d);

	chand1.add_card(c);
	chand1.add_card(f);

	chand2.add_card(c);
	chand2.add_card(g);

	assert(cplayer->draw(e, chand) == true);
	assert(cplayer->draw(e, chand1) == true);
	assert(cplayer->draw(e, chand2) == true);

return 0;
}
开发者ID:bliminate,项目名称:Project_4,代码行数:35,代码来源:Player_test15.cpp

示例2: init

void Deck::init() {
    for (int i = 0; i < MAX_CARD_VALUE; ++i) {
        cards.push_back(Card(CLUBS, i));
        cards.push_back(Card(DIAMONDS, i));
        cards.push_back(Card(HEARTS, i));
        cards.push_back(Card(SPADES, i));
    }
}
开发者ID:ebaratte,项目名称:cpp-klondike,代码行数:8,代码来源:Deck.cpp

示例3: parseHand2

Hand2 parseHand2(json::Value value) {
    Hand2 hand;
    hand[0] = Card(value[size_t(0)]);
    hand[1] = Card(value[size_t(1)]);

    std::sort(hand.begin(), hand.end());

    return hand;
}
开发者ID:r0mai,项目名称:poker-player-rainbow-dash,代码行数:9,代码来源:Hand.cpp

示例4: IdenticeO

int IdenticeO(TMultime *m1, TMultime *m2)
{
	TMultime *x,*y;
	if(Card(m1)!=Card(m2)) return 0;
	for(x = m1->v , y = m2->v ; x < m1->s ; x+= m1->d, y+=m2->d){
		if(m1->fid(x,y)!=0) return 0;
		// if( *(char*)x != *(char*)y ) return 0;
	}
	return 1;
}
开发者ID:flaviusone,项目名称:Data-Structures,代码行数:10,代码来源:funcMO-1.c

示例5: TEST

TEST(PutDown, LessThanFour)
{
    std::vector<Card> j = std::vector<Card>();
    j.push_back(Card(1,5));
    j.push_back(Card(2,5));
    Player pj = Player(j,"NICK");
    std::vector<Card> pdj = pj.putDown(5);
    ASSERT_EQ(0, pdj.size());

}
开发者ID:ColinEaster,项目名称:Cloud11,代码行数:10,代码来源:testplayer.cpp

示例6: createDeck

void Game::createDeck(){
    for (int i = 1; i <= 52; i++){
        // Adding two of the same card because we use two decks
        deck.push_back(Card(i));
        deck.push_back(Card(i));
    }

    random_shuffle(deck.begin(), deck.end());
    random_shuffle(deck.begin(), deck.end());
    random_shuffle(deck.begin(), deck.end());
}
开发者ID:aaronjohnleonard,项目名称:sequence,代码行数:11,代码来源:game.cpp

示例7:

Deck::Deck()
{
    cards_.reserve(36);
    for (int i = 6; i <= Card::ACE; i++)
    {
        cards_.push_back(Card(i, Card::hearts));
        cards_.push_back(Card(i, Card::diamonds));
        cards_.push_back(Card(i, Card::spades));
        cards_.push_back(Card(i, Card::clubs));
    }
}
开发者ID:zackgomez,项目名称:ezdurak,代码行数:11,代码来源:Deck.cpp

示例8: main

int main()
{
   std::vector<Card> cards;
   // Correct
   cards.push_back(Card(SPADES, ACE));
   cards.push_back(Card(SPADES, TWO));
   // Wrong
   cards.push_back(Card(Suit::SPADES, Value::ACE));
   cards.push_back(Card(Suite::SPADES, Value::TWO));
   return 0;
}
开发者ID:KubaO,项目名称:stackoverflown,代码行数:11,代码来源:main.cpp

示例9: botmove

void botmove(){
	addressCard C = whichcardtake();
	if(C != NULL){
		doTake(Card(C));		
		doMeld(Card(C));
	}else{
		doDraw();
	}
	botmeld();
	infoCard off = whichcardoff();
	doOff(off);
}
开发者ID:qornanali,项目名称:Rummy-C,代码行数:12,代码来源:bot.c

示例10:

 Deck::Deck()
 {
     // fill the deck
     this->reserve(52);
     for(int i = 1; i <= 13; i++)
     {
         this->push_back(Card(Card::Spades, i));
         this->push_back(Card(Card::Clubs, i));
         this->push_back(Card(Card::Diamonds, i));
         this->push_back(Card(Card::Hearts, i));
     }
 }
开发者ID:Nobody-7,项目名称:tcpppl_answers,代码行数:12,代码来源:ex04.cpp

示例11: Reset

  void Game::Reset(int nEachType)
  {
    m_deck.clear();
    m_arena.clear();
    int count;
    int serial = 100;

    std::vector<Card::Face> faces;
    faces.push_back(Card::Goomba);
    faces.push_back(Card::Mushroom);
    faces.push_back(Card::Flower);
    faces.push_back(Card::Mario);
    faces.push_back(Card::Bowser);
    faces.push_back(Card::Cloud);
    faces.push_back(Card::Luigi);
    faces.push_back(Card::Star);

    std::vector<Card::Face>::const_iterator faceIt;

    for(count = 0; count < nEachType; count ++, serial ++)
    {
      for(faceIt = faces.begin(); faceIt != faces.end(); ++ faceIt)
      {
        m_deck.push_back(Card(*faceIt, serial));
      }
    }

    std::random_shuffle(m_deck.begin(), m_deck.end(), MarioRand);

    _DealOut();
  }
开发者ID:thenfour,项目名称:Archives,代码行数:31,代码来源:Game.cpp

示例12: if

bool SimpleXMLHandler::startElement(const QString &namespaceURI, const QString &localName,
                                    const QString &qName, const QXmlAttributes &attributes)
{
    // maybe check for double opening lines?
//qDebug("lol");
    if (qName == "LINES") {
        bool ok1 = true, ok2 = true;
        row = 0;
        readingCards = true;
        properties.resize(attributes.value("ColCount").toInt(&ok1));
//        cards.resize(attributes.value("RowCount").toInt(&ok2) - 1);
        if (!ok1 || !ok2 ) {
            errorStr = "Can't convert string to double.";
            return false;
        }
    } else if (!readingCards) {
        return true;
    } else if (qName == "LINE") {
        column = 0;
        currentCard = Card();
    } else if (qName == "CELL") {
        currentText.clear();
    }

    return true;
}
开发者ID:ABBAPOH,项目名称:ccgo,代码行数:26,代码来源:simplexmlhandler.cpp

示例13: Card

void Hand::clearHand()
{
	for (int i = 0; i < 5; i++)
	{
		_hand[i] = Card(); /*** Make this a 'NULL' card instead? ***/
	}
}
开发者ID:shanewilhelm,项目名称:5-Card-Poker,代码行数:7,代码来源:hand.cpp

示例14: charsToCard

Card charsToCard(char c0, char c1)
{
  if(c0 >= 'a' && c0 <= 'z') c0 += ('A' - 'a');
  if(c1 >= 'A' && c1 <= 'Z') c1 += ('a' - 'A');
  std::string c; c += c0; c += c1;
  return Card(c);
}
开发者ID:lvandeve,项目名称:oopoker,代码行数:7,代码来源:tools_terminal.cpp

示例15: afiMx

void afiMx(TMultime*m) /* afiseaza continut multime de Tx */
{ Tx *p = (Tx*)(m->v);
	int i = 0, n = Card(m);
	printf("      v1     v2   v3\n");
	for(; i < n; i++)
		printf("[%2i]%4i%7.2lf  %s\n", i, p[i].v1, p[i].v2, p[i].v3);
}
开发者ID:flaviusone,项目名称:Data-Structures,代码行数:7,代码来源:testMX-1.c


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