private BobDecisionTree GetBestDecision(BobDecisionTree decisionsRoot) { if (decisionsRoot.Moves.Count() == 0) { throw new InvalidOperationException("Cannot go anywhere!"); } else { return decisionsRoot.Moves.OrderByDescending(m => m.GetWinFactor(OwnMark)).First(); } }
public override int GetNextPosition(BoardState board) { var stopwatch = new Stopwatch(); stopwatch.Start(); var decisionsRoot = new BobDecisionTree(board, OwnMark); var position = GetBestDecision(decisionsRoot).Position; stopwatch.Stop(); Devinfo("Tree Size {0} built in {1} ms", decisionsRoot.TreeSize, stopwatch.ElapsedMilliseconds); return position; }