Example #1
0
File: Deck.cpp Project: jbobrow/Set
void Deck::createCards()
{
    numCombinations = pow(numOptions,numProperties);

    Card *c;
    int count = 0;

    for( int i=0; i<3; i++ ) {

        for( int ii=0; ii<3; ii++ ) {

            for( int iii=0; iii<3; iii++ ) {

                for( int iiii=0; iiii<3; iiii++ ) {

                    c = new Card(count++);
                    c->setCount(i);
                    c->setColor(ii);
                    c->setFill(iii);
                    c->setShape(iiii);
                    c->setVisuals();

                    c->position.set( 50 * (iii*3 + iiii), 50 * (i*3 + ii), 0);
                    c->changeState(CARD_STATE_IN_DECK);

                    cards.push_back(c);
                    addChild(cards.back());
                }
            }
        }
    }
}
Example #2
0
File: Deck.cpp Project: jbobrow/Set
void Deck::removeAllCards()
{
    for( int i=0; i<cardsDealt.size(); i++) {
        Card *c = (Card *) cardsDealt[i];
        c->changeState(CARD_STATE_IN_DECK);
    }
    cardsDealt.clear();
}