summaryrefslogtreecommitdiffstats
path: root/sorthand.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sorthand.cpp')
-rw-r--r--sorthand.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/sorthand.cpp b/sorthand.cpp
new file mode 100644
index 0000000..8445e7f
--- /dev/null
+++ b/sorthand.cpp
@@ -0,0 +1,38 @@
+/*
+ * sorthand.cpp
+ *
+ *
+ */
+
+#include "sorthand.h"
+
+SortHand::SortHand()
+{
+
+}
+
+void sortFourOfAKind(Card **cards, struct countAndType *maxCount)
+{
+ int i;
+ /* find the card that is different from other four */
+ for (i = 0; i < 5; i++)
+ if (cards[i]->getRank() != maxCount->type)
+ break;
+
+#ifdef DEBUG
+ cout << ANSI_COLOR_CYAN << "\ndebug: sortFourOfAKind(): " << cards[i]->getType()
+ << " is different from other 4 cards" << endl << ANSI_COLOR_RESET;
+#endif
+
+ /* put that card at the end */
+ Card *tmp = cards[i];
+
+ cards[4] = cards[i];
+ cards[i] = tmp;
+}
+
+void sortFullHouse(Card **cards, struct countAndType *threeCount)
+{
+
+}
+