예제 #1
0
        /// <summary>
        /// Performs a deep copy of this game instance and returns the result.
        /// </summary>
        /// <returns></returns>
        public Game Clone(bool logging = false)
        {
            var gameConfig = _gameConfig.Clone();

            gameConfig.Logging = logging;
            var game = new Game(gameConfig, false)
            {
                CloneIndex = $"{this.CloneIndex}[{NextCloneIndex++}]"
            };

            game.Player1.Stamp(Player1);
            game.Player2.Stamp(Player2);
            game.Stamp(this);

            game.TaskStack.Stamp(TaskStack);
            game.TaskQueue.Stamp(TaskQueue);

            // set indexer to avoid conflicts ...
            game.SetIndexer(_idIndex, _oopIndex);

            return(game);
        }