astar

package
v0.0.0-...-ede6acb Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2023 License: BSD-2-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GameMap

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

func NewGameMap

func NewGameMap(stations *[]trains2.Station, edges *[]trains2.Edge) *GameMap

func (GameMap) NeighborsTo

func (gm GameMap) NeighborsTo(station trains2.Station) []trains2.Station

type GameMove

type GameMove struct {
	Move *trains2.Move
	Game GameState
}

func (*GameMove) StateID

func (g *GameMove) StateID() string

type GameState

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

func NewGameState

func NewGameState(
	gameMap GameMap,
	trains []trains2.Train,
	packages []trains2.Package,
	time int,
	distance map[string]int,
) *GameState

func NewGameStateAuto

func NewGameStateAuto(
	gameMap GameMap,
	trains []trains2.Train,
	packages []trains2.Package,
	time int,
) *GameState

func (*GameState) IsSolved

func (g *GameState) IsSolved() bool

func (*GameState) NextMoves

func (g *GameState) NextMoves() []GameMove

type Item

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

func NewItem

func NewItem(n Node) *Item

func (*Item) GetNode

func (i *Item) GetNode() Node

type Node

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

type PQMovies

type PQMovies []*Item

A PQMovies implements heap.Interface and holds Items.

func (PQMovies) Len

func (pq PQMovies) Len() int

func (PQMovies) Less

func (pq PQMovies) Less(i, j int) bool

func (*PQMovies) Pop

func (pq *PQMovies) Pop() any

func (*PQMovies) Push

func (pq *PQMovies) Push(x any)

func (PQMovies) Swap

func (pq PQMovies) Swap(i, j int)

type Solution

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

func NewAStarSolution

func NewAStarSolution(stations *[]trains2.Station, edges *[]trains2.Edge, packages *[]trains2.Package, trains *[]trains2.Train) *Solution

func (*Solution) Calculate

func (s *Solution) Calculate() error

func (*Solution) GetSteps

func (s *Solution) GetSteps() []trains2.Move

Jump to

Keyboard shortcuts

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