day07

package
v0.0.0-...-02e4340 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(a, b *Hand) int

Compare returns the result of comparing the given hands.

func CompareWithJoker

func CompareWithJoker(a, b *Hand) int

CompareWithJoker returns the result of comparing the given hands.

func CompareWithStrength

func CompareWithStrength(a, b *Hand, strength func(*Hand) int, cardStrengths map[rune]int) int

CompareWithStrength returns the result of comparing the given hands.

func TotalWinnings

func TotalWinnings(input []string) int

TotalWinnings returns the total winnings for the given input.

func TotalWinningsWithCompareFunc

func TotalWinningsWithCompareFunc(input []string, compareFunc func(a, b *Hand) int) int

func TotalWinningsWithJoker

func TotalWinningsWithJoker(input []string) int

TotalWinningsWithJoker returns the total winnings for the given input.

Types

type Hand

type Hand struct {
	Cards     []rune
	CardCount map[rune]int
	Bet       int
}

Hand represents a hand of cards.

func NewHand

func NewHand(cards []rune, bet int) *Hand

NewHand returns a new hand from the given cards.

func (*Hand) Strength

func (h *Hand) Strength() int

Strength returns the strength of the hand.

func (*Hand) StrengthWithJoker

func (h *Hand) StrengthWithJoker() int

StrengthWithJoker returns the strength of the hand taking advantage of joker.

Jump to

Keyboard shortcuts

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