d14

package
v0.0.0-...-f50ab9b Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const REAL_DATA = `` /* 19414-byte string literal not displayed */
View Source
const TEST_DATA = `498,4 -> 498,6 -> 496,6
503,4 -> 502,4 -> 502,9 -> 494,9`

Variables

This section is empty.

Functions

This section is empty.

Types

type Block

type Block struct {
	BlockType BlockType
	X         int
	Y         int
}

func NewBlock

func NewBlock(x int, y int, blockType BlockType) *Block

func (*Block) String

func (b *Block) String() string

type BlockType

type BlockType string
const AIR BlockType = "."
const ORIGIN BlockType = "+"
const ROCK BlockType = "#"
const SAND BlockType = "o"
const SOURCE BlockType = "+"

type Puzzle

type Puzzle struct {
	Lines    []string
	Rows     int
	Cols     int
	Grid     map[string]*Block
	Origin   *Block
	HasFloor bool
	Floor    int
	// contains filtered or unexported fields
}

func NewPuzzle

func NewPuzzle() *Puzzle

func NewPuzzleWithData

func NewPuzzleWithData(VERBOSE bool, input string) *Puzzle

func (*Puzzle) AddSand

func (puzzle *Puzzle) AddSand(max_y int) (bool, *Block, int)

func (*Puzzle) Bounds

func (p *Puzzle) Bounds() (int, int, int, int)

func (*Puzzle) Contains

func (p *Puzzle) Contains(x int, y int) bool

func (*Puzzle) Debug

func (p *Puzzle) Debug() string

func (*Puzzle) DebugFrame

func (p *Puzzle) DebugFrame(min_x int, min_y int, max_x int, max_y int) string

func (*Puzzle) Get

func (p *Puzzle) Get(x int, y int) *Block

func (*Puzzle) Load

func (puzzle *Puzzle) Load(VERBOSE bool, input string)

func (*Puzzle) Part1

func (puzzle *Puzzle) Part1()

func (*Puzzle) Part2

func (puzzle *Puzzle) Part2()

func (*Puzzle) Put

func (p *Puzzle) Put(x int, y int, value BlockType) *Block

func (*Puzzle) Run

func (puzzle *Puzzle) Run()

func (*Puzzle) SetFloor

func (puzzle *Puzzle) SetFloor(floor int)

func (*Puzzle) Size

func (p *Puzzle) Size() int

Jump to

Keyboard shortcuts

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