2016-11-25 06:05:29 +00:00
|
|
|
|
namespace SpriteCompiler.AI
|
|
|
|
|
{
|
|
|
|
|
using System;
|
|
|
|
|
|
2016-12-12 06:41:35 +00:00
|
|
|
|
public interface IHeuristicSearchNode<A, S, T, C> : ISearchNode<A, S, T, C> where C : ICost<C>
|
|
|
|
|
{
|
|
|
|
|
C EstCost { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class HeuristicSearchNode<A, S, T, C> : AbstractSearchNode<A, S, T, C>, IHeuristicSearchNode<A, S, T, C>
|
|
|
|
|
where T : IHeuristicSearchNode<A, S, T, C>
|
|
|
|
|
where C : ICost<C>, new()
|
2016-11-25 06:05:29 +00:00
|
|
|
|
{
|
|
|
|
|
public HeuristicSearchNode(T node, S state)
|
|
|
|
|
: base(node, state)
|
|
|
|
|
{
|
2016-12-05 05:14:51 +00:00
|
|
|
|
Heuristic = new C();
|
2016-11-25 06:05:29 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public C Heuristic { get; set; }
|
2016-12-05 05:14:51 +00:00
|
|
|
|
|
2016-12-12 06:41:35 +00:00
|
|
|
|
public C EstCost
|
2016-12-05 05:14:51 +00:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return PathCost.Add(Heuristic);
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-11-25 06:05:29 +00:00
|
|
|
|
}
|
|
|
|
|
}
|