public void Options(ref Dictionary <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); if (!optionNodes.ContainsKey(optionNode.Hash)) { optionNodes.Add(optionNode.Hash, optionNode); } } }
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(); } }