Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <stack>
- #include <utility>
- #include <chrono>
- using namespace std;
- using namespace std::chrono;
- using std::cout;
- using std::cin;
- using std::endl;
- using std::vector;
- typedef vector<int> VI;
- typedef vector<VI> VVI;
- void print(VI& a){
- for (int i : a){
- cout << i << " ";
- }
- }
- void print(VVI& a){
- for(VI x: a){
- print(x);
- }
- }
- const int CLUBS = 0;
- const int DIAMONDS = 1;
- const int HEARTS = 2;
- const int SPADES = 3;
- const int TWO = 0;
- const int THREE = 1;
- const int FOUR = 2;
- const int FIVE = 3;
- const int SIX = 4;
- const int SEVEN = 5;
- const int EIGHT = 6;
- const int NINE = 7;
- const int TEN = 8;
- const int JACK = 9;
- const int QUEEN = 10;
- const int KING = 11;
- const int ACE = 12;
- const int HIGH_CARD = 0;
- const int PAIR = 1;
- const int TWO_PAIR = 2;
- const int THREE_KIND = 3;
- const int STRAIGHT = 4;
- const int FLUSH = 5;
- const int FULL_HOUSE = 6;
- const int FOUR_KIND = 7;
- const int STRAIGHT_FLUSH = 8;
- void insertion_sort_hand(VVI& a){
- for(int j = 1; j < a.size(); ++j){
- VI t = a[j];
- //cout << j << ": t = " << t[0] << ", " << t[1] << std::endl;
- for (int i = j; i > 0 && a[i-1][0] > t[0]; --i){
- //cout << a[i-1][0] << " > " << t[0] << std::endl;
- a[i] = a[i - 1];
- a[i - 1] = t;
- //print(a);
- //cout << std::endl;
- }
- }
- }
- VI int_to_card(int card){
- int suit = card % 4;
- int rank = (card-suit) / 4;
- VI C0 = {rank, suit};
- return C0;
- }
- int card_to_int(VI& card){
- return 4*card[0] + card[1];
- }
- void print_card_names(VI& card){
- switch(card[0]){
- case 0:
- cout << "TWO of ";
- break;
- case 1:
- cout << "THREE of ";
- break;
- case 2:
- cout << "FOUR of ";
- break;
- case 3:
- cout << "FIVE of ";
- break;
- case 4:
- cout << "SIX of ";
- break;
- case 5:
- cout << "SEVEN of ";
- break;
- case 6:
- cout << "EIGHT of ";
- break;
- case 7:
- cout << "NINE of ";
- break;
- case 8:
- cout << "TEN of ";
- break;
- case 9:
- cout << "JACK of ";
- break;
- case 10:
- cout << "QUEEN of ";
- break;
- case 11:
- cout << "KING of ";
- break;
- case 12:
- cout << "ACE of ";
- break;
- default:
- cout << "INVALID RANK!";
- break;
- }
- switch(card[1]) {
- case 0:
- cout << "CLUBS ";
- break;
- case 1:
- cout << "DIAMONDS ";
- break;
- case 2:
- cout << "HEARTS ";
- break;
- case 3:
- cout << "SPADES ";
- break;
- default:
- cout << "INVALID SUIT";
- break;
- }
- }
- void print_card_values(VI& card){
- cout << "{" << card[0] << ", " << card[1] << "} ";
- }
- void print_hand_names(VVI& hand){
- for (auto i : hand){
- print_card_names(i);
- }
- cout << endl;
- }
- void print_hand_values (VVI& hand){
- for (auto i : hand){
- print_card_values(i);
- }
- cout << endl;
- }
- VVI convert_to_hand(int n){
- VVI hand;
- int C0 = n % 52;
- //cout << "c0 int: " << C0 << " => ";
- VI c0 = int_to_card(C0);
- //print_card(c0);
- //cout << endl;
- hand.push_back(c0);
- int C1 = n/52 % 52;
- //cout << "c1 int: " << C1 << " => ";
- VI c1 = int_to_card(C1);
- //print_card( c1);
- //cout << endl;
- hand.push_back(c1);
- int C2 = (n/(52*52)) % 52;
- //cout << "c2 int: " << C2 << " => ";
- VI c2 = int_to_card(C2);
- //print_card( c2);
- //cout << endl;
- hand.push_back(c2);
- int C3 = (n/(52*52*52)) % 52;
- //cout << "c3 int: " << C3 << " => ";
- VI c3 = int_to_card(C3);
- //print_card( c3);
- //cout << endl;
- hand.push_back(c3);
- int C4 = (n/(52*52*52*52)) % 52;
- //cout << "c4 int: " << C4 << " => ";
- VI c4 = int_to_card(C4);
- //print_card( c4);
- //cout << endl;
- hand.push_back(c4);
- return hand;
- }
- void test_cards(){
- for (int i = 0; i < 52; i++) {
- VI card = int_to_card(i);
- cout << i << " : ";
- print_card_names(card);
- cout << endl;
- }
- }
- bool is_four(VVI& hand){
- if (hand[0][0] == hand[1][0] && hand[1][0] == hand[2][0] && hand[2][0] == hand[3][0]){
- return true;
- }
- return hand[1][0] == hand[2][0] && hand[2][0] == hand[3][0] && hand[3][0] == hand[4][0];
- }
- bool is_flush(VVI& hand){
- int suit = hand[0][1];
- for (auto i: hand){
- if(i[1] != suit){
- return false;
- }
- }
- return true;
- }
- bool is_straight(VVI& hand) { //use second to last value later when valuing
- if (hand[0][0] == TWO && hand[1][0] == THREE && hand[2][0] == FOUR && hand[3][0] == FIVE && hand[4][0] == ACE){
- return true;
- }
- for (int i = 1; i < hand.size(); i++){
- /*print_card_names(hand[i]);
- cout << " ";
- print_card_names(hand[i-1]);
- cout << endl;
- cout << hand[i][0] << " " << hand[i-1][0] << endl;*/
- if (hand[i][0] - hand[i-1][0] != 1){
- return false;
- }
- }
- return true;
- }
- bool is_straightflush(VVI& hand){
- return is_straight(hand) && is_flush(hand);
- }
- bool is_full_house(VVI& hand){ //use middle element later when valuing
- if(!is_four(hand)) {
- if (hand[0][0] == hand[1][0] && hand[2][0] == hand[3][0] && hand[3][0] == hand[4][0]){
- return true;
- }
- if (hand[0][0] == hand[1][0] && hand[1][0] == hand[2][0] && hand[3][0] == hand[4][0]){
- return true;
- }
- }
- return false;
- }
- bool is_triple(VVI& hand){
- if(!is_full_house(hand) && !is_four(hand)){
- if (hand[0][0] == hand[1][0] && hand[1][0] == hand[2][0]){
- return true;
- }
- if (hand[1][0] == hand[2][0] && hand[2][0] == hand[3][0]){
- return true;
- }
- if (hand[2][0] == hand[3][0] && hand[3][0] == hand[4][0]){
- return true;
- }
- }
- return false;
- }
- bool is_two_pair(VVI& hand){
- if (!is_triple(hand) && !is_four(hand)){
- if (hand[0][0] == hand[1][0] && hand[2][0] == hand[3][0]){
- return true;
- }
- if (hand[0][0] == hand[1][0] && hand[3][0] == hand[4][0]){
- return true;
- }
- if (hand[1][0] == hand[2][0] && hand[3][0] == hand[4][0]){
- return true;
- }
- }
- return false;
- }
- bool is_pair(VVI& hand){
- if (!is_two_pair(hand) && !is_triple(hand) && !is_four(hand) && !is_full_house(hand)) {
- if (hand[0][0] == hand[1][0]) {
- return true;
- }
- if (hand[1][0] == hand[2][0]) {
- return true;
- }
- if (hand[2][0] == hand[3][0]) {
- return true;
- }
- if (hand[3][0] == hand[4][0]) {
- return true;
- }
- }
- return false;
- }
- bool is_high_card(VVI& hand){
- return !is_pair(hand) && !is_two_pair(hand) && !is_triple(hand) && !is_straight(hand) && !is_full_house(hand) &&
- !is_flush(hand) && !is_four(hand);
- }
- vector<bool> repetition_array(VVI& hand){
- vector<bool> repeated(hand.size());
- for (int i = 0; i < hand.size(); i++) {
- //cout << "Currently on position " << i << endl;
- for (int j = 0; j < hand.size(); j++) {
- if (j == i){
- continue;
- }
- if (hand[j][0] == hand[i][0]) {
- repeated[i] = true;
- }
- }
- }
- //for (int i = 0; i < repeated.size(); i++) {
- // cout << repeated[i] << " ";
- //}
- //cout << endl;
- return repeated;
- }
- VVI get_unique_cards(VVI& hand){
- VVI unique_elts;
- vector<bool> repeated = repetition_array(hand);
- for (int i = 0; i < repeated.size(); i++){
- if (!repeated[i]){
- unique_elts.push_back(hand[i]);
- }
- }
- //print_hand_names(unique_elts);
- return unique_elts;
- }
- VVI get_repeated_cards(VVI& hand){
- VVI repeated_elts;
- vector<bool> repeated = repetition_array(hand);
- for (int i = 0; i < repeated.size(); i++){
- if (repeated[i]){
- repeated_elts.push_back(hand[i]);
- }
- }
- //print_hand_names(repeated_elts);
- return repeated_elts;
- }
- VI get_high_unique_card(VVI& hand){
- bool repeated[hand.size()-1];
- insertion_sort_hand(hand);
- //print_hand_names(hand);
- VI highest_unique = hand[0];
- //cout << "Initial: ";
- //print_card_names(highest_unique);
- //cout << endl;
- for (auto i: get_unique_cards(hand)){
- if (i[0] > highest_unique[0]){
- highest_unique = i;
- }
- }
- //cout << "Results: ";
- //print_card_names(highest_unique);
- //cout << endl;
- return highest_unique;
- }
- VI get_high_card(VVI& hand){
- insertion_sort_hand(hand);
- return hand[hand.size()-1];
- }
- int get_high_unique_rank(VVI& hand){
- return get_high_unique_card(hand)[0];
- }
- int get_high_rank(VVI& hand){
- return get_high_card(hand)[0];
- }
- int classify(VVI& hand){
- insertion_sort_hand(hand);
- if(is_straightflush(hand)){
- //cout << "STRAIGHT_FLUSH "; //<< endl;
- return STRAIGHT_FLUSH;
- }
- if(is_four(hand)){
- //cout << "FOUR_KIND "; // << endl;
- return FOUR_KIND;
- }
- if(is_full_house(hand)){
- //cout << "FULL_HOUSE "; // << endl;
- return FULL_HOUSE;
- }
- if(is_flush(hand)){
- //cout << "FLUSH "; // << endl;
- return FLUSH;
- }
- if(is_straight(hand)){
- //cout << "STRAIGHT "; // << endl;
- return STRAIGHT;
- }
- if(is_triple(hand)){
- //cout << "THREE_KIND "; // << endl;
- return THREE_KIND;
- }
- if(is_two_pair(hand)){
- // cout << "TWO_PAIR "; // << endl;
- return TWO_PAIR;
- }
- if(is_pair(hand)){
- //cout << "PAIR "; // << endl;
- return PAIR;
- }
- if(is_high_card(hand)){
- //cout << "HIGH_CARD "; // << endl;
- return HIGH_CARD;
- }
- cout << "ERROR"; // << endl;
- return -1;
- }
- int eval(VVI& hand1, VVI& hand2){
- int eval = classify(hand1) - classify(hand2);
- //cout << endl;
- if (eval == 0) {
- //cout << "Same rank of hand. Proceeding to secondary classification." << endl;
- if (is_high_card(hand1)){
- //cout << "IS HIGH_CARD!" << endl;
- VVI hand1Copy = hand1;
- VVI hand2Copy = hand2;
- while (get_high_unique_rank(hand1Copy) == get_high_unique_rank(hand2Copy)){
- hand1Copy.erase(hand1Copy.begin()+hand1Copy.size());
- hand2Copy.erase(hand2Copy.begin()+hand2Copy.size());
- }
- return get_high_unique_rank(hand1Copy) - get_high_unique_rank(hand2Copy);
- }
- if (is_pair(hand1)){
- //cout << "IS PAIR!" << endl;
- VVI repeated_elts_1 = get_repeated_cards(hand1);
- VVI repeated_elts_2 = get_repeated_cards(hand2);
- VVI unique_elts_1 = get_unique_cards(hand1);
- VVI unique_elts_2 = get_unique_cards(hand2);
- if (get_high_rank(repeated_elts_1) == get_high_rank(repeated_elts_2)){
- return get_high_unique_rank(unique_elts_1) - get_high_unique_rank(unique_elts_2);
- }
- return get_high_unique_rank(repeated_elts_1) - get_high_unique_rank(repeated_elts_2);
- }
- if (is_two_pair(hand1)){
- //cout << "IS TWO_PAIR!" << endl;
- VVI repeated_elts_1 = get_repeated_cards(hand1);
- VVI repeated_elts_2 = get_repeated_cards(hand2);
- VVI unique_elts_1 = get_unique_cards(hand1);
- VVI unique_elts_2 = get_unique_cards(hand2);
- if (get_high_rank(repeated_elts_1) == get_high_rank(repeated_elts_2)){
- if (repeated_elts_1[0][0] == repeated_elts_2[0][0]) {
- return get_high_unique_rank(unique_elts_1) - get_high_unique_rank(unique_elts_2);
- } else {
- return repeated_elts_1[0][0] - repeated_elts_2[0][0];
- }
- }
- return get_high_rank(repeated_elts_1) - get_high_rank(repeated_elts_2);
- }
- if (is_triple(hand1)){
- //cout << "IS THREE_KIND!" << endl;
- VVI repeated_elts_1 = get_repeated_cards(hand1);
- VVI repeated_elts_2 = get_repeated_cards(hand2);
- VVI unique_elts_1 = get_unique_cards(hand1);
- VVI unique_elts_2 = get_unique_cards(hand2);
- if (get_high_rank(repeated_elts_1) == get_high_rank(repeated_elts_2)){
- return get_high_unique_rank(unique_elts_1) - get_high_unique_rank(unique_elts_2);
- }
- return get_high_rank(repeated_elts_1) - get_high_rank(repeated_elts_2);
- }
- if(is_straight(hand1)){
- //cout << "IS STRAIGHT!" << endl;
- return get_high_unique_rank(hand1) - get_high_unique_rank(hand2);
- }
- if (is_flush(hand1)){
- //cout << "IS FLUSH!" << endl;
- VVI hand1Copy = hand1;
- VVI hand2Copy = hand2;
- while (get_high_unique_rank(hand1Copy) == get_high_unique_rank(hand2Copy)){
- hand1Copy.erase(hand1Copy.begin()+hand1Copy.size());
- hand2Copy.erase(hand2Copy.begin()+hand2Copy.size());
- }
- return get_high_unique_rank(hand1Copy) - get_high_unique_rank(hand2Copy);
- }
- if (is_full_house(hand1)){
- //cout << "IS FULL HOUSE!" << endl;
- VVI hand1Copy = hand1;
- VVI hand2Copy = hand2;
- int rank_triple = get_high_rank(hand1Copy);
- if (get_high_rank(hand2Copy) == rank_triple){
- for (int i = 0; i < 5; i++){
- if (hand1Copy[i][0] == rank_triple){
- hand1Copy.erase(hand1Copy.begin()+i);
- }
- if(hand2Copy[i][0] == rank_triple){
- hand2Copy.erase(hand2Copy.begin()+i);
- }
- }
- return hand1Copy[0][0] - hand2Copy[0][0];
- }
- return rank_triple - get_high_rank(hand2Copy);
- }
- if (is_four(hand1)){
- //cout << "IS_FOUR!" << endl;
- VVI repeated_elts_1 = get_repeated_cards(hand1);
- VVI repeated_elts_2 = get_repeated_cards(hand2);
- VVI unique_elts_1 = get_unique_cards(hand1);
- VVI unique_elts_2 = get_unique_cards(hand2);
- if (get_high_rank(repeated_elts_1) == get_high_rank(repeated_elts_2)){
- //cout << "Rank of FOUR_KINDs are equal." << endl;
- return get_high_unique_rank(unique_elts_1) - get_high_unique_rank(unique_elts_2);
- }
- //cout << "Rank of FOUR_KINDs are different." << endl;
- return get_high_rank(repeated_elts_1) - get_high_rank(repeated_elts_2);
- }
- if (is_straightflush(hand1)) {
- //cout << "IS STRAIGHT FLUSH!" << endl;
- return get_high_unique_rank(hand1) - get_high_unique_rank(hand2);
- }
- }
- return eval;
- }
- int compareTo(int a, int b){
- VVI handA = convert_to_hand(a);
- VVI handB = convert_to_hand(b);
- return eval(handA, handB);
- }
- void test_insertion(int h){
- VVI hand = convert_to_hand(h);
- insertion_sort_hand(hand);
- print_hand_names(hand);
- }
- void test_identify(int a) {
- VVI hand = convert_to_hand(a);
- cout << "HIGH_CARD: " << is_high_card(hand) << " PAIR: " << is_pair(hand) << " TWO_PAIR: " << is_two_pair(hand) <<
- " THREE_KIND: " << is_triple(hand) << " FULL_HOUSE: " << is_full_house(hand) << " FOUR_KIND: " << is_four(hand) << endl;
- }
- void test_eval(int a, int b){
- VVI handa = convert_to_hand(a);
- VVI handb = convert_to_hand(b);
- print_hand_values(handa);
- print_hand_values(handb);
- print_hand_names(handa);
- print_hand_names(handb);
- cout << eval(handa, handb);
- }
- bool isSorted_poker(VI& a){
- for (int i = 1; i < a.size(); i++){
- if (compareTo(a[i], a[i - 1]) < 0) return false;
- }
- return true;
- }
- bool isSorted_int(VI& a){
- for (int i = 1; i < a.size(); i++){
- if (a[i] < a[i - 1]) return false;
- }
- return true;
- }
- void swap(VI& a, int from, int to){
- int temp = a[from];
- a[from] = a[to];
- a[to] = temp;
- }
- int median_of_3_poker(VI& a, int lo, int hi){
- int l = a[lo];
- int h = a[hi];
- int mid = (lo + hi)/2;
- int m = a[mid];
- cout << "Taking median of " << l << " " << h << " " << m << endl;
- if (compareTo(l, m) < 0 && compareTo(m, h) < 0){
- return m;
- }
- if (compareTo(h, m) < 0 && compareTo(m, l) < 0){
- return m;
- }
- if (compareTo(m, l) < 0 && compareTo(l, h) < 0){
- return l;
- }
- if (compareTo(h, l) < 0 && compareTo(l, m) < 0){
- return l;
- }
- return h;
- }
- int qs3_Partition_poker(VI& a, int lo, int hi) {
- int x = median_of_3_poker(a, lo, hi); //Coffee choice of partition
- //cout << endl;
- cout << "Choice of partition element is: " << x << " and lo is: " << lo << " and hi is: " << hi << endl;
- while (lo < hi) {
- while (compareTo(a[lo], x) < 0){
- cout << "Comparing " << a[lo] << " and " << x << " yielding: " << compareTo(a[lo], x) << endl;
- ++lo;
- }
- while (compareTo(a[hi], x) > 0){
- cout << "Comparing " << a[hi] << " and " << x << " yielding: " << compareTo(a[hi], x) << endl;
- --hi;
- }
- if (lo < hi) {
- cout << "Swapping " << a[lo] << " and " << a[hi] << endl;
- swap(a, lo, hi);
- if (compareTo(a[lo], a[hi] == 0)){
- lo++;
- }
- print(a);
- cout << endl;
- cout << "lo is: " << lo << " and hi is: " << hi << endl;
- }
- }
- //print(a);
- //cout << endl;
- return lo;
- }
- int THRESHOLD_poker = 4;
- void qs4_poker (VI& a, int lo, int hi) {
- while (hi - lo > THRESHOLD_poker) { //THRESHOLD from 30 years ago was 20, experiment!
- while (lo < hi) {
- int m = qs3_Partition_poker(a, lo, hi);
- if (m - lo < hi - m + 1) {
- qs4_poker(a, lo, m - 1);
- lo = m;
- } else {
- qs4_poker(a , m , hi);
- hi = m - 1;
- }
- }
- }
- }
- void insertion_sort_poker(vector<int>& a){
- for(int j = 1; j < a.size(); ++j){
- int t = a[j];
- //cout << j << ": t = " << t << std::endl;
- for (int i = j; i > 0 && compareTo(a[i-1], t) >= 0; --i){
- //cout << a[i-1] << " >= " << t << std::endl;
- a[i] = a[i - 1];
- a[i - 1] = t;
- //print(a, n);
- //cout << std::endl;
- }
- }
- }
- void insertion_sort_int(vector<int>& a){
- for(int j = 1; j < a.size(); ++j){
- int t = a[j];
- //cout << j << ": t = " << t << std::endl;
- for (int i = j; i > 0 && a[i-1] >= t; --i){
- //cout << a[i-1] << " >= " << t << std::endl;
- a[i] = a[i - 1];
- a[i - 1] = t;
- //print(a, n);
- //cout << std::endl;
- }
- }
- }
- void poker_sort (VI& a, int n) {
- qs4_poker(a, 0, n-1);
- //print(a);
- insertion_sort_poker(a);
- }
- int median_of_3(VI& a, int lo, int hi){
- int l = a[lo];
- int h = a[hi];
- int mid = (lo + hi)/2;
- int m = a[mid];
- //cout << "Taking median of " << l << " " << h << " " << m << endl;
- if (l < m && m < h){
- return m;
- }
- if (h < m && m < l){
- return m;
- }
- if (m < l && l < h){
- return l;
- }
- if (h < l && l < m){
- return l;
- }
- return h;
- }
- int qs3_Partition(VI& a, int lo, int hi) {
- int x = median_of_3(a, lo, hi); //Coffee choice of partition
- //cout << endl;
- //cout << "Choice of partition element is: " << x << " and lo is: " << lo << " and hi is: " << hi << endl;
- while (lo < hi) {
- while (a[lo] < x){
- //cout << "Comparing " << a[lo] << " and " << x << " yielding: " << compareTo(a[lo], x) << endl;
- ++lo;
- }
- while (a[hi] > x){
- //cout << "Comparing " << a[hi] << " and " << x << " yielding: " << compareTo(a[hi], x) << endl;
- --hi;
- }
- if (lo < hi) {
- //cout << "Swapping " << a[lo] << " and " << a[hi] << endl;
- swap(a, lo, hi);
- /*int temp = a[lo];
- a[lo++] = a[hi];
- a[hi--] = temp;*/
- if (a[lo] == a[hi]){
- lo++;
- }
- //print(a);
- //cout << endl;
- //cout << "lo is: " << lo << " and hi is: " << hi << endl;
- }
- }
- //print(a);
- //cout << endl;
- return lo;
- }
- int THRESHOLD = 4;
- void qs4 (VI& a, int lo, int hi) {
- while (hi - lo > THRESHOLD) { //THRESHOLD from 30 years ago was 20, experiment!
- while (lo < hi) {
- int m = qs3_Partition(a, lo, hi);
- if (m - lo < hi - m + 1) {
- qs4(a, lo, m - 1);
- lo = m;
- } else {
- qs4(a , m , hi);
- hi = m - 1;
- }
- }
- }
- }
- void quick_sortCh (VI& a, int n) {
- qs4(a, 0, n-1);
- //print(a);
- insertion_sort_int(a);
- }
- void test_compare(int a, int b){
- VVI hand1 = convert_to_hand(a);
- VVI hand2 = convert_to_hand(b);
- insertion_sort_hand(hand1);
- insertion_sort_hand(hand2);
- print_hand_names(hand1);
- print_hand_names(hand2);
- cout << compareTo(a, b) << endl;
- }
- void test_quickSort(){
- srand(47);
- VI arr(10);
- //for (int & i : arr){
- //i = rand();
- // }
- arr = {228196026, 131205167, 368581579, 364747487, 179217708, 210864963, 240869247, 245896757, 331464223, 31677864,
- 4962899, 188558391, 70622447, 241845383, 40471450, 279904260, 83904058, 227541576, 241955757, 341082141,
- 112304018, 338619531, 352453177, 264113193, 53734509, 200145464, 316825830, 127852582, 187686961, 286780086};
- print(arr);
- cout << endl;
- for (int i = 0; i < arr.size(); i++){
- test_compare(arr[i], arr[i+1]);
- }
- cout << endl;
- cout << isSorted_poker(arr) << std::endl;
- //cout << median_of_3_poker(arr, 0, arr.size()-1) << endl;
- //cout << qs3_Partition(arr, 0, arr.size()-1) << " Partitioning complete." << std::endl;
- poker_sort(arr, arr.size());
- cout << isSorted_poker(arr) << endl;
- //print(arr);
- }
- void time_Sort(){
- vector<int> v;
- srand(47);
- for (int i = 0; i < 50; ++i) {
- int x = rand();
- v.push_back(x);
- }
- auto start = high_resolution_clock::now();
- poker_sort (v, v.size());
- auto stop = high_resolution_clock::now();
- auto duration = duration_cast<microseconds>(stop-start);
- cout << "time: " << duration.count() << "\n";
- }
- int main() {
- time_Sort();
- //VVI hand = convert_to_hand(38132284);
- //test_quickSort();
- //test_cards();
- //print_hand_names(hand);
- //print_hand_values(hand);
- //test_insertion(96611262);
- //test_eval(38132284, 29673748);
- //cout << endl;
- //VI high_card = get_high_card(hand);
- //print_card_names(high_card);
- //test_compare( 245896757, 331464223);
- };
Add Comment
Please, Sign In to add comment