y2024d06

package
v0.0.0-...-54dfd1d Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Part1

func Part1(tileMap TileMap, guard Guard) int

func Part2

func Part2(tileMap TileMap, guard Guard) int

func Solve

func Solve(inputPath string)

Types

type Coord2D

type Coord2D struct {
	X, Y int
}

func (Coord2D) Add

func (c Coord2D) Add(c2 Coord2D) Coord2D

type Direction

type Direction uint8
const (
	UP Direction = iota
	RIGHT
	DOWN
	LEFT
)

type Guard

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

func NewGuard

func NewGuard(position Coord2D, direction Direction) Guard

func (*Guard) MoveOneStep

func (g *Guard) MoveOneStep(tileMap TileMap) (withinBounds bool)

func (*Guard) MoveOneStepP2

func (g *Guard) MoveOneStepP2(tileMap TileMap) (withinBounds bool)

func (*Guard) TurnRight

func (g *Guard) TurnRight()

func (*Guard) UniqueVisitedTiles

func (g *Guard) UniqueVisitedTiles() int

type State

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

type Tile

type Tile uint8
const (
	OBSTACLE Tile = iota
	EMPTY
	OUT_OF_BOUNDS
)

type TileMap

type TileMap [][]Tile

func (TileMap) GetTile

func (tm TileMap) GetTile(position Coord2D) Tile

func (TileMap) String

func (tm TileMap) String() string

func (TileMap) UpdateTile

func (tm TileMap) UpdateTile(position Coord2D, newTile Tile)

Jump to

Keyboard shortcuts

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