engine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area struct {
	Width  uint8
	Height uint8
}

func NewArea

func NewArea(width, height uint8) Area

func (Area) FindDirection

func (a Area) FindDirection(from, to types.Dot) types.Direction

func (Area) FitDistance

func (a Area) FitDistance(distance, divisor, gap uint8) uint8

func (Area) Fits

func (a Area) Fits(dot types.Dot) bool

func (Area) Navigate

func (a Area) Navigate(dot types.Dot) []types.Dot

func (Area) String

func (a Area) String() string

type CacherDiscoverer

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

func (*CacherDiscoverer) Discover

func (d *CacherDiscoverer) Discover(head types.Dot, area Area,
	sight Sight, scores *HashmapSight) []types.Dot

type DijkstrasDiscoverer

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

DijkstrasDiscoverer discoves paths. It is based on Dijkstra's algorithm.

Link: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm

func (*DijkstrasDiscoverer) Discover

func (d *DijkstrasDiscoverer) Discover(head types.Dot, area Area,
	sight Sight, scores *HashmapSight) []types.Dot

type Discoverer

type Discoverer interface {
	Discover(head types.Dot, area Area, sight Sight,
		scores *HashmapSight) []types.Dot
}

func NewCacherDiscoverer

func NewCacherDiscoverer(discoverer Discoverer) Discoverer

func NewDijkstrasDiscoverer

func NewDijkstrasDiscoverer(r *rand.Rand) Discoverer

type HashmapSight

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

func NewHashmapSight

func NewHashmapSight(s Sight) *HashmapSight

func (*HashmapSight) Access

func (h *HashmapSight) Access(dot types.Dot) (interface{}, bool)

func (*HashmapSight) AccessDefault

func (h *HashmapSight) AccessDefault(dot types.Dot,
	defaultValue interface{}) interface{}

func (*HashmapSight) Assign

func (h *HashmapSight) Assign(dot types.Dot, v interface{})

func (*HashmapSight) Flush

func (h *HashmapSight) Flush()

func (*HashmapSight) ForEach

func (h *HashmapSight) ForEach(f func(dot types.Dot, v interface{}))

func (*HashmapSight) Reflect

func (h *HashmapSight) Reflect() *HashmapSight

type Map

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

func NewMap

func NewMap(a Area) *Map

func (*Map) Clear

func (m *Map) Clear(dots []types.Dot)

func (*Map) GetObject

func (m *Map) GetObject(dot types.Dot) (*types.Object, bool)

func (*Map) LookAround

func (m *Map) LookAround(s Sight) *HashmapSight

func (*Map) SaveObject

func (m *Map) SaveObject(object *types.Object)

type Position

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

type Queue

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

func NewQueue

func NewQueue() *Queue

func (*Queue) Enqueued

func (q *Queue) Enqueued(dot types.Dot) bool

func (*Queue) Len

func (q *Queue) Len() int

func (*Queue) Less

func (q *Queue) Less(i, j int) bool

func (*Queue) Pop

func (q *Queue) Pop() interface{}

func (*Queue) Push

func (q *Queue) Push(x interface{})

func (*Queue) Swap

func (q *Queue) Swap(i, j int)

type Sight

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

func NewSight

func NewSight(a Area, pos types.Dot, distance uint8) Sight

func (Sight) Absolute

func (s Sight) Absolute(relX, relY uint8) types.Dot

func (Sight) Dots

func (s Sight) Dots() []types.Dot

func (Sight) Relative

func (s Sight) Relative(dot types.Dot) (uint8, uint8)

func (Sight) Seen

func (s Sight) Seen(dot types.Dot) bool

Jump to

Keyboard shortcuts

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