Exemple #1
0
MoveHint *YukonSolver::translateMove( const MOVE &m )
{
    Pile *frompile = 0;
    frompile = deal->store[m.from];

    Card *card = frompile->at( frompile->cardsLeft() - m.card_index - 1);

    if ( m.totype == O_Type )
    {
        Pile *target = 0;
        Pile *empty = 0;
        for (int i = 0; i < 4; i++) {
            Card *c = deal->target[i]->top();
            if (c) {
                if ( c->suit() == card->suit() )
                {
                    target = deal->target[i];
                    break;
                }
            } else if ( !empty )
                empty = deal->target[i];
        }
        if ( !target )
            target = empty;
        return new MoveHint( card, target, m.pri );
    } else {
        return new MoveHint( card, deal->store[m.to], m.pri );
    }
}
Exemple #2
0
Pile<T>& Pile<T>::pileResultat() const{
    Pile<T> p = this->clone();
    Pile<T> res;
    for(int i=0;i<p.size();i++) {
        if(p.at(i).isOperateur()) {
            if(p.at(i).isBinaire()) {
                p.DROP();
                p.DROP();
                p.DROP();
            }
            else { // unaire
                p.DROP();
                p.DROP();
            }
        }
        else {
            res.addPile(p.pop());
        }
    }
    delete p;
    Pile<T>& ref = res;
    return ref;
}
Exemple #3
0
MoveHint *IdiotSolver::translateMove( const MOVE &m )
{
    if ( m.from >=4 )
        return 0;
    Pile *frompile = deal->m_play[m.from];

    Card *card = frompile->at( frompile->cardsLeft() - m.card_index - 1);
    Q_ASSERT( card );

    Pile *target = 0;
    if ( m.to == 5 )
        target = deal->m_away;
    else
        target = deal->m_play[m.to];

    return new MoveHint( card, target, m.pri );
}