/// <summary> /// Start the computer searching for a move /// Clients should listen to the OnPlayerMoved event to be notified /// when the computer has found a move /// </summary> /// <param name="gameBoard">The current game board</param> public override void Move(object gameBoard) { Board b = (Board)gameBoard; //to make things interesting we move randomly if the board we //are going first (i.e. the board is empty) if (b.OpenPositions.Length == 9) { this.currentMove = GetRandomMove((Board)gameBoard); OnPlayerMoved(); return; } Node root = new MaxNode(b, null, null); root.MyPiece = this.PlayerPiece; root.Evaluator = new EvaluationFunction(); root.FindBestMove(DEFAULT_SEARCH_DEPTH); currentMove = root.BestMove; OnPlayerMoved(); }