mirror of
https://github.com/lscharen/iigs-sprite-compiler.git
synced 2024-10-14 00:23:39 +00:00
26 lines
784 B
C#
26 lines
784 B
C#
namespace SpriteCompiler.AI
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using Queue;
|
|
|
|
public abstract class AbstractStateSpaceSearch<A, S, T, C> : ISearch<A, S, T, C>
|
|
where T : ISearchNode<A, S, T, C>
|
|
where C : ICost<C>
|
|
{
|
|
protected readonly ISearchStrategy<A, S, T, C> strategy;
|
|
private readonly Func<IQueue<T>> fringe;
|
|
|
|
public AbstractStateSpaceSearch(ISearchStrategy<A, S, T, C> strategy, Func<IQueue<T>> fringe)
|
|
{
|
|
this.strategy = strategy;
|
|
this.fringe = fringe;
|
|
}
|
|
|
|
public virtual IEnumerable<T> Search(ISearchProblem<A, S, C> problem, S initialState)
|
|
{
|
|
return strategy.Search(problem, fringe(), initialState);
|
|
}
|
|
}
|
|
}
|