C# Class HoldemHand.Hand

Represents a Texas Holdem Hand
Inheritance: IComparable
Mostrar archivo Open project: Ezakhiel/Donate-Money-For-Unicorns-ubbse2015 Class Usage Examples

Public Properties

Property Type Description
CLUB_OFFSET int
CardJoker int
CardMasksTable ulong[]
CardTable string[]
Clubs int
DIAMOND_OFFSET int
Diamonds int
HEART_OFFSET int
Hearts int
NCardsWJoker int
NumberOfCards int
Rank2 int
Rank3 int
Rank4 int
Rank5 int
Rank6 int
Rank7 int
Rank8 int
Rank9 int
RankAce int
RankJack int
RankKing int
RankQueen int
RankTen int
SPADE_OFFSET int
Spades int
TwoCardMaskTable ulong[]
TwoCardMaskTableSize int
nBitsAndStrTable UInt16[]

Public Methods

Method Description
BitCount ( ulong bitField ) : int

Count Bits. Optimized for cards so only works with 52 bits.

CardRank ( int card ) : int

Given a card value, returns it's rank

CardSuit ( int card ) : int

Given a card value, returns it's suit

Cards ( ulong mask ) : IEnumerable

This method allows a foreach statement to iterate through each card in a card mask.

CompareTo ( object obj ) : int

Used to compare one mask to another. This method allows normal compare functions to work as expected with a mask.

CountContiguous ( ulong mask ) : int

Returns the count of adjacent cards

CountContiguous ( ulong pocket, ulong board ) : int

Returns the count of adjacent cards

DescriptionFromHand ( string mask ) : string

Takes an string describing a mask and returns the description.

DescriptionFromHandValueInternal ( uint handValue ) : string
DescriptionFromMask ( ulong cards ) : string

Evaluates a hand and returns a descriptive string.

DetailedOddsWithMultiplePlayers ( string pocket, string board, ulong dead, int playerCount, double &playerodds, double &oppodds, double duration ) : void

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the amount of time allowed for the simulation.

DetailedOddsWithMultiplePlayers ( string pocket, string board, ulong dead, int playerCount, double &playerodds, double &oppodds, int trials ) : void

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the number of trials.

DetailedOddsWithMultiplePlayers ( ulong pocket, ulong board, ulong dead, int playerCount, double &playerodds, double &oppodds, double duration ) : void

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the amount of time allowed for the simulation.

DetailedOddsWithMultiplePlayers ( ulong pocket, ulong board, ulong dead, int playerCount, double &playerodds, double &oppodds, int trials ) : void

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the number of trials.

DrawCount ( string player, string board, string dead, Hand type ) : int

The method returns the number of draws that are possible for the specified HandType.

DrawCount ( ulong mask, ulong dead, Hand type ) : int

The method returns the number of draws that are possible for the specified HandType. Note that DrawCount(pocket, board, dead, type) is not necessarily the same as DrawCount(pocket | board, dead, type). This method returns all possible draws that are the same as the requested type.

DrawCount ( ulong player, ulong board, ulong dead, Hand type ) : int

The method returns the number of draws that are possible for the specified HandType. This method only returns the counts that improve the player's mask rather than just the board. Because of this subtle distinction, DrawCount(player, board, dead, type) doesn't necessarily return the same value as DrawCount(player | board, dead, type).

Equals ( object obj ) : bool

Test for equality

Evaluate ( string mask ) : uint

Evaluates a mask (passed as a string) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.

Evaluate ( ulong cards ) : uint

Evaluates a mask (passed as a mask mask) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.

Evaluate ( ulong cards, int nCards ) : uint

Evaluates a mask (passed as a mask mask) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.

EvaluateType ( ulong mask ) : HandTypes

Evaluates the card mask and returns the type of mask it is. This function is faster (but provides less information) than Evaluate or Evaluate.

EvaluateType ( ulong mask, int cards ) : HandTypes

This function is faster (but provides less information) than Evaluate or Evaluate.

FlushDrawCount ( ulong mask, ulong dead ) : int

Counts the number of hands that are a flush with one more drawn card.

FlushDrawCount ( ulong player, ulong board, ulong dead ) : int

Counts the number of hands that are a flush with one more drawn card. However, Flush hands that only improve the board are not considered.

GapCount ( ulong mask ) : int

Counts the number of empty space between adjacent cards. 0 means connected, 1 means a gap of one, 2 means a gap of two and 3 means a gap of three. This method calculates the results. Because of that equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.

GetHashCode ( ) : int

Returns hash code

Hand ( ) : System

Default constructor

Hand ( string pocket, string board ) : System

Constructor

HandDistance ( ulong pocket, ulong board ) : long

This method returns the mask distance from the best possible mask given this board (no draws are considered). The value 0 is the best possible mask. The value 1 is the next best mask and so on.

HandPlayerMultiOpponentOdds ( ulong ourcards, ulong board, int numOpponents, double duration, double &player, double &opponent ) : void

HandPotential ( string pockethand, string boardhand, double &ppot, double &npot, int NOpponents, double duration ) : void

This method is similar to the HandPotential algorithm described in Aaron Davidson's masters thesis, however if differs in several significant ways. First, it makes the calculation while accounting for one or more opponents. Second, it uses the Monte Carlo technique to get answers in a reasonable amount of time (a duration of 0.1 seems to give reasonable results). And finally, the results are not normalized; the positive and negative potential is the actual odds of improvement or worsening of a mask.

HandPotential ( ulong pocket, ulong board, double &ppot, double &npot ) : void

Returns the normalized, positive and negative potential of the current mask. This funciton is described in Aaron Davidson's masters thesis on page 23.

HandPotential ( ulong pocket, ulong board, double &ppot, double &npot, int NOpponents, double duration ) : void

This method is similar to the HandPotential algorithm described in Aaron Davidson's masters thesis, however if differs in several significant ways. First, it makes the calculation while accounting for one or more opponents. Second, it uses the Monte Carlo technique to get answers in a reasonable amount of time (a duration of 0.1 seems to give reasonable results). And finally, the results are not normalized; the positive and negative potential is the actual odds of improvement or worsening of a mask.

HandStrength ( string pocketquery, string board, int NOpponnents, double duration ) : double

A HandStrength function that accounts for multiple opponents. This method uses the Monte Carlo menthod to calculate a value. It takes surprisingly little time to get good results. A duration of 0.01 seconds (10mS) returns good results, and a duration of 0.1 (100mS) returns even better results.

HandStrength ( ulong pocket, ulong board ) : double

