-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
val antonini
committed
Apr 30, 2024
1 parent
31217ed
commit 412633c
Showing
4 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package astar | ||
|
||
type heuristic int | ||
|
||
const ( | ||
// Manhattan heuristic. | ||
man heuristic = iota | ||
// Euclidean heuristic. | ||
dd | ||
) | ||
|
||
// Option is a functional option for the pathfinder. | ||
type Option func(o *Options) | ||
|
||
// Options contains the options for the pathfinder. | ||
type Options struct { | ||
diagonals bool | ||
heuristic heuristic | ||
} | ||
|
||
// WithDiagonals enables diagonal movement in the search space. | ||
func WithDiagonals() Option { | ||
return Option(func(o *Options) { | ||
o.diagonals = true | ||
}) | ||
} |