Skip to content

Commit

Permalink
localised node
Browse files Browse the repository at this point in the history
  • Loading branch information
val antonini committed Apr 28, 2024
1 parent 81859bb commit e357416
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
12 changes: 12 additions & 0 deletions astar.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ func getSuccessors(vec Vec2, width, height int) []Vec2 {
return results
}

// node is a node in the search space.
type node struct {
pos Vec2 // Position
parent *node // Parent node
g int // Cost from start node
h int // Heuristic cost to end node
f int // F = G + H
weight int // Weight of the node (0 = impassable)
open bool // In open list
closed bool // In closed list
}

// newSearchSpace creates a new search space from the given weights.
func newSearchSpace(weights Grid[int]) Grid[node] {
grid := NewGrid[node](weights.Width, weights.Height)
Expand Down
13 changes: 0 additions & 13 deletions node.go

This file was deleted.

0 comments on commit e357416

Please sign in to comment.