The classic HandStrengh Calculation from page 21 of Aaron Davidson's Masters Thesis.

HandStrength ( ulong pocket, ulong board, int NOpponnents, double duration ) : double

HandType ( uint handValue ) : uint
HandWinOdds ( ulong ourcards, ulong oppcards, ulong board, double &player, double &opponent ) : bool

HandWinOdds ( string pocketcards, string boardcards, double &player, double &opponent ) : void

Given a set of pocket cards and a set of board cards this function returns the odds of winning or tying for a player and a random opponent.

HandWinOdds ( string ourcards, string board, double &player, double &opponent, int NOpponents, double duration ) : void

This method calculates the probablity of a player winning with specific hands and opponents winning with specific hands.

HandWinOdds ( string pockets, string board, string dead, long wins, long ties, long losses, long &totalHands ) : void

Used to calculate the wining information about each players mask. This function enumerates all possible remaining hands and tallies win, tie and losses for each player. This function typically takes well less than a second regardless of the number of players.

HandWinOdds ( ulong ourcards, ulong board, double &player, double &opponent ) : void

Given a set of pocket cards and a set of board cards this function returns the odds of winning or tying for a player and a random opponent.

HandWinOdds ( ulong ourcards, ulong board, double &player, double &opponent, int NOpponents, double duration ) : void

This method calculates the probablity of a player winning with specific hands and opponents winning with specific hands.

Hands ( int numberOfCards ) : IEnumerable

Enables a foreach command to enumerate all possible ncard hands.

Hands ( ulong shared, ulong dead, int numberOfCards ) : IEnumerable

Enables a foreach command to enumerate all possible ncard hands.

IsBackdoorFlushDraw ( string pocket, string board, string dead ) : bool

Returns true if there are three cards of the same suit. The pocket cards must have at least one card in that suit.

IsBackdoorFlushDraw ( ulong pocket, ulong board, ulong dead ) : bool

Returns true if there are three cards of the same suit. The pocket cards must have at least one card in that suit.

IsConnected ( ulong mask ) : bool

Returns true if the cards in the two card mask are connected. This method calculates the results. Because of that equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.

IsFlushDraw ( string pocket, string board, string dead ) : bool

Returns true if there are 4 cards of the same suit.

IsFlushDraw ( ulong mask, ulong dead ) : bool

Returns true if the hand is a flush draw.

IsFlushDraw ( ulong pocket, ulong board, ulong dead ) : bool

Returns true if there are 4 cards of the same suit.

IsGutShotStraightDraw ( string mask, string dead ) : bool

Return true if the combined cards contain a gut shot straight.

IsGutShotStraightDraw ( string pocket, string board, string dead ) : bool

Return true if the combined cards contain a gut shot straight.

IsGutShotStraightDraw ( ulong mask, ulong dead ) : bool

Return true if the combined cards contain a gut shot straight.

IsGutShotStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool

Return true if the combined cards contain a gut shot straight.

IsOpenEndedStraightDraw ( string mask, string dead ) : bool

Returns true if the mask is an open ended straight draw.

IsOpenEndedStraightDraw ( string pocket, string board, string dead ) : bool

Returns true if the combined mask is an open ended straight draw.

IsOpenEndedStraightDraw ( ulong mask, ulong dead ) : bool

Returns true if the combined mask is an open ended straight draw.

IsOpenEndedStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool

Returns true if the combined mask is an open ended straight draw. Only straight possiblities that improve the player's mask are considered in this method.

IsStraightDraw ( string mask, string dead ) : bool

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.

IsStraightDraw ( string pocket, string board, string dead ) : bool

Returns true if the passed mask only needs one card to make a straight.

IsStraightDraw ( ulong mask, ulong dead ) : bool

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.

IsStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.

IsSuited ( ulong mask ) : bool

This function returns true if the cards in the mask are all one suit. This method calculates the results. Because of the equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.

Mask ( int index ) : ulong

This is a fast way to look up the index mask.

MaskToString ( ulong mask ) : string

Turns a card mask into the equivalent human readable string.

OutCards ( string player, string board ) : string

Returns a string of the possible outs for the next card. Note that cards that only help the board will be ignored.

Outs ( string player, string board ) : int

Returns the number of outs possible with the next card. Note that cards that only help the board will be ignored.

Outs ( ulong player, ulong board ) : int

Returns the number of outs possible with the next card.

OutsDiscounted ( ulong player, ulong board ) : int

Returns the number of discouted outs possible with the next card. Players pocket cards The board (must contain either 3 or 4 cards) A list of zero or more opponent cards. The count of the number of single cards that improve the current hand applying the following discouting rules: 1) Drawing to a pair must use an over card (ie a card higher than all those on the board) 2) Drawing to 2 pair / pairing your hand is discounted if the board is paired (ie your 2 pair drawing deat to trips) 3) Drawing to a hand lower than a flush must not make a 3 suited board or the board be 3 suited. 4) Drawing to a hand lower than a stright, the flop must not be 3card connected or on the turn allow a straight to be made with only 1 pocket card or the out make a straight using only 1 card. Function provided by Matt Baker.

OutsEx ( string pocket, string board, string dead ) : int

OutsEx ( ulong pocket, ulong board, ulong dead ) : int

OutsMask ( ulong player, ulong board ) : ulong

Creates a Hand mask with the cards that will improve the specified players mask against a list of opponents or if no opponents are list just the cards that improve the players current had. Please note that this only looks at single cards that improve the mask and will not specifically look at runner-runner possiblities.

OutsMaskDiscounted ( ulong player, ulong board ) : ulong

Creates a Hand mask with the cards that will improve the specified players hand against a list of opponents or if no opponents are list just the cards that improve the players current hand. This implements the concept of 'discounted outs'. That is outs that will improve the players hand, but not potentially improve an opponents hand to an even better one. For example drawing to a straight that could end up loosing to a flush. Please note that this only looks at single cards that improve the hand and will not specifically look at runner-runner possiblities. Players pocket cards The board (must contain either 3 or 4 cards) A list of zero or more opponent pocket cards A mask of all of the cards that improve the hand applying the following discouting rules: 1) Drawing to a pair must use an over card (ie a card higher than all those on the board) 2) Drawing to 2 pair / pairing your hand is discounted if the board is paired (ie your 2 pair drawing deat to trips) 3) Drawing to a hand lower than a flush must not make a 3 suited board or the board be 3 suited. 4) Drawing to a hand lower than a stright, the flop must not be 3card connected or on the turn allow a straight to be made with only 1 pocket card or the out make a straight using only 1 card. Function provided by Matt Baker.

