當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。