Documentation
¶
Index ¶
Constants ¶
View Source
const ExploreBatch = 200
Variables ¶
View Source
var AllDirections = []MoveDirection{MoveUp, MoveRight, MoveDown, MoveLeft}
View Source
var DeadEndNode = &Node{}
DeadEndNode represent constant reference for termination of dead end paths in search graphs
Functions ¶
This section is empty.
Types ¶
type BoxMove ¶
type BoxMove struct { BoxIndex int Direction MoveDirection }
type Map ¶
func (Map) InitialBoxPositions ¶
type MetricCalculator ¶
type MetricCalculator struct {
// contains filtered or unexported fields
}
func NewMetricCalculator ¶
func NewMetricCalculator(m Map, deadzones MoveDomain) MetricCalculator
func (MetricCalculator) String ¶
func (mc MetricCalculator) String() string
type MoveDirection ¶
type MoveDirection int
const ( MoveUp MoveDirection = iota MoveRight MoveDown MoveLeft )
func FindDirections ¶
func FindDirections(domain MoveDomain, from, to Pos) ([]MoveDirection, error)
func (MoveDirection) MarshalJSON ¶
func (d MoveDirection) MarshalJSON() ([]byte, error)
func (MoveDirection) RotateCCW ¶
func (d MoveDirection) RotateCCW() MoveDirection
func (MoveDirection) RotateCW ¶
func (d MoveDirection) RotateCW() MoveDirection
func (MoveDirection) String ¶
func (d MoveDirection) String() string
type MoveDomain ¶
type MoveDomain struct {
// contains filtered or unexported fields
}
func NewMoveDomain ¶
func NewMoveDomain() MoveDomain
func NewMoveDomainFromMap ¶
func NewMoveDomainFromMap(m Map, boxPositions []Pos, start Pos) MoveDomain
NewMoveDomainFromMap generate move domain from Map (considering only walls), box positions and starting position TODO: refactor to create state with predefined moves
func (*MoveDomain) AddPosition ¶
func (md *MoveDomain) AddPosition(pos Pos)
func (*MoveDomain) HasPosition ¶
func (md *MoveDomain) HasPosition(pos Pos) bool
func (MoveDomain) HashBytes ¶
func (md MoveDomain) HashBytes() []byte
func (*MoveDomain) ListPosition ¶
func (md *MoveDomain) ListPosition() []Pos
func (MoveDomain) String ¶
func (md MoveDomain) String() string
type Node ¶
type Node struct { ID int64 Metric int Hash uint64 Fail NodeFail State // Parent node for easy backward traverse Parent *Node // Moves represent possible moves from current state with pointer to corresponding states Moves map[BoxMove]*Node }
func (Node) MarshalJSON ¶
type Pos ¶
func SortedPositions ¶
func (Pos) MoveAgainstDirection ¶
func (p Pos) MoveAgainstDirection(d MoveDirection) Pos
func (Pos) MoveInDirection ¶
func (p Pos) MoveInDirection(d MoveDirection) Pos
func (Pos) Neighbours ¶
type Solver ¶
func (Solver) GetDebug ¶
func (s Solver) GetDebug() SolverDebug
func (Solver) GetPath ¶
func (s Solver) GetPath() ([]MoveDirection, error)
type SolverDebug ¶
type State ¶
type State struct { MoveDomain BoxPositions []Pos }
Click to show internal directories.
Click to hide internal directories.