示例#1
0
        //public void Options(ref Dictionary<string, OptionNode> optionNodes)
        //{
        //	var options = _game.ControllerById(_playerId).Options(!_isOpponentTurn);

        //	foreach (var option in options)
        //	{
        //		var optionNode = new OptionNode(this, _game, _playerId, option, Scoring);
        //		if (!optionNodes.ContainsKey(optionNode.Hash))
        //			optionNodes.Add(optionNode.Hash, optionNode);
        //	}
        //}
        public void Options(ref ConcurrentDictionary <string, OptionNode> optionNodes)
        {
            List <PlayerTask> options = _game.ControllerById(_playerId).Options(/*!_isOpponentTurn*/);

            foreach (PlayerTask option in options)
            {
                var optionNode = new OptionNode(this, _game, _playerId, option, Scoring);
                optionNodes.TryAdd(optionNode.Hash, optionNode);
            }
        }
示例#2
0
        public void Options(ref Dictionary <string, OptionNode> optionNodes)
        {
            var options = _game.ControllerById(_playerId).Options(!_isOpponentTurn);

            foreach (var option in options)
            {
                var optionNode = new OptionNode(this, _game, _playerId, option, Scoring);
                if (!optionNodes.ContainsKey(optionNode.Hash))
                {
                    optionNodes.Add(optionNode.Hash, optionNode);
                }
            }
        }
示例#3
0
        public OptionNode(OptionNode parent, Game game, int playerId, PlayerTask playerTask, IScore scoring)
        {
            _parent    = parent;
            _game      = game.Clone();        // create clone
            _playerId  = playerId;
            PlayerTask = playerTask;
            Scoring    = scoring;

            if (!IsRoot)
            {
                Execute();
            }
        }