Brunot
Loading...
Searching...
No Matches
HandRating.h
Go to the documentation of this file.
1
12// ____ __ __ __
13// /\__ _\/\ \ /\ \/\ \
14// \/_/\ \/\ \ \___ __ \ \ \_\ \ ___ __ __ ____ __
15// \ \ \ \ \ _ `\ /'__`\ \ \ _ \ / __`\/\ \/\ \ /',__\ /'__`\
16// \ \ \ \ \ \ \ \/\ __/ \ \ \ \ \/\ \L\ \ \ \_\ \/\__, `\/\ __/
17// \ \_\ \ \_\ \_\ \____\ \ \_\ \_\ \____/\ \____/\/\____/\ \____\
18// \/_/ \/_/\/_/\/____/ \/_/\/_/\/___/ \/___/ \/___/ \/____/
19
20
21#pragma once
22#include "Framework/System.h"
23#include "Component/Card.h"
24
25struct CategorizedHand;
26
27struct PlayerHand;
28
30{
31
32public:
33 // Enum of all possible hand types
34 enum class HandType : std::uint8_t
35 {
37 quads = 'Q', // Four of a kind
39 flush = 'F',
40 straight = 'S',
41 trips = 'T', // Three of a kind
42 two_pair = '2',
43 pair = 'P',
44 high_card = 'I',
45 nothing = 'N'
46 };
47
48 static auto getValueOfHandType(HandType handType) -> int;
49
54 static auto Sort(PlayerHand& cards) -> void;
55
60 static auto checkHand(const PlayerHand& playerCards) -> CategorizedHand;
61
66 static auto CheckHands(const std::vector<PlayerHand>& hands) -> std::vector<CategorizedHand>;
67
68private:
74 static auto straightCheck(const PlayerHand& cards) -> bool;
75
81 static auto flushCheck(const PlayerHand& cards) -> bool;
82
86 static auto sameRankCheck(const PlayerHand& cards) -> CategorizedHand;
87
94 static auto checkContribution(const std::vector<Card>::const_iterator& begin,
95 const std::vector<Card>::const_iterator& end) -> bool;
96
97};
The card component that is moved around on the board.
Definition HandRating.h:30
static auto Sort(PlayerHand &cards) -> void
Sorts the cards in a player hand into ascending order.
Definition HandRating.cpp:73
static auto checkContribution(const std::vector< Card >::const_iterator &begin, const std::vector< Card >::const_iterator &end) -> bool
Checks if the current player contributed to the hand (if a card in it was played this turn).
Definition HandRating.cpp:340
static auto flushCheck(const PlayerHand &cards) -> bool
Analyzes a given hand and determines if it contains a flush or not.
Definition HandRating.cpp:163
HandType
Definition HandRating.h:35
@ trips
Definition HandRating.h:41
@ full_house
Definition HandRating.h:38
@ pair
Definition HandRating.h:43
@ quads
Definition HandRating.h:37
@ straight
Definition HandRating.h:40
@ nothing
Definition HandRating.h:45
@ straight_flush
Definition HandRating.h:36
@ flush
Definition HandRating.h:39
@ two_pair
Definition HandRating.h:42
@ high_card
Definition HandRating.h:44
static auto checkHand(const PlayerHand &playerCards) -> CategorizedHand
Analyzes a given hand and determines what kind of HandType it is worth.
Definition HandRating.cpp:82
static auto sameRankCheck(const PlayerHand &cards) -> CategorizedHand
Checks how many cards have the same rank and determines the best HandType available.
Definition HandRating.cpp:180
static auto getValueOfHandType(HandType handType) -> int
Definition HandRating.cpp:68
static auto CheckHands(const std::vector< PlayerHand > &hands) -> std::vector< CategorizedHand >
Analyzes a given vector of hands and determines what kind of HandType it is worth.
Definition HandRating.cpp:127
static auto straightCheck(const PlayerHand &cards) -> bool
Analyzes a given hand and determines if it contains a straight or not.
Definition HandRating.cpp:138
Definition CategorizedHand.h:31
Definition HandFinder.h:20