maps

package
v0.0.0-...-0fc0a22 Latest Latest
Warning

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

Go to latest
Published: May 16, 2021 License: CC-BY-SA-4.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GrowthAround

func GrowthAround(m *Map, idx int) chan Growth

func Shortest

func Shortest(m *Map, from, to int) []int

Shortest calculates the "shortest" path between two points. An implementation of Dijkstra's algorithm.

TODO: make the distance metric configurable.

Types

type Growth

type Growth struct {
	Idx       int
	Elevation float64
	D         float64
}

type Map

type Map struct {
	Width, Height int

	InvMaxScale float64

	// Elevation is the distance above sea level.
	Elevation []float64
}

func NewMap

func NewMap(width, height int) *Map

func (*Map) Fill

func (m *Map) Fill(n *noise.Fractal)

func (*Map) IndexOf

func (m *Map) IndexOf(x, y int) int

func (*Map) Neighbors

func (m *Map) Neighbors(idx int) []node

func (*Map) Neighbors2

func (m *Map) Neighbors2(idx int) []int

type Origin

type Origin int8
var (
	Start Origin = 1
	End   Origin = 2
	Both         = Start | End
)

Jump to

Keyboard shortcuts

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