algorithm

package
v0.0.0-...-6c09dce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InvertedSuitMap = map[string]int{
	"C": 1, "D": 2, "H": 3, "S": 4,
}
View Source
var InvertedValMap = map[string]int{
	"A": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "10": 10, "J": 11, "Q": 12, "K": 13,
}
View Source
var SuitMap = map[int]string{
	1: "C", 2: "D", 3: "H", 4: "S",
}
View Source
var ValMap = map[int]string{
	1: "A", 2: "2", 3: "3", 4: "4", 5: "5", 6: "6", 7: "7", 8: "8", 9: "9", 10: "10", 11: "J", 12: "Q", 13: "K",
}

Functions

func CardCombinations

func CardCombinations(deck Hand, k int) chan Hand

func CardLessThan

func CardLessThan(card1, card2 Card) bool

Comparisons

func Combinations

func Combinations(array []interface{}, k int) chan []interface{}

func FlushLessThan

func FlushLessThan(hand1, hand2 Hand5) bool

func FourOfAKindLessThan

func FourOfAKindLessThan(hand1, hand2 Hand5) bool

func FullHouseLessThan

func FullHouseLessThan(hand1, hand2 Hand5) bool

func GetMatchesInHand

func GetMatchesInHand(hand Hand, matchSizes map[int]int) map[int][]Hand

// Orders the matches by number (ie 2, 3, 4) and then value of match

func HandLessThan

func HandLessThan(hand1 Hand, hand2 Hand) bool

func HighCardLessThan

func HighCardLessThan(hand1, hand2 Hand5) bool

func IsFlush

func IsFlush(hand Hand) (bool, []int)

func IsFlush5

func IsFlush5(hand Hand5) (bool, int)

func IsFourOfAKind

func IsFourOfAKind(hand Hand) bool

func IsFourOfAKind5

func IsFourOfAKind5(hand Hand5) bool

func IsFullHouse

func IsFullHouse(hand Hand) bool

func IsFullHouse5

func IsFullHouse5(hand Hand5) bool

func IsPair

func IsPair(hand Hand) bool

func IsPair5

func IsPair5(hand Hand5) bool

func IsRoyalFlush

func IsRoyalFlush(hand Hand) bool

general validators

func IsRoyalFlush5

func IsRoyalFlush5(hand Hand5) bool

func IsStraight

func IsStraight(hand Hand) bool

func IsStraight5

func IsStraight5(hand Hand5) bool

func IsStraightFlush

func IsStraightFlush(hand Hand) bool

func IsStraightFlush5

func IsStraightFlush5(hand Hand5) bool

func IsThreeOfAKind

func IsThreeOfAKind(hand Hand) bool

func IsThreeOfAKind5

func IsThreeOfAKind5(hand Hand5) bool

func IsTwoPair

func IsTwoPair(hand Hand) bool

func IsTwoPair5

func IsTwoPair5(hand Hand5) bool

func PairLessThan

func PairLessThan(hand1, hand2 Hand5) bool

func RoyalFlushLessThan

func RoyalFlushLessThan(hand1, hand2 Hand5) bool

func StraightFlushLessThan

func StraightFlushLessThan(hand1, hand2 Hand5) bool

func StraightLessThan

func StraightLessThan(hand1, hand2 Hand5) bool

func ThreeOfAKindLessThan

func ThreeOfAKindLessThan(hand1, hand2 Hand5) bool

func TwoPairLessThan

func TwoPairLessThan(hand1, hand2 Hand5) bool

Types

type Card

type Card struct {
	Value int
	Suit  int
}

func GetHighCard

func GetHighCard(hand Hand) Card

type Hand

type Hand []Card

func MakeDeck

func MakeDeck(exclusionSet map[Card]bool) Hand

func (Hand) Hash

func (hand Hand) Hash() string

type Hand2

type Hand2 [2]Card

type Hand5

type Hand5 [5]Card

func BestHand

func BestHand(hand Hand) Hand5

Get best 5 card hand functions

func GetFiveHighestCards

func GetFiveHighestCards(hand Hand) Hand5

func GetFlush

func GetFlush(hand Hand) Hand5

func GetFourOfAKind

func GetFourOfAKind(hand Hand) Hand5

func GetFullHouse

func GetFullHouse(hand Hand) Hand5

func GetPair

func GetPair(hand Hand) Hand5

func GetRoyalFlush

func GetRoyalFlush(hand Hand) Hand5

func GetStraight

func GetStraight(hand Hand) Hand5

func GetStraightFlush

func GetStraightFlush(hand Hand) Hand5

func GetThreeOfAKind

func GetThreeOfAKind(hand Hand) Hand5

func GetTwoPair

func GetTwoPair(hand Hand) Hand5

func (Hand5) Hash

func (hand Hand5) Hash() string

type Hand7

type Hand7 [7]Card

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL