day07

package
v0.0.0-...-9c9a4a3 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CardValuesP1 = map[rune]int{
	'2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
	'9': 9, 'T': 10, 'J': 11, 'Q': 12, 'K': 13, 'A': 14,
}
View Source
var CardValuesP2 = map[rune]int{
	'J': 1, '2': 2, '3': 3, '4': 4, '5': 5, '6': 6, '7': 7, '8': 8,
	'9': 9, 'T': 10, 'Q': 12, 'K': 13, 'A': 14,
}

Functions

func GetCardsAndCountsP1

func GetCardsAndCountsP1(s string, values map[rune]int) map[int]int

func GetCardsAndCountsP2

func GetCardsAndCountsP2(s string, values map[rune]int) map[int]int

Types

type Hand

type Hand struct {
	Hand string
	Type HandType
	// contains filtered or unexported fields
}

func NewHand

func NewHand(s string, values map[rune]int, rev map[int]rune, counter counterFunc) Hand

func (Hand) Against

func (h Hand) Against(other Hand, values map[rune]int) int

type HandType

type HandType int
const (
	HighCard HandType = iota
	OnePair
	TwoPair
	ThreeOfAKind
	FullHouse
	FourOfAKind
	FiveOfAKind
)

type Play

type Play struct {
	Hand Hand
	Bid  int
}

type Plays

type Plays struct {
	// contains filtered or unexported fields
}

func ParsePlays

func ParsePlays(s string, values map[rune]int, counter counterFunc) Plays

func (Plays) Len

func (p Plays) Len() int

func (Plays) Less

func (p Plays) Less(i, j int) bool

func (Plays) Swap

func (p Plays) Swap(i, j int)

func (Plays) TotalWins

func (p Plays) TotalWins() int

Jump to

Keyboard shortcuts

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