File indexing completed on 2024-05-12 04:04:51

0001 /*
0002  *  Copyright (C) 2010 Parker Coates <coates@kde.org>
0003  *
0004  *  This program is free software; you can redistribute it and/or
0005  *  modify it under the terms of the GNU General Public License as
0006  *  published by the Free Software Foundation; either version 2 of
0007  *  the License, or (at your option) any later version.
0008  *
0009  *  This program is distributed in the hope that it will be useful,
0010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  *  GNU General Public License for more details.
0013  *
0014  *  You should have received a copy of the GNU General Public License
0015  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016  *
0017  */
0018 
0019 #ifndef PILEUTILS_H
0020 #define PILEUTILS_H
0021 
0022 // Qt
0023 #include <QList>
0024 
0025 class KCard;
0026 
0027 bool isSameSuitAscending(const QList<KCard *> &cards);
0028 bool isSameSuitDescending(const QList<KCard *> &cards);
0029 bool isAlternateColorDescending(const QList<KCard *> &cards);
0030 bool isRankDescending(const QList<KCard *> &cards);
0031 int countSameSuitDescendingSequences(const QList<KCard *> &cards);
0032 
0033 bool checkAddSameSuitAscendingFromAce(const QList<KCard *> &oldCards, const QList<KCard *> &newCards);
0034 bool checkAddAlternateColorDescending(const QList<KCard *> &oldCards, const QList<KCard *> &newCards);
0035 bool checkAddAlternateColorDescendingFromKing(const QList<KCard *> &oldCards, const QList<KCard *> &newCards);
0036 
0037 extern QString suitToString(int s);
0038 extern QString rankToString(int r);
0039 extern QString cardToRankSuitString(const KCard *);
0040 extern void cardsListToLine(QString &output, const QList<KCard *> &cards);
0041 
0042 #endif