day19

package
v0.0.0-...-38c8f7e Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdjacentRule

type AdjacentRule []Rule

func (AdjacentRule) Match

func (r AdjacentRule) Match(rules map[RuleID]Rule, cache map[CacheKey]bool, message string) (ret bool)

func (AdjacentRule) String

func (r AdjacentRule) String() string

type CacheKey

type CacheKey struct {
	// It is poor that we keep regenerating this with String() calls. It might
	// be nicer for each rule to become a struct, which stores its original
	// string representation alongside the rule.
	RuleDef string

	Message string
}

type Input

type Input struct {
	Rules    map[RuleID]Rule
	Messages []string
}

func ParseInput

func ParseInput(in [][]string) (*Input, error)

func (*Input) Part1

func (in *Input) Part1() int

func (*Input) Part2

func (in *Input) Part2() int

type OrRule

type OrRule []Rule

func (OrRule) Match

func (r OrRule) Match(rules map[RuleID]Rule, cache map[CacheKey]bool, message string) (ret bool)

func (OrRule) String

func (r OrRule) String() string

type RefRule

type RefRule RuleID

func (RefRule) Match

func (r RefRule) Match(rules map[RuleID]Rule, cache map[CacheKey]bool, message string) (ret bool)

func (RefRule) String

func (r RefRule) String() string

type Rule

type Rule interface {
	Match(rules map[RuleID]Rule, cache map[CacheKey]bool, message string) bool
	fmt.Stringer
}

type RuleID

type RuleID int

type TerminalRule

type TerminalRule byte

func (TerminalRule) Match

func (r TerminalRule) Match(_ map[RuleID]Rule, _ map[CacheKey]bool, message string) bool

func (TerminalRule) String

func (r TerminalRule) String() string

Jump to

Keyboard shortcuts

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