Brunot
Loading...
Searching...
No Matches
HandRating Class Reference

#include <HandRating.h>

Public Types

enum class  HandType : std::uint8_t {
  straight_flush = 'R' , quads = 'Q' , full_house = 'H' , flush = 'F' ,
  straight = 'S' , trips = 'T' , two_pair = '2' , pair = 'P' ,
  high_card = 'I' , nothing = 'N'
}

Static Public Member Functions

static auto getValueOfHandType (HandType handType) -> int
static auto Sort (PlayerHand &cards) -> void
 Sorts the cards in a player hand into ascending order.
static auto checkHand (const PlayerHand &playerCards) -> CategorizedHand
 Analyzes a given hand and determines what kind of HandType it is worth.
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.

Static Private Member Functions

static auto straightCheck (const PlayerHand &cards) -> bool
 Analyzes a given hand and determines if it contains a straight or not.
static auto flushCheck (const PlayerHand &cards) -> bool
 Analyzes a given hand and determines if it contains a flush or not.
static auto sameRankCheck (const PlayerHand &cards) -> CategorizedHand
 Checks how many cards have the same rank and determines the best HandType available.
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).

Member Enumeration Documentation

◆ HandType

enum class HandRating::HandType : std::uint8_t
strong
Enumerator
straight_flush 
quads 
full_house 
flush 
straight 
trips 
two_pair 
pair 
high_card 
nothing 

Member Function Documentation

◆ checkContribution()

auto HandRating::checkContribution ( const std::vector< Card >::const_iterator & begin,
const std::vector< Card >::const_iterator & end )->bool
staticprivate

Checks if the current player contributed to the hand (if a card in it was played this turn).

Parameters
beginThe start of the hand we want to check
endOne past the end of the hand we want to check
Returns
If a single card in the range was played this turn
Here is the call graph for this function:
Here is the caller graph for this function:

◆ checkHand()

auto HandRating::checkHand ( const PlayerHand & playerCards) ->CategorizedHand
static

Analyzes a given hand and determines what kind of HandType it is worth.

Returns
a struct that contains the HandType and the cards that contribute to it
Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckHands()

auto HandRating::CheckHands ( const std::vector< PlayerHand > & hands) ->std::vector< CategorizedHand >
static

Analyzes a given vector of hands and determines what kind of HandType it is worth.

Returns
a vector of categorized hands
Here is the call graph for this function:
Here is the caller graph for this function:

◆ flushCheck()

auto HandRating::flushCheck ( const PlayerHand & cards) ->bool
staticprivate

Analyzes a given hand and determines if it contains a flush or not.

Parameters
cardsThe hand you want to be analyzed
Returns
If the hand contains a flush
Here is the caller graph for this function:

◆ getValueOfHandType()

auto HandRating::getValueOfHandType ( HandType handType) ->int
static
Here is the caller graph for this function:

◆ sameRankCheck()

auto HandRating::sameRankCheck ( const PlayerHand & cards) ->CategorizedHand
staticprivate

Checks how many cards have the same rank and determines the best HandType available.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Sort()

auto HandRating::Sort ( PlayerHand & cards) ->void
static

Sorts the cards in a player hand into ascending order.

Parameters
cardsThe hand you want to be sorted
Here is the caller graph for this function:

◆ straightCheck()

auto HandRating::straightCheck ( const PlayerHand & cards) ->bool
staticprivate

Analyzes a given hand and determines if it contains a straight or not.

Parameters
cardsThe hand you want to be analyzed
Returns
If the hand contains a straight
Here is the caller graph for this function:

The documentation for this class was generated from the following files:
  • /home/egrazil/sites/Brunot/The House/source/Gameplay/Framework/HandRating.h
  • /home/egrazil/sites/Brunot/The House/source/Gameplay/Framework/HandRating.cpp