public void Compete_EngineNineDepthsBeetsEngineOneDepth() { var engine = TicTacToeBassicTests.GetSearchEngine(1, ParallelismMode.FirstLevelOnly); var competitionResult = CompetitionManager.Compete(engine, engine, Utils.GetEmptyTicTacToeState(), 1, 9, 100); var finalState = (TicTacToeState)competitionResult.States.Last(); Assert.AreEqual(TicTacToeState.MinValue, finalState.Evaluate(0, new List <IState>()), "Min should have won"); Assert.AreEqual(finalState, competitionResult.FinalState, $"{nameof(competitionResult.FinalState)} is different than the last state in {nameof(competitionResult.States)}"); Assert.IsTrue(competitionResult.MaxTotalTime < competitionResult.MinTotalTime, "Min should have searched for longer then Max"); Assert.IsTrue(competitionResult.MaxLongestSearch < competitionResult.MinLongestSearch, "Min's longest should have searched for longer then Max's longest"); Assert.IsTrue(competitionResult.MaxLongestSearch < competitionResult.MaxTotalTime, "Total time should always be bigger than logest search time"); }
public void DifferentEngines() { IDeterministicState startState = Utils.GetEmptyTicTacToeState(); int searchDepth = 5; int playDepth = 100; SearchEngine engine1 = new SearchEngine(); SearchEngine engine2 = new SearchEngine(); CompetitionResult competitionResult = CompetitionManager.Compete(engine1, engine2, startState, searchDepth, searchDepth, playDepth); // Print some of the results Console.WriteLine("Max Search Time " + competitionResult.MaxTotalTime); Console.WriteLine("Min Search Time " + competitionResult.MinTotalTime); Console.WriteLine("Final Score " + competitionResult.FinalState.Evaluate(0, new List <IState>())); }