public Simulate Think(int depth, int alpha, int beta, IContext context) { //UnityEngine.Debug.LogError(depth + " [alpha = " + alpha + "][beta = " + beta + "]"); if (depth == DEPTH || context.End()) { return new Simulate(context.Evaluate(), null); } else { object bestMove = null; while (context.HaveChoices()) { object move = null; IContext newContext = context.NextChoice(ref move); Simulate value = Think(depth + 1, -beta, -alpha, newContext); if (-value.mEvaluate > alpha) { alpha = -value.mEvaluate; bestMove = move; } } return new Simulate(alpha, bestMove); } }