seats

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: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map struct {
	Rows           []*Row
	NumRows        int
	NumSeatsPerRow int
}

func ParseMap

func ParseMap(r io.Reader) (*Map, error)

func (*Map) AdjacentOccupiedSeats

func (m *Map) AdjacentOccupiedSeats(rowIdx, seatIdx int) int

func (*Map) NextByAdj

func (m *Map) NextByAdj() int

func (*Map) NextBySeen

func (m *Map) NextBySeen() int

func (*Map) OccupiedSeats

func (m *Map) OccupiedSeats() int

func (*Map) SeenOccupiedSeats

func (m *Map) SeenOccupiedSeats(rowIdx, seatIdx int) int

func (*Map) String

func (m *Map) String() string

type Row

type Row struct {
	States     []State
	NextStates []State
}

func ParseRow

func ParseRow(s string) (*Row, error)

func (*Row) Next

func (row *Row) Next()

func (*Row) OccupiedSeats

func (row *Row) OccupiedSeats() int

func (*Row) String

func (row *Row) String() string

type State

type State rune
const (
	Floor    State = '.'
	Empty    State = 'L'
	Occupied State = '#'
	Unknown  State = '?'
)

Jump to

Keyboard shortcuts

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