A* Implemented, Task2 ready #10
@ -68,7 +68,7 @@ A* main loop:
|
|||||||
|
|
||||||
Successor function:
|
Successor function:
|
||||||
|
|
||||||
private List<Nodes> GetAdjacentNodes(Vector2 currentPos)
|
private List<Nodes> GetAdjacentNodes(Vector2 currentPos)
|
||||||
{
|
{
|
||||||
var adjacentNodes = new List<Nodes>()
|
var adjacentNodes = new List<Nodes>()
|
||||||
|
|
||||||
@ -98,7 +98,6 @@ Successor function:
|
|||||||
|
|
||||||
Heuristic function:
|
Heuristic function:
|
||||||
|
|
||||||
// Heuristic function, Manhattan method.
|
|
||||||
public int ComputeHScore(Vector2 currentNode, Vector2 endNote)
|
public int ComputeHScore(Vector2 currentNode, Vector2 endNote)
|
||||||
{
|
{
|
||||||
return (int)(Math.Abs(endNote.X - currentNode.X) + Math.Abs(endNote.Y - currentNode.Y));
|
return (int)(Math.Abs(endNote.X - currentNode.X) + Math.Abs(endNote.Y - currentNode.Y));
|
||||||
|
Loading…
Reference in New Issue
Block a user