C# 클래스 PsHandler.PokerMath.Evaluator.Hand

Represents a Texas Holdem Hand
상속: IComparable
파일 보기 프로젝트 열기: kampiuceris/PsHandler

공개 프로퍼티들

프로퍼티 타입 설명
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

공개 메소드들

메소드 설명
BitCount ( ulong bitField ) : int

Fast Bitcounting method (adapted from snippets.org)

CardRank ( int card ) : int

Given a card value, returns it's rank

CardSuit ( int card ) : int

Given a card value, returns it's suit

CompareTo ( object obj ) : int

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

DescriptionFromHand ( string hand ) : string

Takes an string describing a hand and returns the description.

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

Equals ( object obj ) : bool

Test for equality

Eval ( string hand ) : uint

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

Eval ( ulong cards ) : uint

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

Eval ( ulong cards, int numberOfCards ) : uint

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

Evaluate ( string pocketCardsStr, string boardStr, string deadStr ) : EvaluationPocket
EvaluateType ( ulong mask ) : HandTypes

Evaluates the card mask and returns the type of hand 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.

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.

GetHashCode ( ) : int

Returns hash code

Hand ( ) : System

Default constructor

Hand ( string pocket, string board ) : System

Constructor

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

Used to calculate the wining information about each players hand. 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.

