public TetrisAI(IGameOrchestrator gameOrchestrator, Action <uint> onNewGen, Action <INetworkDefinition> onNewBestNetwork, bool load)
 {
     this.gameOrchestrator = gameOrchestrator ?? throw new ArgumentNullException(nameof(gameOrchestrator));
     tetrisEvaluator       = new TetrisEvaluator(gameOrchestrator, false);
     evolutionAlgorithm    = CreateEvolutionAlgorithm(load);
     this.onNewGen         = onNewGen;
     this.onNewBestNetwork = onNewBestNetwork;
 }
        public void RunDemo()
        {
            var previouslyTraining = evolutionAlgorithm.RunState == RunState.Running;

            if (previouslyTraining)
            {
                PauseTraining();
            }
            var daBes    = (IBlackBox)evolutionAlgorithm.CurrentChampGenome.CachedPhenome;
            var demoMode = new TetrisEvaluator(gameOrchestrator, true);

            lock (this)
                demoing = true;
            if (previouslyTraining)
            {
                StartTraining();
            }
            demoMode.Evaluate(daBes);
            lock (this)
                demoing = false;
        }