public int AIMove() { // return 0; // return Minmax(this.aiBoard, this.depth, true); // BUG: Out of bounds int finalMove = -1; int bestValue = int.MaxValue; int minMaxValue = 0; Board tempBoard = null; // make a temp board and run on that one for (int c = 0; c < Global.colSize; c++) { minMaxValue = 0; tempBoard = Board.DeepClone <Board>(this.aiBoard); tempBoard.Play(this.character, c); minMaxValue = Minmax(tempBoard, depth, true); if (bestValue != Global.min(bestValue, minMaxValue)) { bestValue = minMaxValue; finalMove = c; } } return(finalMove); }