OutsMaskEx ( string pocket, string board, string dead ) : ulong

OutsMaskEx ( ulong player, ulong board, ulong dead ) : ulong

Creates a Hand mask with the cards that will improve the specified players mask. Please note that this only looks at single cards that improve the mask and will not specifically look at runner-runner possiblities. This version of outs contributed by Matt Baker

ParseCard ( string card ) : int

Reads an string definition of a card and returns the Card value.

ParseHand ( string mask ) : ulong

Parses an string description of a mask and returns a mask mask.

ParseHand ( string hand, int &cards ) : ulong

Parse Hand.

ParseHand ( string pocket, string board, int &cards ) : ulong

This static method parses the passed pocket cards and board and produces a card mask.

PocketHand169Type ( ulong mask ) : PocketHand169Enum

Given a pocket pair mask, the PocketHand169Enum cooresponding to this mask will be returned.

RandomHand ( Random rand, int ncards ) : ulong

This method will return a random mask with the number of cards specified.

RandomHand ( Random rand, string query, ulong dead, int ncards ) : ulong

This method will randomly chose a pocket mask from the query string that doesn't contain any of the specified dead cards. That pocket mask will be used as a set of shared cards that must be used in the final generated mask. The mask will contain the number of cards specified in the ncards argument.

RandomHand ( Random rand, ulong dead, int ncards ) : ulong

Returns a randomly generated mask that doesn't include any of the cards in the dead card mask. The mask will return the number of card in the ncards argument.

RandomHand ( Random rand, ulong list, ulong dead, int ncards ) : ulong

This method randomly picks from a list of possible masks.

RandomHand ( ulong dead, int ncards ) : ulong

RandomHand ( ulong list, ulong dead, int ncards ) : ulong

This method randomly picks from a list of possible masks.

RandomHands ( int ncards, double duration ) : IEnumerable

Iterates through random hands that meets the specified requirements until the specified time duration has elapse. Please note that this iterator requires interop. If you need and interop free mask evaluator you should remove this function along with the other interop functions in this file.

RandomHands ( int ncards, int trials ) : IEnumerable

Iterates through random hands with ncards number of cards. This iterator will return the number of masks specifed in trials. Masks can be repeated.

RandomHands ( string query, ulong dead, int ncards, double duration ) : IEnumerable

Interate through the hands defined in the pocket mask definition.

RandomHands ( ulong list, ulong dead, int ncards, double duration ) : IEnumerable

Returns random hands out of the list of mask provided.

RandomHands ( ulong shared, ulong dead, int ncards, int trials ) : IEnumerable

This function iterates through random hands returning the number of random hands specified in trials. Please note that a mask can be repeated.

StraightDrawCount ( ulong mask, ulong dead ) : int

The method returns the number of straight draws that are possible for the current mask.

StraightDrawCount ( ulong player, ulong board, ulong dead ) : int

The method returns the number of straight draws that are possible for the player and board configuration. This method filters the results so only player hand improvements are counted.

ToString ( ) : string

Returns the string representing the mask.

TopCard ( System hv ) : uint
UniqueHands ( ulong shared, int ncards ) : long

This method returns the number of unique mask values that can be made with ncards, where all of the hands contain the shared cards.

ValidateHand ( string hand ) : bool

This function takes a string representing a full or partial holdem mask and validates that the text represents valid cards and that no card is duplicated.

ValidateHand ( string pocket, string board ) : bool

This function takes a string representing pocket cards and a board and then validates that the text represents a valid mask.

WinOdds ( string pocket, string board, int numOpponents ) : double

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.25S (or 250mS) for the time allotment for Monte Carlo analysis.

WinOdds ( string pocketquery, string boardhand, string deadcards, int numOpponents, double duration ) : double

This method returns the approximate odd for the players mask winning against multiple opponents.

WinOdds ( string pocket, string board, ulong dead, int numOpponents ) : double

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.25S (or 250mS) for the time allotment for Monte Carlo analysis.

WinOdds ( ulong pocket, ulong board, ulong dead ) : double

This method returns the exact odds of the specified mask mask winning against an average player. It's reasonably fast because it uses a lookup table when possible.

WinOdds ( ulong pocket, ulong board, ulong dead, int numOpponents ) : double

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.1S (or 100mS) for the time allotment for Monte Carlo analysis.

WinOdds ( ulong pocket, ulong board, ulong dead, int numOpponents, double duration ) : double

This method returns the approximate odd for the players mask winning against multiple opponents.

operator ( ) : bool

Test for inequality.

Private Methods

Method Description
CardMask ( ulong cards, int suit ) : uint
FIFTH_CARD ( System hv ) : uint
FOURTH_CARD ( System hv ) : uint
HANDTYPE_VALUE ( HandTypes ht ) : uint
NextCard ( string cards, int &index ) : int

Parses Card strings (internal)

QueryPerformanceCounter ( long &lpPerformanceCount ) : bool
QueryPerformanceFrequency ( long &lpFrequency ) : bool
SECOND_CARD ( System hv ) : uint
SECOND_CARD_VALUE ( System c ) : uint
THIRD_CARD ( System hv ) : uint
THIRD_CARD_VALUE ( System c ) : uint
TOP_CARD_VALUE ( System c ) : uint
UpdateHandMask ( ) : void

Updates handmask and handval, called when card strings change

Method Details

BitCount() public static method

Count Bits. Optimized for cards so only works with 52 bits.
public static BitCount ( ulong bitField ) : int
bitField ulong
return int

CardRank() public static method

Given a card value, returns it's rank
public static CardRank ( int card ) : int
card int card value
return int

CardSuit() public static method

Given a card value, returns it's suit
public static CardSuit ( int card ) : int
card int Card value
return int

Cards() public static method

This method allows a foreach statement to iterate through each card in a card mask.
public static Cards ( ulong mask ) : IEnumerable
mask ulong
return IEnumerable

CompareTo() public method

Used to compare one mask to another. This method allows normal compare functions to work as expected with a mask.
public CompareTo ( object obj ) : int
obj object object to compare against
return int

CountContiguous() public static method

Returns the count of adjacent cards
public static CountContiguous ( ulong mask ) : int
mask ulong Current Hand
return int

CountContiguous() public static method

Returns the count of adjacent cards
public static CountContiguous ( ulong pocket, ulong board ) : int
pocket ulong Players pocket cards mask
board ulong Community card mask
return int

DescriptionFromHand() public static method

