public void InitOnce() { _configMock = TestHelper.GetFakeConfig(); _configMock.ConfigValue("Game.Tetris.Extractor.Samples", _numSamples); _configMock.ConfigValue("Game.Tetris.Timing.MoreTimeToAnalyze", 0); _configMock.ConfigValue("Game.Tetris.Timing.LessWaitTimeAfterDrop", 0); _configMock.ConfigValue("Game.Tetris.Timing.LessFallTimeBeforeDrop", 0); _quantizer = new MorphologyQuantizer(_configMock.Object); _extractor = new MorphologyExtractor(_configMock.Object); _boardExtractor = new BoardExtractor(new MorphologyMatcher()); _screenExtractor = new ScreenExtractor(); _search = new TwoPieceSearch(new YiyuanLeeHeuristic()); _clockMock = new Mock <IClock>(); _executorMock = new Mock <IExecutor>(); }
public TetrisAgent(IConfig config, IClock clock, IQuantizer quantizer, IExecutor exceutor, IExtractor extractor, IBoardExtractor boardExtractor, IScreenExtractor screenExtractor, ISearch search) { Config = config; Clock = clock; Quantizer = quantizer; Executor = exceutor; Extractor = extractor; BoardExtractor = boardExtractor; ScreenExtractor = screenExtractor; Search = search; _visualize = IsVisualize; // init timing config _hitTime = TimeSpan.FromMilliseconds(Config.Read <int>("Robot.Actuator.Hit.Time")); _hitDelayAfter = TimeSpan.FromMilliseconds(Config.Read <int>("Robot.Actuator.Hit.DelayAfter")); MoreTimeToAnalyze = TimeSpan.FromMilliseconds(Config.Read <int>("Game.Tetris.Timing.MoreTimeToAnalyze")); LessFallTimeBeforeDrop = TimeSpan.FromMilliseconds(Config.Read <int>("Game.Tetris.Timing.LessFallTimeBeforeDrop")); LessWaitTimeAfterDrop = TimeSpan.FromMilliseconds(Config.Read <int>("Game.Tetris.Timing.LessWaitTimeAfterDrop")); Init(); }
public void Init() { _screenExtractor = new ScreenExtractor(); _quantizer = new MorphologyQuantizer(TestHelper.GetFakeConfig().Object); }