本文整理汇总了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;
}
示例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));
}
}
示例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;
}
示例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;
}
示例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());
}
示例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());
}
示例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));
}
}
示例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;
}
示例9: botmove
void botmove(){
addressCard C = whichcardtake();
if(C != NULL){
doTake(Card(C));
doMeld(Card(C));
}else{
doDraw();
}
botmeld();
infoCard off = whichcardoff();
doOff(off);
}
示例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));
}
}
示例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();
}
示例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;
}
示例13: Card
void Hand::clearHand()
{
for (int i = 0; i < 5; i++)
{
_hand[i] = Card(); /*** Make this a 'NULL' card instead? ***/
}
}
示例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);
}
示例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);
}