public AiTester(Settings settings, IGameVisualizer gameVisualizer, IAiFactory aiFactory, IGameFactory gameFactory) { this.settings = settings; this.gameVisualizer = gameVisualizer; this.aiFactory = aiFactory; this.gameFactory = gameFactory; }
public AiTester(Settings settings, IMapGenerator mapGenerator, IGameVisualizer gameVisualizer, IProcessMonitor monitor, IAiFactory aiFactory, IGameFactory gameFactory) { this.settings = settings; this.mapGenerator = mapGenerator; this.gameVisualizer = gameVisualizer; this.monitor = monitor; this.aiFactory = aiFactory; this.gameFactory = gameFactory; }
public AiTester(Settings settings, ILoggerFactory loggerFactory, IMapGenerator mapGenerator, IGameVisualizer gameVisualizer, Func <string, Ai> createAi, Func <Map, Ai, IGame> createGame, TextWriter textWriter, TextReader textReader) { this.settings = settings; resultsLog = loggerFactory.CreateLogger(); this.mapGenerator = mapGenerator; this.gameVisualizer = gameVisualizer; this.createAi = createAi; this.createGame = createGame; this.textWriter = textWriter; this.textReader = textReader; }
public void Setup() { loggerFactory = A.Fake <ILoggerFactory>(); settings = new Settings(); mapGenerator = A.Fake <IMapGenerator>(); gameVisualizer = A.Fake <IGameVisualizer>(); createAi = A.Fake <Func <string, Ai> >(); var game = A.Fake <IGame>(); A.CallTo(() => game.MakeStep()).Invokes(() => A.CallTo(() => game.IsOver()).Returns(true).NumberOfTimes(1)); createGame = A.Fake <Func <Map, Ai, IGame> >(); A.CallTo(() => createGame(A <Map> .Ignored, A <Ai> .Ignored)).Returns(game); textWriter = A.Fake <TextWriter>(); textReader = A.Fake <TextReader>(); }
private void RunGameToEnd(IGame game, IGameVisualizer vis) { while (!game.IsOver()) { game.MakeStep(); if (settings.Interactive) { vis.Visualize(game); if (game.AiCrashed) { Console.WriteLine(game.LastError.Message); } Console.ReadKey(); } } }