2016-12-12 06:41:35 +00:00
|
|
|
|
namespace SpriteCompiler.AI
|
2016-11-27 05:39:50 +00:00
|
|
|
|
{
|
2016-12-12 06:41:35 +00:00
|
|
|
|
using Queue;
|
|
|
|
|
|
|
|
|
|
public class TreeSearch<A, S, T, C> : AbstractSearchStrategy<A, S, T, C>
|
2016-11-27 05:39:50 +00:00
|
|
|
|
where T : ISearchNode<A, S, T, C>
|
2016-12-12 06:41:35 +00:00
|
|
|
|
where C : ICost<C>
|
2016-11-27 05:39:50 +00:00
|
|
|
|
{
|
|
|
|
|
public TreeSearch(INodeExpander<A, S, T, C> expander)
|
|
|
|
|
: base(expander)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Generic tree search. See page 72 in Russell and Norvig
|
|
|
|
|
/// </summary>
|
|
|
|
|
protected override void AddNodes(IQueue<T> fringe, T node, ISearchProblem<A, S, C> problem)
|
|
|
|
|
{
|
2016-12-12 06:41:35 +00:00
|
|
|
|
fringe.AddRange(Expander.Expand(problem, node));
|
2016-11-27 05:39:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|