public Point TakeTurn(Mark[,] gameField) { Dictionary <double, Point> options = new Dictionary <double, Point>(); Dictionary <double, List <int> > summarys = new Dictionary <double, List <int> >(); for (int i = 0; i < gameField.GetLength(0); i++) { for (int j = 0; j < gameField.GetLength(1); j++) { if (gameField[i, j] == Mark.Blank) { Mark[,] option = (Mark[, ])gameField.Clone(); option[i, j] = InstanceRole; (List <int> features, double evaluation) = Summarize(option); if (!options.Keys.Contains(evaluation)) { options.Add(evaluation, new Point(j, i)); summarys.Add(evaluation, features); } } } } KeyValuePair <double, Point> pair = options.Where(p => p.Key == options.Keys.Max()).ToList()[0]; _history.Add(new KeyValuePair <double, List <int> >(pair.Key, summarys[pair.Key])); return(pair.Value); }