Takes an string describing a mask and returns the description.
public static DescriptionFromHand ( string mask ) : string
mask string the string describing the mask
return string

DescriptionFromHandValueInternal() public static method

public static DescriptionFromHandValueInternal ( uint handValue ) : string
handValue uint
return string

DescriptionFromMask() public static method

Evaluates a hand and returns a descriptive string.
public static DescriptionFromMask ( ulong cards ) : string
cards ulong Card mask
return string

DetailedOddsWithMultiplePlayers() public static method

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the amount of time allowed for the simulation.
public static DetailedOddsWithMultiplePlayers ( string pocket, string board, ulong dead, int playerCount, double &playerodds, double &oppodds, double duration ) : void
pocket string Players Hand
board string Current Board
dead ulong Dead Cards
playerCount int the number of players in the mask.
playerodds double The returned odds array for the player
oppodds double The returned odds array for the opponents
duration double The time allowed to run the simulation
return void

DetailedOddsWithMultiplePlayers() public static method

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the number of trials.
public static DetailedOddsWithMultiplePlayers ( string pocket, string board, ulong dead, int playerCount, double &playerodds, double &oppodds, int trials ) : void
pocket string Players Hand
board string Current Board
dead ulong Dead Cards
playerCount int the number of players in the mask.
playerodds double The returned odds array for the player
oppodds double The returned odds array for the opponents
trials int The number of simulations to run.
return void

DetailedOddsWithMultiplePlayers() public static method

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the amount of time allowed for the simulation.
public static DetailedOddsWithMultiplePlayers ( ulong pocket, ulong board, ulong dead, int playerCount, double &playerodds, double &oppodds, double duration ) : void
pocket ulong Players Hand
board ulong Current Board
dead ulong Dead Cards
playerCount int the number of players in the mask.
playerodds double The returned odds array for the player
oppodds double The returned odds array for the opponents
duration double The time allowed to run the simulation
return void

DetailedOddsWithMultiplePlayers() public static method

Cacluates the approxamate odds that each player and opponent mask type has to win. This method uses Monte Carlo Analysis to determine a results. The quality of the result will depend on the number of trials.
public static DetailedOddsWithMultiplePlayers ( ulong pocket, ulong board, ulong dead, int playerCount, double &playerodds, double &oppodds, int trials ) : void
pocket ulong Players Hand
board ulong Current Board
dead ulong Dead Cards
playerCount int the number of players in the mask.
playerodds double The returned odds array for the player
oppodds double The returned odds array for the opponents
trials int The number of simulations to run.
return void

DrawCount() public static method

The method returns the number of draws that are possible for the specified HandType.
public static DrawCount ( string player, string board, string dead, Hand type ) : int
player string Two card mask making up the players pocket cards
board string The community cards
dead string Dead cards
type Hand They type of mask to count draws for.
return int

DrawCount() public static method

The method returns the number of draws that are possible for the specified HandType. Note that DrawCount(pocket, board, dead, type) is not necessarily the same as DrawCount(pocket | board, dead, type). This method returns all possible draws that are the same as the requested type.
public static DrawCount ( ulong mask, ulong dead, Hand type ) : int
mask ulong Hand
dead ulong Dead cards
type Hand They type of mask to count draws for.
return int

DrawCount() public static method

The method returns the number of draws that are possible for the specified HandType. This method only returns the counts that improve the player's mask rather than just the board. Because of this subtle distinction, DrawCount(player, board, dead, type) doesn't necessarily return the same value as DrawCount(player | board, dead, type).
public static DrawCount ( ulong player, ulong board, ulong dead, Hand type ) : int
player ulong Two card mask making up the players pocket cards
board ulong The community cards
dead ulong Dead cards
type Hand They type of mask to count draws for.
return int

Equals() public method

Test for equality
public Equals ( object obj ) : bool
obj object
return bool

Evaluate() public static method

Evaluates a mask (passed as a string) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.
public static Evaluate ( string mask ) : uint
mask string mask string
return uint

Evaluate() public static method

Evaluates a mask (passed as a mask mask) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.
public static Evaluate ( ulong cards ) : uint
cards ulong mask mask
return uint

Evaluate() public static method

Evaluates a mask (passed as a mask mask) and returns a mask value. A mask value can be compared against another mask value to determine which has the higher value.
public static Evaluate ( ulong cards, int nCards ) : uint
cards ulong mask mask
nCards int number of cards in the mask
return uint

EvaluateType() public static method

Evaluates the card mask and returns the type of mask it is. This function is faster (but provides less information) than Evaluate or Evaluate.
public static EvaluateType ( ulong mask ) : HandTypes
mask ulong card mask
return HandTypes

EvaluateType() public static method

This function is faster (but provides less information) than Evaluate or Evaluate.
public static EvaluateType ( ulong mask, int cards ) : HandTypes
mask ulong card mask
cards int number of cards in mask
return HandTypes

FlushDrawCount() public static method

Counts the number of hands that are a flush with one more drawn card.
public static FlushDrawCount ( ulong mask, ulong dead ) : int
mask ulong Hand
dead ulong Cards not allowed to be drawn
return int

FlushDrawCount() public static method

Counts the number of hands that are a flush with one more drawn card. However, Flush hands that only improve the board are not considered.
public static FlushDrawCount ( ulong player, ulong board, ulong dead ) : int
player ulong Players two card hand
board ulong Board cards
dead ulong Dead cards
return int

GapCount() public static method

Counts the number of empty space between adjacent cards. 0 means connected, 1 means a gap of one, 2 means a gap of two and 3 means a gap of three. This method calculates the results. Because of that equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.
public static GapCount ( ulong mask ) : int
mask ulong two card mask mask
return int

GetHashCode() public method

Returns hash code
public GetHashCode ( ) : int
return int

Hand() public method

Default constructor
public Hand ( ) : System
return System

Hand() public method

Constructor
public Hand ( string pocket, string board ) : System
pocket string Pocket Cards
board string Board
return System

HandDistance() public static method

This method returns the mask distance from the best possible mask given this board (no draws are considered). The value 0 is the best possible mask. The value 1 is the next best mask and so on.
public static HandDistance ( ulong pocket, ulong board ) : long
pocket ulong The players pocket mask
board ulong The board mask
return long

HandPlayerMultiOpponentOdds() public static method

public static HandPlayerMultiOpponentOdds ( ulong ourcards, ulong board, int numOpponents, double duration, double &player, double &opponent ) : void
ourcards ulong
board ulong
numOpponents int
duration double
player double
opponent double
return void

HandPotential() public static method

