public void StartSearching(string algorithm, int branching, int depth) { if (algorithm != null) { switch (algorithm) { case ("Minimax"): this.algorithm = new Minimax(); break; case ("Alpha - Beta"): this.algorithm = new AlphaBeta(); break; default: this.algorithm = new AlphaBeta(); break; } if (this.algorithm != null) { Debug.LogFormat("Reading Tree using {0}.", algorithm); this.algorithm.Search(TreeGenerator.root, branching, depth); if (TreeGenerator.root.leafID.HasValue) { TreeNode.GetByID(TreeGenerator.root.leafID.Value).SetState(NodeState.Active); UpdateSprites(); } } } else { Debug.LogWarning("Algorithm not set. Search canceled."); } }
public void SetAlgorithm(TreeSearchAlgorithm algorithm) { this.algorithm = algorithm; }