HandPlayerOpponentOdds ( 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.

HandPlayerOpponentOdds ( 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.

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

Returns the positive and negative potential of the current hand. This funciton is described in Aaron Davidson's masters thesis (davidson.msc.pdf).

HandType ( uint handValue ) : uint
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.

IsConnected ( ulong mask ) : bool

Returns true if the cards in the two card hand are connected.

IsSuited ( ulong mask ) : bool

This function returns true if the cards in the hand are all one suit

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.

NextCard ( string cards, int &index ) : int

Parses Card strings (internal)

Outs ( ulong player, ulong board ) : int

Returns the number of outs possible with the next card.

OutsMask ( 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 had. Please note that this only looks at single cards that improve the hand and will not specifically look at runner-runner possiblities.

ParseCard ( string card ) : int

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

ParseHand ( string hand ) : ulong

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

ParseHand ( string hand, int &cards ) : ulong

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 PocketPairType cooresponding to this mask will be returned.

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 hand 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 ( ulong shared, ulong dead, 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 hand evaluator you should remove this function along with the other interop functions in this file.

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.

ToString ( ) : string

Returns the string representing the hand.

TopCard ( System hv ) : uint
ValidateHand ( string hand ) : bool

This function takes a string representing a full or partial holdem hand 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 hand.

operator ( ) : bool

Test for inequality.

비공개 메소드들

메소드 설명
CardMask ( ulong cards, int suit ) : uint
DescriptionFromHandValue ( uint handValue ) : string
Eval ( string pocketCardsStr, IEnumerable boardStr, IEnumerable deadStr ) : int
FIFTH_CARD ( System hv ) : uint
FOURTH_CARD ( System hv ) : uint
GetRandomHand ( ulong dead, int ncards, Random rand ) : ulong

Returns a rand hand with the specified number of cards and constrained to not contain any of the passed dead cards.

HANDTYPE_VALUE ( HandTypes ht ) : uint
HandPotentialOpp ( ulong ourcards, ulong board, ulong oppcards, int index, int &HP ) : void

Internal function used by HandPotential.

MaskToDescription ( ulong mask ) : string
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

메소드 상세

BitCount() 공개 정적인 메소드

Fast Bitcounting method (adapted from snippets.org)
public static BitCount ( ulong bitField ) : int
bitField ulong ulong to count
리턴 int

CardRank() 공개 정적인 메소드

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

CardSuit() 공개 정적인 메소드

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

CompareTo() 공개 메소드

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

DescriptionFromHand() 공개 정적인 메소드

Takes an string describing a hand and returns the description.
public static DescriptionFromHand ( string hand ) : string
hand string the string describing the hand
리턴 string

DescriptionFromHandValueInternal() 공개 정적인 메소드

public static DescriptionFromHandValueInternal ( uint handValue ) : string
handValue uint
리턴 string

DescriptionFromMask() 공개 정적인 메소드

public static DescriptionFromMask ( ulong cards ) : string
cards ulong
리턴 string

Equals() 공개 메소드

Test for equality
public Equals ( object obj ) : bool
obj object
리턴 bool

Eval() 공개 정적인 메소드

Evaluates a hand (passed as a string) and returns a hand value. A hand value can be compared against another hand value to determine which has the higher value.
public static Eval ( string hand ) : uint
hand string hand string
리턴 uint

Eval() 공개 정적인 메소드

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

Eval() 공개 정적인 메소드

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

Evaluate() 공개 정적인 메소드

public static Evaluate ( string pocketCardsStr, string boardStr, string deadStr ) : EvaluationPocket
pocketCardsStr string
boardStr string
deadStr string
리턴 EvaluationPocket

EvaluateType() 공개 정적인 메소드

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

EvaluateType() 공개 정적인 메소드

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
리턴 HandTypes

GapCount() 공개 정적인 메소드

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.
public static GapCount ( ulong mask ) : int
mask ulong two card hand mask
리턴 int

GetHashCode() 공개 메소드

Returns hash code
public GetHashCode ( ) : int
리턴 int

Hand() 공개 메소드

Default constructor
public Hand ( ) : System
리턴 System

Hand() 공개 메소드

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

HandOdds() 공개 정적인 메소드

Used to calculate the wining information about each players hand. 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 HandOdds ( string pockets, string board, string dead, long wins, long ties, long losses, long &totalHands ) : void
pockets string Array of pocket hand 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.
리턴 void

HandPlayerOpponentOdds() 공개 정적인 메소드

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 HandPlayerOpponentOdds ( 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
리턴 void

HandPlayerOpponentOdds() 공개 정적인 메소드

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 HandPlayerOpponentOdds ( ulong ourcards, ulong board, double &player, double &opponent ) : void
ourcards ulong Pocket mask for the hand.
board ulong Board mask for hand
player double Player odds as doubles
opponent double Opponent odds as doubles
리턴 void

HandPotential() 공개 정적인 메소드

Returns the positive and negative potential of the current hand. This funciton is described in Aaron Davidson's masters thesis (davidson.msc.pdf).
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
리턴 void

HandType() 공개 정적인 메소드

public static HandType ( uint handValue ) : uint
handValue uint
리턴 uint

Hands() 공개 정적인 메소드

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

Hands() 공개 정적인 메소드

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 hand (must be between 1 and 7)
리턴 IEnumerable

IsConnected() 공개 정적인 메소드

Returns true if the cards in the two card hand are connected.
public static IsConnected ( ulong mask ) : bool
mask ulong the hand to check
리턴 bool

IsSuited() 공개 정적인 메소드

This function returns true if the cards in the hand are all one suit
public static IsSuited ( ulong mask ) : bool
mask ulong hand to check for "suited-ness"
리턴 bool

Mask() 공개 정적인 메소드

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

MaskToString() 공개 정적인 메소드

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

NextCard() 공개 정적인 메소드

Parses Card strings (internal)
public static NextCard ( string cards, int &index ) : int
cards string string containing hand definition
index int iterator into card string
리턴 int

Outs() 공개 정적인 메소드

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)
리턴 int

OutsMask() 공개 정적인 메소드

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 had. Please note that this only looks at single cards that improve the hand 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)
리턴 ulong

ParseCard() 공개 정적인 메소드

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

ParseHand() 공개 정적인 메소드

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

ParseHand() 공개 정적인 메소드

public static ParseHand ( string hand, int &cards ) : ulong
hand string
cards int
리턴 ulong

ParseHand() 공개 정적인 메소드

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
리턴 ulong

PocketHand169Type() 공개 정적인 메소드

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

RandomHands() 공개 정적인 메소드

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 hand 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 hand.
duration double The amount of time to allow the generation of hands to occur. When elapsed, the iterator will terminate.
리턴 IEnumerable

RandomHands() 공개 정적인 메소드

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 hand.
trials int Number of total mask to return.
리턴 IEnumerable

RandomHands() 공개 정적인 메소드

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 hand evaluator you should remove this function along with the other interop functions in this file.
public static RandomHands ( ulong shared, ulong dead, int ncards, double duration ) : IEnumerable
shared ulong These cards must be included in the returned hand
dead ulong These cards must not be included in the returned hand
ncards int The number of cards in the returned random hand.
duration double The amount of time to allow the generation of hands to occur. When elapsed, the iterator will terminate.
리턴 IEnumerable

RandomHands() 공개 정적인 메소드

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 hand.
dead ulong Cards that must not be in the hand.
ncards int The total number of cards in the hand.
trials int The total number of random hands to return.
리턴 IEnumerable

ToString() 공개 메소드

Returns the string representing the hand.
public ToString ( ) : string
리턴 string

TopCard() 공개 정적인 메소드

public static TopCard ( System hv ) : uint
hv System
리턴 uint

ValidateHand() 공개 정적인 메소드

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

ValidateHand() 공개 정적인 메소드

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

operator() 공개 정적인 메소드

Test for inequality.
public static operator ( ) : bool
리턴 bool

프로퍼티 상세

CLUB_OFFSET 공개적으로 정적으로 프로퍼티

public static int CLUB_OFFSET
리턴 int

CardJoker 공개적으로 정적으로 프로퍼티

public static int CardJoker
리턴 int

CardMasksTable 공개적으로 정적으로 프로퍼티

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

CardTable 공개적으로 정적으로 프로퍼티

public static string[] CardTable
리턴 string[]

Clubs 공개적으로 정적으로 프로퍼티

Represents the suit - Clubs
public static int Clubs
리턴 int

DIAMOND_OFFSET 공개적으로 정적으로 프로퍼티

public static int DIAMOND_OFFSET
리턴 int

Diamonds 공개적으로 정적으로 프로퍼티

Represents the suit - Diamonds
public static int Diamonds
리턴 int

HEART_OFFSET 공개적으로 정적으로 프로퍼티

public static int HEART_OFFSET
리턴 int

Hearts 공개적으로 정적으로 프로퍼티

Represents the suit - Hearts
public static int Hearts
리턴 int

NCardsWJoker 공개적으로 정적으로 프로퍼티

public static int NCardsWJoker
리턴 int

NumberOfCards 공개적으로 정적으로 프로퍼티

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

Rank2 공개적으로 정적으로 프로퍼티

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

Rank3 공개적으로 정적으로 프로퍼티

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

Rank4 공개적으로 정적으로 프로퍼티

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

Rank5 공개적으로 정적으로 프로퍼티

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

Rank6 공개적으로 정적으로 프로퍼티

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

Rank7 공개적으로 정적으로 프로퍼티

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

Rank8 공개적으로 정적으로 프로퍼티

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

Rank9 공개적으로 정적으로 프로퍼티

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

RankAce 공개적으로 정적으로 프로퍼티

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

RankJack 공개적으로 정적으로 프로퍼티

Rank of a card showing a Jack.
public static int RankJack
리턴 int

RankKing 공개적으로 정적으로 프로퍼티

Rank of a card showing a King.
public static int RankKing
리턴 int

RankQueen 공개적으로 정적으로 프로퍼티

Rank of a card showing a Queen.
public static int RankQueen
리턴 int

RankTen 공개적으로 정적으로 프로퍼티

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

SPADE_OFFSET 공개적으로 정적으로 프로퍼티

public static int SPADE_OFFSET
리턴 int

Spades 공개적으로 정적으로 프로퍼티

Represents the suit - Spades
public static int Spades
리턴 int