private int GetChildRank(MiniMaxContext miniMaxContext, IBoard board, IPlayer minimizePlayer) { var context = new MiniMaxContext { Board = board, CurrentPlayer = miniMaxContext.CurrentPlayer, Opponent = miniMaxContext.Opponent, MinimizedPlayer = minimizePlayer, Players = miniMaxContext.Players }; return(DetermineBest(context).Rank); }
private static int GetRank(IPlayer winner, MiniMaxContext content) { if (winner is Nobody) { return(0); } if (winner.Symbol == content.CurrentPlayer.Symbol) { return(-10); } if (winner.Symbol == content.Opponent.Symbol) { return(10); } throw new ArgumentException(); }
private IPlayer GetOpponent(MiniMaxContext context) { return(context.Players.First(p => p.Symbol != context.MinimizedPlayer.Symbol)); }