public void startStop() { startButton.SetActive(!startButton.activeInHierarchy); stopButton.SetActive(!stopButton.activeInHierarchy); currentBoard b = GetComponent <currentBoard>(); b.isPlaying = !startButton.activeInHierarchy; if (b.isPlaying) { addMove("<Start Game>"); b.startGame(AiP1.isOn, AiP2.isOn); AiP1.interactable = false; AiP2.interactable = false; } else { AiP1.interactable = true; AiP2.interactable = true; } }
//What AI will do when the currentBoard asks for AI's move public Vector2 onTurn(Dictionary <Vector2, Spot> currentState, currentBoard cb) { Dictionary <Vector2, Spot> copyState = copyDict(currentState); Vector2 decision; possibleMoves = cb.getPossibleMovesForTurn(currentState); if (possibleMoves.Count == 0) { return(new Vector2(-1, -1)); } //TODO Make minMax tree with AlphaBetaPruning here var nextSpot = maxVal(copyState, double.MinValue, double.MaxValue, 0); //decision = nextSpot.Item2; decision = currentState[nextSpot.Item2].pos; //Below is placeholder //decision = possibleMoves[Random.Range(0,possibleMoves.Count)]; return(decision); }
void Start() { cb = GameObject.FindGameObjectWithTag("GameController").GetComponent <currentBoard>(); }