Documentation ¶
Index ¶
- Constants
- Variables
- type Grid
- type Item
- type PriorityQueue
- type World
- func (this *World) CreatePQ(gs []*Grid) *PriorityQueue
- func (this *World) Direct(from, to *Grid) (ret []*Grid)
- func (this *World) FindStep() (step []*Grid, find bool)
- func (this *World) LoadWorld(world string) bool
- func (this *World) Neighbors(posX, posY int) []*Grid
- func (this *World) PQPop(pq *PriorityQueue) *Grid
- func (this *World) Print()
- func (this *World) PrintInfo()
- func (this *World) SetPathState(step []*Grid)
- func (this *World) SetStepState(step []*Grid)
- func (this *World) Stand() *Grid
- func (this *World) Straight(start, end *Grid, retPath bool) (path []*Grid, straight bool)
- func (this *World) Target() *Grid
- func (this *World) UpdateH(g *Grid)
Constants ¶
View Source
const ( ROW int = 8 COL int = 8 )
Variables ¶
View Source
var DirectOffset = [8][2]int{{0, 1}, {0, -1}, {-1, 0}, {1, 0}, {-1, 1}, {1, 1}, {-1, -1}, {1, -1}}
相邻格子偏移量 上,下,左,右,上左,上右,下左,下右
Functions ¶
This section is empty.
Types ¶
type PriorityQueue ¶
type PriorityQueue []*Item
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type World ¶
type World struct {
// contains filtered or unexported fields
}
数组第一维代表1行row
func (*World) CreatePQ ¶
func (this *World) CreatePQ(gs []*Grid) *PriorityQueue
func (*World) PQPop ¶
func (this *World) PQPop(pq *PriorityQueue) *Grid
func (*World) SetPathState ¶
func (*World) SetStepState ¶
Click to show internal directories.
Click to hide internal directories.