This method is similar to the HandPotential algorithm described in Aaron Davidson's masters thesis, however if differs in several significant ways. First, it makes the calculation while accounting for one or more opponents. Second, it uses the Monte Carlo technique to get answers in a reasonable amount of time (a duration of 0.1 seems to give reasonable results). And finally, the results are not normalized; the positive and negative potential is the actual odds of improvement or worsening of a mask.
public static HandPotential ( string pockethand, string boardhand, double &ppot, double &npot, int NOpponents, double duration ) : void
pockethand string Players pocket card query string
boardhand string The current board string
ppot double The resultant positive potential
npot double The resultant negative potential
NOpponents int The number of opponents
duration double The length of time (in seconds) to spend on this calculation
return void

HandPotential() public static method

Returns the normalized, positive and negative potential of the current mask. This funciton is described in Aaron Davidson's masters thesis on page 23.
public static HandPotential ( ulong pocket, ulong board, double &ppot, double &npot ) : void
pocket ulong Hold Cards
board ulong Community cards
ppot double Positive Potential
npot double Negative Potential
return void

HandPotential() public static method

This method is similar to the HandPotential algorithm described in Aaron Davidson's masters thesis, however if differs in several significant ways. First, it makes the calculation while accounting for one or more opponents. Second, it uses the Monte Carlo technique to get answers in a reasonable amount of time (a duration of 0.1 seems to give reasonable results). And finally, the results are not normalized; the positive and negative potential is the actual odds of improvement or worsening of a mask.
public static HandPotential ( ulong pocket, ulong board, double &ppot, double &npot, int NOpponents, double duration ) : void
pocket ulong Players pocket card mask
board ulong The current board mask
ppot double The resultant positive potential
npot double The resultant negative potential
NOpponents int The number of opponents
duration double The length of time (in seconds) to spend on this calculation
return void

HandStrength() public static method

A HandStrength function that accounts for multiple opponents. This method uses the Monte Carlo menthod to calculate a value. It takes surprisingly little time to get good results. A duration of 0.01 seconds (10mS) returns good results, and a duration of 0.1 (100mS) returns even better results.
public static HandStrength ( string pocketquery, string board, int NOpponnents, double duration ) : double
pocketquery string pocket mask query
board string current board
NOpponnents int the number of opponents (must be 1-9)
duration double time in seconds to perform this calculation
return double

HandStrength() public static method

The classic HandStrengh Calculation from page 21 of Aaron Davidson's Masters Thesis.
public static HandStrength ( ulong pocket, ulong board ) : double
pocket ulong Pocket cards
board ulong Current Board
return double

HandStrength() public static method

public static HandStrength ( ulong pocket, ulong board, int NOpponnents, double duration ) : double
pocket ulong
board ulong
NOpponnents int
duration double
return double

HandType() public static method

public static HandType ( uint handValue ) : uint
handValue uint
return uint

HandWinOdds() public static method

public static HandWinOdds ( ulong ourcards, ulong oppcards, ulong board, double &player, double &opponent ) : bool
ourcards ulong
oppcards ulong
board ulong
player double
opponent double
return bool

HandWinOdds() public static method

Given a set of pocket cards and a set of board cards this function returns the odds of winning or tying for a player and a random opponent.
public static HandWinOdds ( string pocketcards, string boardcards, double &player, double &opponent ) : void
pocketcards string Pocket cards in ASCII
boardcards string Board cards in ASCII
player double Player odds as doubles
opponent double Opponent odds as doubles
return void

HandWinOdds() public static method

This method calculates the probablity of a player winning with specific hands and opponents winning with specific hands.
public static HandWinOdds ( string ourcards, string board, double &player, double &opponent, int NOpponents, double duration ) : void
ourcards string pocket cards
board string board cards
player double player win odds
opponent double opponent(s) win odds
NOpponents int The number of opponents
duration double The amount of time in seconds to calculate samples
return void

HandWinOdds() public static method

Used to calculate the wining information about each players mask. This function enumerates all possible remaining hands and tallies win, tie and losses for each player. This function typically takes well less than a second regardless of the number of players.
public static HandWinOdds ( string pockets, string board, string dead, long wins, long ties, long losses, long &totalHands ) : void
pockets string Array of pocket mask string, one for each player
board string the board cards
dead string the dead cards
wins long An array of win tallies, one for each player
ties long An array of tie tallies, one for each player
losses long An array of losses tallies, one for each player
totalHands long The total number of hands enumarated.
return void

HandWinOdds() public static method

Given a set of pocket cards and a set of board cards this function returns the odds of winning or tying for a player and a random opponent.
public static HandWinOdds ( ulong ourcards, ulong board, double &player, double &opponent ) : void
ourcards ulong Pocket mask for the mask.
board ulong Board mask for mask
player double Player odds as doubles
opponent double Opponent odds as doubles
return void

HandWinOdds() public static method

This method calculates the probablity of a player winning with specific hands and opponents winning with specific hands.
public static HandWinOdds ( ulong ourcards, ulong board, double &player, double &opponent, int NOpponents, double duration ) : void
ourcards ulong pocket card mask
board ulong board cards mask
player double player win odds
opponent double opponent(s) win odds
NOpponents int The number of opponents
duration double The amount of time in seconds to calculate samples
return void

Hands() public static method

Enables a foreach command to enumerate all possible ncard hands.
public static Hands ( int numberOfCards ) : IEnumerable
numberOfCards int the number of cards in the mask (must be between 1 and 7)
return IEnumerable

Hands() public static method

Enables a foreach command to enumerate all possible ncard hands.
public static Hands ( ulong shared, ulong dead, int numberOfCards ) : IEnumerable
shared ulong A bitfield containing the cards that must be in the enumerated hands
dead ulong A bitfield containing the cards that must not be in the enumerated hands
numberOfCards int the number of cards in the mask (must be between 1 and 7)
return IEnumerable

IsBackdoorFlushDraw() public static method

Returns true if there are three cards of the same suit. The pocket cards must have at least one card in that suit.
public static IsBackdoorFlushDraw ( string pocket, string board, string dead ) : bool
pocket string Players pocket cards
board string Community cards
dead string Dead cards
return bool

IsBackdoorFlushDraw() public static method

Returns true if there are three cards of the same suit. The pocket cards must have at least one card in that suit.
public static IsBackdoorFlushDraw ( ulong pocket, ulong board, ulong dead ) : bool
pocket ulong Players pocket cards mask
board ulong Community card mask
dead ulong Dead cards
return bool

IsConnected() public static method

