day07

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewParser

func NewParser() *participle.Parser[Game]

Types

type Card

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

func (*Card) Capture

func (card *Card) Capture(values []string) error

type Game

type Game struct {
	Hands []*Hand `parser:"@@+"`
}

func (*Game) Part1

func (game *Game) Part1() (result int)

func (*Game) Part2

func (game *Game) Part2() (result int)

type Hand

type Hand struct {
	Cards []Card `parser:"@Card @Card @Card @Card @Card"`
	Bid   int    `parser:"@Bid"`
}

func (*Hand) Summarize

func (hand *Hand) Summarize() (result HandSummary)

type HandSummary

type HandSummary struct {
	CardCounts [13]uint8
}

func (HandSummary) HandType

func (handSummary HandSummary) HandType() HandType

func (HandSummary) WildcardHandType

func (handSummary HandSummary) WildcardHandType() HandType

type HandType

type HandType uint8
const (
	HandHighCard     HandType = iota
	HandOnePair      HandType = iota
	HandTwoPair      HandType = iota
	HandThreeOfAKind HandType = iota
	HandFullHouse    HandType = iota
	HandFourOfAKind  HandType = iota
	HandFiveOfAKind  HandType = iota
)

Jump to

Keyboard shortcuts

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