namespace SpriteCompiler.AI
{
using Adapters;
using System.Collections.Generic;
public class BestFirstSearch : ISearch
where T : ISearchNode
where C : IPathCost
{
protected readonly AbstractAISearch search;
protected readonly IQueue fringe;
public BestFirstSearch(AbstractAISearch search, IQueue fringe)
{
this.search = search;
this.fringe = fringe;
}
public BestFirstSearch(AbstractAISearch search)
{
this.search = search;
this.fringe = new QueueAdapter();
}
public IEnumerable Search(ISearchProblem problem, S initialState)
{
fringe.Clear();
return search.Search(problem, fringe, initialState);
}
public IEnumerable ExtendSearch(ISearchProblem problem)
{
return search.ExtendSearch(problem, fringe);
}
}
}