Returns true if the cards in the two card mask are connected. This method calculates the results. Because of that equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.
public static IsConnected ( ulong mask ) : bool
mask ulong the mask to check
return bool

IsFlushDraw() public static method

Returns true if there are 4 cards of the same suit.
public static IsFlushDraw ( string pocket, string board, string dead ) : bool
pocket string Players pocket cards
board string Community cards
dead string Dead cards
return bool

IsFlushDraw() public static method

Returns true if the hand is a flush draw.
public static IsFlushDraw ( ulong mask, ulong dead ) : bool
mask ulong Cards
dead ulong Dead cards
return bool

IsFlushDraw() public static method

Returns true if there are 4 cards of the same suit.
public static IsFlushDraw ( ulong pocket, ulong board, ulong dead ) : bool
pocket ulong Players pocket cards mask
board ulong Community card mask
dead ulong Dead cards
return bool

IsGutShotStraightDraw() public static method

Return true if the combined cards contain a gut shot straight.
public static IsGutShotStraightDraw ( string mask, string dead ) : bool
mask string Current mask
dead string Dead cards
return bool

IsGutShotStraightDraw() public static method

Return true if the combined cards contain a gut shot straight.
public static IsGutShotStraightDraw ( string pocket, string board, string dead ) : bool
pocket string Players pocket cards
board string Community cards
dead string Dead cards
return bool

IsGutShotStraightDraw() public static method

Return true if the combined cards contain a gut shot straight.
public static IsGutShotStraightDraw ( ulong mask, ulong dead ) : bool
mask ulong Current mask
dead ulong Dead cards
return bool

IsGutShotStraightDraw() public static method

Return true if the combined cards contain a gut shot straight.
public static IsGutShotStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool
pocket ulong Players pocket cards mask
board ulong Community card mask
dead ulong Dead cards
return bool

IsOpenEndedStraightDraw() public static method

Returns true if the mask is an open ended straight draw.
public static IsOpenEndedStraightDraw ( string mask, string dead ) : bool
mask string Players pocket cards mask
dead string Community card mask
return bool

IsOpenEndedStraightDraw() public static method

Returns true if the combined mask is an open ended straight draw.
public static IsOpenEndedStraightDraw ( string pocket, string board, string dead ) : bool
pocket string Players pocket cards
board string Community cards
dead string Dead cards
return bool

IsOpenEndedStraightDraw() public static method

Returns true if the combined mask is an open ended straight draw.
public static IsOpenEndedStraightDraw ( ulong mask, ulong dead ) : bool
mask ulong Players pocket cards mask
dead ulong Community card mask
return bool

IsOpenEndedStraightDraw() public static method

Returns true if the combined mask is an open ended straight draw. Only straight possiblities that improve the player's mask are considered in this method.
public static IsOpenEndedStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool
pocket ulong Players pocket cards mask
board ulong Community card mask
dead ulong Dead cards
return bool

IsStraightDraw() public static method

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.
public static IsStraightDraw ( string mask, string dead ) : bool
mask string Current Hand
dead string Dead Cards
return bool

IsStraightDraw() public static method

Returns true if the passed mask only needs one card to make a straight.
public static IsStraightDraw ( string pocket, string board, string dead ) : bool
pocket string Players pocket mask
board string Community board
dead string Dead cards
return bool

IsStraightDraw() public static method

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.
public static IsStraightDraw ( ulong mask, ulong dead ) : bool
mask ulong Current Hand
dead ulong Dead Cards
return bool

IsStraightDraw() public static method

Returns true if the passed mask only needs one card to make a straight. Note that the pocket cards must contains at least one card in the combined straight.
public static IsStraightDraw ( ulong pocket, ulong board, ulong dead ) : bool
pocket ulong Players pocket mask
board ulong Community board
dead ulong Dead cards
return bool

IsSuited() public static method

This function returns true if the cards in the mask are all one suit. This method calculates the results. Because of the equivelent call in PocketHands is preferred because it uses a lookup table and is faster. This function remains to allow for automated testing.
public static IsSuited ( ulong mask ) : bool
mask ulong mask to check for "suited-ness"
return bool

Mask() public static method

This is a fast way to look up the index mask.
public static Mask ( int index ) : ulong
index int index of mask
return ulong

MaskToString() public static method

Turns a card mask into the equivalent human readable string.
public static MaskToString ( ulong mask ) : string
mask ulong mask to convert
return string

OutCards() public static method

Returns a string of the possible outs for the next card. Note that cards that only help the board will be ignored.
public static OutCards ( string player, string board ) : string
player string Player pocket card string
board string Board card string
return string

Outs() public static method

Returns the number of outs possible with the next card. Note that cards that only help the board will be ignored.
public static Outs ( string player, string board ) : int
player string Players pocket cards
board string The board (must contain either 3 or 4 cards)
return int

Outs() public static method

Returns the number of outs possible with the next card.
public static Outs ( ulong player, ulong board ) : int
player ulong Players pocket cards
board ulong The board (must contain either 3 or 4 cards)
return int

OutsDiscounted() public static method

Returns the number of discouted outs possible with the next card. Players pocket cards The board (must contain either 3 or 4 cards) A list of zero or more opponent cards. The count of the number of single cards that improve the current hand applying the following discouting rules: 1) Drawing to a pair must use an over card (ie a card higher than all those on the board) 2) Drawing to 2 pair / pairing your hand is discounted if the board is paired (ie your 2 pair drawing deat to trips) 3) Drawing to a hand lower than a flush must not make a 3 suited board or the board be 3 suited. 4) Drawing to a hand lower than a stright, the flop must not be 3card connected or on the turn allow a straight to be made with only 1 pocket card or the out make a straight using only 1 card. Function provided by Matt Baker.
public static OutsDiscounted ( ulong player, ulong board ) : int
player ulong Players pocket hand
board ulong Board cards so far
return int

OutsEx() public static method

public static OutsEx ( string pocket, string board, string dead ) : int
pocket string
board string
dead string
return int

OutsEx() public static method

public static OutsEx ( ulong pocket, ulong board, ulong dead ) : int
pocket ulong
board ulong
dead ulong
return int

OutsMask() public static method

Creates a Hand mask with the cards that will improve the specified players mask against a list of opponents or if no opponents are list just the cards that improve the players current had. Please note that this only looks at single cards that improve the mask and will not specifically look at runner-runner possiblities.
public static OutsMask ( ulong player, ulong board ) : ulong
player ulong Players pocket cards
board ulong The board (must contain either 3 or 4 cards)
return ulong

OutsMaskDiscounted() public static method

