day_21

package
v0.0.0-...-07010e4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Part1

func Part1()

func Part2

func Part2()

Types

type ConstEvaler

type ConstEvaler struct {
	Value int
}

func (ConstEvaler) CanEval

func (e ConstEvaler) CanEval() bool

func (ConstEvaler) Eval

func (e ConstEvaler) Eval(Tree) (int, bool)

func (ConstEvaler) MustEvalTo

func (e ConstEvaler) MustEvalTo(tree Tree, n int)

type Evaler

type Evaler interface {
	Eval(Tree) (int, bool)
	MustEvalTo(Tree, int)
	CanEval() bool
}

type ExprEvaler

type ExprEvaler struct {
	XID, YID string

	Op Op
	// contains filtered or unexported fields
}

func (*ExprEvaler) CanEval

func (e *ExprEvaler) CanEval() bool

func (*ExprEvaler) Eval

func (e *ExprEvaler) Eval(tree Tree) (int, bool)

func (*ExprEvaler) MustEvalTo

func (e *ExprEvaler) MustEvalTo(tree Tree, n int)

type HumanEvaler

type HumanEvaler struct {
	Val int
}

func (*HumanEvaler) CanEval

func (e *HumanEvaler) CanEval() bool

func (*HumanEvaler) Eval

func (e *HumanEvaler) Eval(Tree) (int, bool)

func (*HumanEvaler) MustEvalTo

func (e *HumanEvaler) MustEvalTo(tree Tree, n int)

type Op

type Op string
const (
	Plus  Op = "+"
	Minus Op = "-"
	Mult  Op = "*"
	Div   Op = "/"
	Eq    Op = "="
)

func (Op) IsValid

func (o Op) IsValid() bool

type Tree

type Tree map[string]Evaler

func (Tree) CanEval

func (tree Tree) CanEval(id string) bool

func (Tree) Eval

func (tree Tree) Eval(id string) (int, bool)

func (Tree) MustEvalTo

func (tree Tree) MustEvalTo(id string, n int)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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