summaryrefslogtreecommitdiffstats
path: root/card.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'card.cpp')
-rw-r--r--card.cpp54
1 files changed, 54 insertions, 0 deletions
diff --git a/card.cpp b/card.cpp
index f100e1c..5bb1a56 100644
--- a/card.cpp
+++ b/card.cpp
@@ -78,6 +78,60 @@ void Card::rankCard(void)
}
}
+/* rank value that will be used by a sorting algorithm to put cards such as a
+ * pair, two pair, three of a kind, four of a kind, or full house all the way
+ * to the left, SortHand will set these attributes when necessary and call sort */
+void Card::specialRank(void)
+{
+ char c;
+ c = getType()[0];
+
+ switch (c)
+ {
+ case 'A':
+ rank = -13;
+ break;
+ case 'K':
+ rank = -12;
+ break;
+ case 'Q':
+ rank = -11;
+ break;
+ case 'J':
+ rank = -10;
+ break;
+ case 'T':
+ rank = -9;
+ break;
+ case '9':
+ rank = -8;
+ break;
+ case '8':
+ rank = -7;
+ break;
+ case '7':
+ rank = -6;
+ break;
+ case '6':
+ rank = -5;
+ break;
+ case '5':
+ rank = -4;
+ break;
+ case '4':
+ rank = -3;
+ break;
+ case '3':
+ rank = -2;
+ break;
+ case '2':
+ rank = -1;
+ break;
+ default:
+ std::cerr << "something went wrong while special ranking a card" << endl;
+ }
+}
+
int Card::getRank(void)
{
return rank;