Creates a Hand mask with the cards that will improve the specified players hand against a list of opponents or if no opponents are list just the cards that improve the players current hand. This implements the concept of 'discounted outs'. That is outs that will improve the players hand, but not potentially improve an opponents hand to an even better one. For example drawing to a straight that could end up loosing to a flush. Please note that this only looks at single cards that improve the hand and will not specifically look at runner-runner possiblities. Players pocket cards The board (must contain either 3 or 4 cards) A list of zero or more opponent pocket cards A mask of all of the cards that improve the hand applying the following discouting rules: 1) Drawing to a pair must use an over card (ie a card higher than all those on the board) 2) Drawing to 2 pair / pairing your hand is discounted if the board is paired (ie your 2 pair drawing deat to trips) 3) Drawing to a hand lower than a flush must not make a 3 suited board or the board be 3 suited. 4) Drawing to a hand lower than a stright, the flop must not be 3card connected or on the turn allow a straight to be made with only 1 pocket card or the out make a straight using only 1 card. Function provided by Matt Baker.
public static OutsMaskDiscounted ( ulong player, ulong board ) : ulong
player ulong Players pocket hand
board ulong Board mask
return ulong

OutsMaskEx() public static method

public static OutsMaskEx ( string pocket, string board, string dead ) : ulong
pocket string
board string
dead string
return ulong

OutsMaskEx() public static method

Creates a Hand mask with the cards that will improve the specified players mask. Please note that this only looks at single cards that improve the mask and will not specifically look at runner-runner possiblities. This version of outs contributed by Matt Baker
public static OutsMaskEx ( ulong player, ulong board, ulong dead ) : ulong
player ulong Players pocket cards
board ulong The board (must contain either 3 or 4 cards)
dead ulong Dead cards
return ulong

ParseCard() public static method

Reads an string definition of a card and returns the Card value.
public static ParseCard ( string card ) : int
card string card string
return int

ParseHand() public static method

Parses an string description of a mask and returns a mask mask.
public static ParseHand ( string mask ) : ulong
mask string string descripton of a mask
return ulong

ParseHand() public static method

Parse Hand.
public static ParseHand ( string hand, int &cards ) : ulong
hand string Hand string
cards int Cards found
return ulong

ParseHand() public static method

This static method parses the passed pocket cards and board and produces a card mask.
public static ParseHand ( string pocket, string board, int &cards ) : ulong
pocket string ASCII string representing pocket cards
board string ASCII string representing board
cards int Number of cards represented in mask
return ulong

PocketHand169Type() public static method

Given a pocket pair mask, the PocketHand169Enum cooresponding to this mask will be returned.
public static PocketHand169Type ( ulong mask ) : PocketHand169Enum
mask ulong
return PocketHand169Enum

RandomHand() public static method

This method will return a random mask with the number of cards specified.
public static RandomHand ( Random rand, int ncards ) : ulong
rand Random Random number generator.
ncards int The number of cards to return
return ulong

RandomHand() public static method

This method will randomly chose a pocket mask from the query string that doesn't contain any of the specified dead cards. That pocket mask will be used as a set of shared cards that must be used in the final generated mask. The mask will contain the number of cards specified in the ncards argument.
public static RandomHand ( Random rand, string query, ulong dead, int ncards ) : ulong
rand Random Random number generator.
query string A pocket mask query string
dead ulong A set of cards that may not be used in the generated mask as a mask mask
ncards int The number of cards that must be in the final mask.
return ulong

RandomHand() public static method

Returns a randomly generated mask that doesn't include any of the cards in the dead card mask. The mask will return the number of card in the ncards argument.
public static RandomHand ( Random rand, ulong dead, int ncards ) : ulong
rand Random Random number generator.
dead ulong The mask of cards that may not be used in the generated mask
ncards int The number of cards to return in the generated mask
return ulong

RandomHand() public static method

This method randomly picks from a list of possible masks.
public static RandomHand ( Random rand, ulong list, ulong dead, int ncards ) : ulong
rand Random Random number generator.
list ulong The list of masks to pick from.
dead ulong A mask containing cards that must not be chosen
ncards int The number of cards to return
return ulong

RandomHand() public static method

public static RandomHand ( ulong dead, int ncards ) : ulong
dead ulong
ncards int
return ulong

RandomHand() public static method

This method randomly picks from a list of possible masks.
public static RandomHand ( ulong list, ulong dead, int ncards ) : ulong
list ulong The list of masks to pick from.
dead ulong A mask containing cards that must not be chosen
ncards int The number of cards to return
return ulong

RandomHands() public static method

Iterates through random hands that meets the specified requirements until the specified time duration has elapse. Please note that this iterator requires interop. If you need and interop free mask evaluator you should remove this function along with the other interop functions in this file.
public static RandomHands ( int ncards, double duration ) : IEnumerable
ncards int The number of cards in the returned mask.
duration double The amount of time to allow the generation of hands to occur. When elapsed, the iterator will terminate.
return IEnumerable

RandomHands() public static method

Iterates through random hands with ncards number of cards. This iterator will return the number of masks specifed in trials. Masks can be repeated.
public static RandomHands ( int ncards, int trials ) : IEnumerable
ncards int Number of cards required to be in the mask.
trials int Number of total mask to return.
return IEnumerable

RandomHands() public static method

Interate through the hands defined in the pocket mask definition.
public static RandomHands ( string query, ulong dead, int ncards, double duration ) : IEnumerable
query string Pocket card string
dead ulong Cards not allowed.
ncards int The number of cards the returned mask
duration double The time allowed for iterating
return IEnumerable

RandomHands() public static method

Returns random hands out of the list of mask provided.
public static RandomHands ( ulong list, ulong dead, int ncards, double duration ) : IEnumerable
list ulong List of possible hands
dead ulong Cards not allowed
ncards int Total number of cards in returned mask
duration double The time allowed for iterating
return IEnumerable

RandomHands() public static method

This function iterates through random hands returning the number of random hands specified in trials. Please note that a mask can be repeated.
public static RandomHands ( ulong shared, ulong dead, int ncards, int trials ) : IEnumerable
shared ulong Cards that must be in the mask.
dead ulong Cards that must not be in the mask.
ncards int The total number of cards in the mask.
trials int The total number of random hands to return.
return IEnumerable

StraightDrawCount() public static method

The method returns the number of straight draws that are possible for the current mask.
public static StraightDrawCount ( ulong mask, ulong dead ) : int
mask ulong Current Hand
dead ulong Dead cards
return int

StraightDrawCount() public static method

