Card *Fortyeight::newCards() { if (Deck::deck()->isEmpty() && lastdeal) return 0; if (pile->top() && pile->top()->animated()) return pile->top(); if (Deck::deck()->isEmpty()) { lastdeal = true; while (!pile->isEmpty()) { Card *c = pile->at(pile->cardsLeft()-1); c->stopAnimation(); Deck::deck()->add(c, true); } } Card *c = Deck::deck()->nextCard(); pile->add(c, true); c->stopAnimation(); qreal x = c->realX(); qreal y = c->realY(); c->setPos( Deck::deck()->pos() ); c->flipTo(x, y, DURATION_FLIP ); takeState(); considerGameStarted(); if ( Deck::deck()->isEmpty() && lastdeal ) emit newCardsPossible( false ); return c; }
bool Fortyeight::newCards() { if ( talon->isEmpty() ) { if ( lastdeal ) { return false; } else { lastdeal = true; flipCardsToPile( pile->cards(), talon, DURATION_MOVE ); } } else { flipCardToPile( talon->topCard(), pile, DURATION_MOVE ); setKeyboardFocus( pile->topCard() ); } if ( talon->isEmpty() && lastdeal ) emit newCardsPossible( false ); return true; }
void Gypsy::restart( const QList<KCard*> & cards ) { QList<KCard*> cardList = cards; for ( int round = 0; round < 8; ++round ) addCardForDeal(store[round], cardList.takeLast(), false, store[round]->pos() + QPointF(-2*deck()->cardWidth(),-1.1*deck()->cardHeight())); for ( int round = 0; round < 8; ++round ) addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-3*deck()->cardWidth(),-1.6*deck()->cardHeight())); for ( int round = 0; round < 8; ++round ) addCardForDeal(store[round], cardList.takeLast(), true, store[round]->pos() + QPointF(-4*deck()->cardWidth(),-2.1*deck()->cardHeight())); while ( !cardList.isEmpty() ) { KCard * c = cardList.takeFirst(); c->setPos( talon->pos() ); c->setFaceUp( false ); talon->add( c ); } startDealAnimation(); emit newCardsPossible(true); }
void Fortyeight::restart( const QList<KCard*> & cards ) { lastdeal = false; QList<KCard*> cardList = cards; for ( int r = 0; r < 4; ++r ) { for ( int column = 0; column < 8; ++column ) { QPointF initPos = stack[column]->pos() - QPointF( 0, 2 * deck()->cardHeight() ); addCardForDeal( stack[column], cardList.takeLast(), true, initPos ); } } while ( !cardList.isEmpty() ) { KCard * c = cardList.takeFirst(); c->setPos( talon->pos() ); c->setFaceUp( false ); talon->add( c ); } startDealAnimation(); flipCardToPile( talon->topCard(), pile, DURATION_MOVE ); emit newCardsPossible( true ); }
void Fortyeight::restart() { lastdeal = false; Deck::deck()->collectAndShuffle(); deal(); emit newCardsPossible( true ); }
Card *Gypsy::newCards() { if (Deck::deck()->isEmpty()) return 0; unmarkAll(); dealRow(true); takeState(); considerGameStarted(); if (Deck::deck()->isEmpty()) emit newCardsPossible(false); return store[0]->top(); }
bool Gypsy::newCards() { if ( talon->isEmpty() ) return false; for ( int round = 0; round < 8; ++round ) { KCard * c = talon->topCard(); flipCardToPileAtSpeed( c, store[round], DEAL_SPEED ); c->setZValue( c->zValue() + 8 - round ); } if (talon->isEmpty()) emit newCardsPossible(false); return true; }
bool Spider::newCards() { // The solver doesn't distinguish between dealing a new row of cards and // removing complete runs from the tableau. So it we're in demo mode and // newCards() is called, we should check to see if there are any complete // runs to move before dealing a new row. if ( isDemoActive() ) { for ( int i = 0; i < 10; ++i ) { if ( pileHasFullRun( stack[i] ) ) { moveFullRunToLeg( stack[i] ); return true; } } } if ( m_redeal > 4 ) return false; redeals[m_redeal]->setVisible(false); recalculatePileLayouts(); for ( int column = 0; column < 10; ++column ) { KCard * c = redeals[m_redeal]->topCard(); if ( !c ) break; flipCardToPileAtSpeed( c, stack[column], DEAL_SPEED ); c->setZValue( c->zValue() + 10 - column ); } ++m_redeal; if (m_redeal > 4) emit newCardsPossible(false); return true; }
void Spider::restart( const QList<KCard*> & cards ) { m_pilesWithRuns.clear(); // make the redeal piles visible for (int i = 0; i < 5; ++i ) redeals[i]->setVisible( true ); // make the leg piles invisible for (int i = 0; i < 8; ++i ) legs[i]->setVisible( false ); recalculatePileLayouts(); m_leg = 0; m_redeal = 0; QList<KCard*> cardList = cards; int column = 0; // deal face down cards (5 to first 4 piles, 4 to last 6) for ( int i = 0; i < 44; ++i ) { addCardForDeal( stack[column], cardList.takeLast(), m_stackFaceup == 1, randomPos() ); column = (column + 1) % 10; } // deal face up cards, one to each pile for ( int i = 0; i < 10; ++i ) { addCardForDeal( stack[column], cardList.takeLast(), true, randomPos() ); column = (column + 1) % 10; } // deal the remaining cards into 5 'redeal' piles for ( int column = 0; column < 5; ++column ) for ( int i = 0; i < 10; ++i ) addCardForDeal( redeals[column], cardList.takeLast(), false, randomPos() ); startDealAnimation(); emit newCardsPossible(true); }
bool Grandf::newCards() { if ( numberOfDeals >= 3 ) return false; // NOTE: This is not quite correct. The piles should be turned face down // (i.e. partially reversed) during collection. QList<KCard*> collectedCards; for ( int pos = 6; pos >= 0; --pos ) { collectedCards << store[pos]->cards(); store[pos]->clear(); } deal( collectedCards ); takeState(); numberOfDeals++; if (numberOfDeals == 3) emit newCardsPossible(false); return true; }
void Spider::setGameState( const QString & state ) { int n = state.toInt(); int numLegs = n / 10; int numRedeals = n % 10; if ( numRedeals != m_redeal || numLegs != m_leg ) { m_redeal = numRedeals; for ( int i = 0; i < 5; ++i ) redeals[i]->setVisible( i >= m_redeal ); m_leg = numLegs; for ( int i = 0; i < 8; ++i ) legs[i]->setVisible( i < m_leg ); recalculatePileLayouts(); foreach ( KCardPile * p, piles() ) updatePileLayout( p, 0 ); emit newCardsPossible(m_redeal <= 4); } }
void Fortyeight::setGameState( const QString & state ) { lastdeal = state.toInt(); emit newCardsPossible( !lastdeal || !talon->isEmpty() ); }
void Grandf::restart( const QList<KCard*> & cards ) { deal( cards ); numberOfDeals = 1; emit newCardsPossible( true ); }
void Gypsy::setGameState( const QString & state ) { Q_UNUSED( state ) emit newCardsPossible(!talon->isEmpty()); }
void Gypsy::setGameState(const QString &) { emit newCardsPossible(!Deck::deck()->isEmpty()); }
void Fortyeight::setGameState( const QString &s ) { lastdeal = s.toInt(); emit newCardsPossible( !lastdeal || !Deck::deck()->isEmpty() ); }
void Grandf::setGameState( const QString & state ) { numberOfDeals = state.toInt(); emit newCardsPossible(numberOfDeals < 3); }
void Gypsy::restart() { Deck::deck()->collectAndShuffle(); deal(); emit newCardsPossible(true); }