-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokerEval.h
104 lines (96 loc) · 2.08 KB
/
pokerEval.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#ifndef POKEREVAL
#define POKEREVAL
#include <stdlib.h>
#include <emmintrin.h>
#include <smmintrin.h>
#include <immintrin.h>
#include <time.h>
#include <bitset>
#include <iostream>
#include <tgmath.h>
#include <vector>
enum Hand {
None = -1,
High_Card,
Pair,
Two_Pair,
Three_of_a_kind,
Straight,
Flush,
Full_house,
Four_of_a_kind,
Straight_Flush,
Royal_Flush
};
enum Suit {
Heart,
Spade,
Club,
Diamond
};
class PokerHand
{
public:
PokerHand();
~PokerHand();
void reset();
// Deal
void dealHand(int nCards);
void dealHand(std::string* dealtCards,int nCards);
void dealCard(std::string card,__m128i hand);
//Evaluate
Hand checkHand(__m128i hand);
__m128i m_hand;
//tests
void HighTest();
void PairTest();
void TwoPairTest();
void ThreeOfAKindTest();
void StraightTest();
void FlushTest();
void FullHouseTest();
void FourOfAKindTest();
void StraightFlushTest();
void RoyalFlushTest();
void statCheck(int handSize,float rounds);
// Helper
void printResult();
private:
//deal helper
uint translate(std::string card);
//functions
void checkRSCD(uint8_t nyble, int8_t index, int8_t& streak);
void checkFlush(int8_t& suit,int8_t index);
void checkStraightFlush(__m128i hnd, int high);
//lookups
void initLookups();
std::vector<const char*> cardFace;
std::vector<const char*> winHand;
// Hand value holders. Init to -1, if found replace with 0-12 card index of high card.
int8_t m_bHighCard;
std::pair<int8_t,int8_t> m_bTwoPair;
int8_t m_bThreeOfAKind;
int8_t m_bFlush; //if flush hold High
int8_t m_bStraight;
int8_t m_bFourOfAKind;
int8_t m_bStraightFlush;
//Flush's
int8_t heart;
int8_t spade;
int8_t club;
int8_t diamond;
//
Hand m_winner;
//
void initRand();
};
class Utils
{
public:
Utils();
~Utils();
static void printbits128(std::bitset<128> arr);
static void printbits128(unsigned long long arr, int h);
static void printbits128(__m128i a);
};
#endif