The method returns the number of straight draws that are possible for the player and board configuration. This method filters the results so only player hand improvements are counted.
public static StraightDrawCount ( ulong player, ulong board, ulong dead ) : int
player ulong Two card mask making up the players pocket cards
board ulong The community cards
dead ulong Dead cards
return int

ToString() public method

Returns the string representing the mask.
public ToString ( ) : string
return string

TopCard() public static method

public static TopCard ( System hv ) : uint
hv System
return uint

UniqueHands() public static method

This method returns the number of unique mask values that can be made with ncards, where all of the hands contain the shared cards.
public static UniqueHands ( ulong shared, int ncards ) : long
shared ulong Cards required in all of the hands
ncards int The number of cards in the mask
return long

ValidateHand() public static method

This function takes a string representing a full or partial holdem mask and validates that the text represents valid cards and that no card is duplicated.
public static ValidateHand ( string hand ) : bool
hand string mask to validate
return bool

ValidateHand() public static method

This function takes a string representing pocket cards and a board and then validates that the text represents a valid mask.
public static ValidateHand ( string pocket, string board ) : bool
pocket string Pocket cards as a string
board string Board cards as a string
return bool

WinOdds() public static method

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.25S (or 250mS) for the time allotment for Monte Carlo analysis.
public static WinOdds ( string pocket, string board, int numOpponents ) : double
pocket string The pocket mask of the player.
board string The current board cards
numOpponents int The number of oppoents 1-9 are legal values
return double

WinOdds() public static method

This method returns the approximate odd for the players mask winning against multiple opponents.
public static WinOdds ( string pocketquery, string boardhand, string deadcards, int numOpponents, double duration ) : double
pocketquery string The pocket mask of the player.
boardhand string The current board cards
deadcards string dead cards
numOpponents int The approximate odds of winning the passed mask against the number of opponents specified.
duration double The period of time (in seconds) to run trials. On my 2.8Ghz laptop 0.1 seconds seems adequate.
return double

WinOdds() public static method

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.25S (or 250mS) for the time allotment for Monte Carlo analysis.
public static WinOdds ( string pocket, string board, ulong dead, int numOpponents ) : double
pocket string The pocket mask of the player.
board string The current board cards
dead ulong Dead cards
numOpponents int The number of oppoents 1-9 are legal values
return double

WinOdds() public static method

This method returns the exact odds of the specified mask mask winning against an average player. It's reasonably fast because it uses a lookup table when possible.
public static WinOdds ( ulong pocket, ulong board, ulong dead ) : double
pocket ulong The pocket mask
board ulong The board mask
dead ulong Dead cards
return double

WinOdds() public static method

This method returns the approximate odd for the players mask winning against multiple opponents. This uses a default time duration of 0.1S (or 100mS) for the time allotment for Monte Carlo analysis.
public static WinOdds ( ulong pocket, ulong board, ulong dead, int numOpponents ) : double
pocket ulong The pocket mask of the player.
board ulong The current board cards
dead ulong Dead cards
numOpponents int The number of oppoents 1-9 are legal values
return double

WinOdds() public static method

This method returns the approximate odd for the players mask winning against multiple opponents.
public static WinOdds ( ulong pocket, ulong board, ulong dead, int numOpponents, double duration ) : double
pocket ulong The pocket mask of the player.
board ulong The current board cards
dead ulong Dead cards
numOpponents int The approximate odds of winning the passed mask against the number of opponents specified.
duration double The period of time (in seconds) to run trials. On my 2.8Ghz laptop 0.1 seconds seems adequate.
return double

operator() public static method

Test for inequality.
public static operator ( ) : bool
return bool

Property Details

CLUB_OFFSET public_oe static_oe property

public static int CLUB_OFFSET
return int

CardJoker public_oe static_oe property

public static int CardJoker
return int

CardMasksTable public_oe static_oe property

This table is equivalent to 1UL left shifted by the index. The lookup is faster than the left shift operator.
public static ulong[] CardMasksTable
return ulong[]

CardTable public_oe static_oe property

public static string[] CardTable
return string[]

Clubs public_oe static_oe property

Represents the suit - Clubs
public static int Clubs
return int

DIAMOND_OFFSET public_oe static_oe property

public static int DIAMOND_OFFSET
return int

Diamonds public_oe static_oe property

Represents the suit - Diamonds
public static int Diamonds
return int

HEART_OFFSET public_oe static_oe property

public static int HEART_OFFSET
return int

Hearts public_oe static_oe property

Represents the suit - Hearts
public static int Hearts
return int

NCardsWJoker public_oe static_oe property

public static int NCardsWJoker
return int

NumberOfCards public_oe static_oe property

The total number of cards in a deck
public static int NumberOfCards
return int

Rank2 public_oe static_oe property

Rank of a card with a value of two.
public static int Rank2
return int

Rank3 public_oe static_oe property

Rank of a card with a value of three.
public static int Rank3
return int

Rank4 public_oe static_oe property

Rank of a card with a value of four.
public static int Rank4
return int

Rank5 public_oe static_oe property

Rank of a card with a value of five.
public static int Rank5
return int

Rank6 public_oe static_oe property

Rank of a card with a value of six.
public static int Rank6
return int

Rank7 public_oe static_oe property

Rank of a card with a value of seven.
public static int Rank7
return int

Rank8 public_oe static_oe property

Rank of a card with a value of eight.
public static int Rank8
return int

Rank9 public_oe static_oe property

Rank of a card with a value of nine.
public static int Rank9
return int

RankAce public_oe static_oe property

Rank of a card showing an Ace.
public static int RankAce
return int

RankJack public_oe static_oe property

Rank of a card showing a Jack.
public static int RankJack
return int

RankKing public_oe static_oe property

Rank of a card showing a King.
public static int RankKing
return int

RankQueen public_oe static_oe property

Rank of a card showing a Queen.
public static int RankQueen
return int

RankTen public_oe static_oe property

Rank of a card with a value of ten.
public static int RankTen
return int

SPADE_OFFSET public_oe static_oe property

public static int SPADE_OFFSET
return int

Spades public_oe static_oe property

Represents the suit - Spades
public static int Spades
return int

TwoCardMaskTable public_oe static_oe property

1326 ulong cards masks for all hold cards.
public static ulong[] TwoCardMaskTable
return ulong[]

TwoCardMaskTableSize public_oe static_oe property

public static int TwoCardMaskTableSize
return int

nBitsAndStrTable public_oe static_oe property

public static UInt16[] nBitsAndStrTable
return UInt16[]