using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace SpriteCompiler.AI { public class DepthFirstSearch : ISearch where T : ISearchNode where C : IPathCost, new() { protected readonly AbstractAISearch search; protected readonly IQueue fringe = new Lifo(); public DepthFirstSearch(AbstractAISearch search) { this.search = search; } public virtual IEnumerable Search(ISearchProblem problem, S initialState) { fringe.Clear(); return search.Search(problem, fringe, initialState); } public virtual IEnumerable ExtendSearch(ISearchProblem problem) { return search.ExtendSearch(problem, fringe); } public void InitializeSearch(S initialState) { search.InitializeSearch(fringe, initialState); } public ISearchStepInfo SearchStep(ISearchProblem problem) { return search.SearchStep(problem, fringe); } } }