AI for Games 1.1.1
Loading...
Searching...
No Matches
game2dai.graph.AshManhattan Class Reference
Inheritance diagram for game2dai.graph.AshManhattan:

Public Member Functions

 AshManhattan ()
 
 AshManhattan (double factor)
 
double getCost (GraphNode node, GraphNode target)
 
double getCost (GraphNode node, GraphNode target)
 

Private Attributes

double factor = 1.0
 

Detailed Description

This class is used to calculate the heuristic estimated-cost-to-goal.

It estimates the cost to goal as the sum of the differences between the nodes in all there primary directions. So if there were 2 nodes then the estimated-cost between them is

|x1 - x2| + |y1 - y2| + |z1 - z2| 

<br<blockquote>‍

It is also possible to apply a scaling factor to the heuristic.

Author
Peter Lager

Constructor & Destructor Documentation

◆ AshManhattan() [1/2]

game2dai.graph.AshManhattan.AshManhattan ( )

Will use a factor of 1.0 to calculate the estimated cost between nodes

◆ AshManhattan() [2/2]

game2dai.graph.AshManhattan.AshManhattan ( double  factor)

Create the heuristic.

Parameters
factorscaling factor

Member Function Documentation

◆ getCost()

double game2dai.graph.AshManhattan.getCost ( GraphNode  node,
GraphNode  target 
)

Estimate the cost between the node and the target.

Implements game2dai.graph.AstarHeuristic.


The documentation for this class was generated from the following file: