Ejemplo n.º 1
0
        public bool TryRunNextGame()
        {
            _currentGameNumber++;
            if (_currentGameNumber >= Const.ParamsFromMainFormToGame.Count)
            {
                return(false);
            }
            var game = Const.ParamsFromMainFormToGame[_currentGameNumber];

            _animator      = new Animator();
            _currentState  = new State();
            _engine        = new Engine();
            _previousFrame = null;

            string temp;

            if (!game.firstIsControlledByHuman)
            {
                temp = game.firstProgramAddress;
                if (temp != "")
                {
                    _currentState.players[0].programAddress = temp;
                }
            }
            if (!game.secondIsControlledByHuman)
            {
                temp = game.secondProgramAddress;
                if (temp != "")
                {
                    _currentState.players[1].programAddress = temp;
                }
            }
            Const.FramesPerTurn = Const.DefaultFramesPerTurn * game.AnimationSpeedInPercent / 100;

            _turnReceiver = new TurnReceiver(_currentState, _engine, game.javaPath, game.ThisIsReplayGame);
            if (game.ThisIsReplayGame)
            {
                bool success = _turnReceiver.TryLoadReplay(game.replayPath);
                if (!success)
                {
                    _currentState.Message    = "Не удалось загрузить повтор. Нажмите Enter";
                    _currentState.IsFinished = true;
                }
            }
            _animator.Run(_currentState);

            return(true);
        }
Ejemplo n.º 2
0
 void AddTurnComments(State state, Turn turn)
 {
     state.turnCommentList.Add(TurnReceiver.GetShortTurnComment(turn));
     state.inputList.Add(turn.input);
     state.outputList.Add(TurnReceiver.GetOutputWithComments(turn));
 }