// Fisher–Yates shuffle
        public static void Shuffle <T>(this IRandomNumbersProvider rng, T[] array)
        {
            int n = array.Length;

            while (n > 1)
            {
                int k    = rng.Next(n--);
                T   temp = array[n];
                array[n] = array[k];
                array[k] = temp;
            }
        }
Exemple #2
0
        public Move DetermineNextMove(Game game)
        {
            List <Move> availableMoves = GetAvailableMoves(game);

            return(availableMoves.ElementAt(_randomNumbersProvider.Next(0, availableMoves.Count)));
        }
Exemple #3
0
 protected virtual bool ShouldPlayOptimalMove()
 {
     return(_randomNumbersProvider.Next(0, 100) > MistakeProbability);
 }