Moved winning hand solver code to player.c

This commit is contained in:
2021-06-24 15:06:13 -07:00
parent 87ef9c5934
commit 2b772816d8
5 changed files with 263 additions and 235 deletions

View File

@ -57,6 +57,22 @@
#define POKER_TURN_CARD_COUNT 1
#define POKER_RIVER_CARD_COUNT 1
/** Winning Types */
#define POKER_WINNING_TYPE_ROYAL_FLUSH 0x01
#define POKER_WINNING_TYPE_STRAIGHT_FLUSH 0x02
#define POKER_WINNING_TYPE_FOUR_OF_A_KIND 0x03
#define POKER_WINNING_TYPE_FULL_HOUSE 0x04
#define POKER_WINNING_TYPE_FLUSH 0x05
#define POKER_WINNING_TYPE_STRAIGHT 0x06
#define POKER_WINNING_TYPE_THREE_OF_A_KIND 0x07
#define POKER_WINNING_TYPE_TWO_PAIR 0x08
#define POKER_WINNING_TYPE_PAIR 0x09
#define POKER_WINNNIG_TYPE_HIGH_CARD 0x0A
/** How many cards make a winning set */
#define POKER_WINNING_SET_SIZE 5
typedef struct {
//////////////////////////////////////////////////////////////////////////////
// Poker Logic Variables
@ -137,4 +153,18 @@ typedef struct {
texture_t cardTexture;
tileset_t cardTileset;
primitive_t cardPrimitive;
} poker_t;
} poker_t;
/** Holds information about the winning player state */
typedef struct {
/** The full set of both the dealer and player's hand */
card_t full[POKER_PLAYER_HAND + POKER_DEALER_HAND];
uint8_t size;
/** Holds the winning set */
int32_t set[POKER_WINNING_SET_SIZE];
uint8_t count;
/** Winning Type */
uint8_t type;
} pokerwinning_t;