示例#1
0
        public Tuple<int, int> MakeMove(IBoard board)
        {
            int dimension = board.GetDimension();
            List<Tuple<int, int>> freeList = new List<Tuple<int, int>>();
            for (int i = 0; i < dimension; i++)
            {
                for (int j = 0; j < dimension; j++)
                {
                    if (board.GetPosition(i, j) == BoardCharacter.Empty)
                    {
                        freeList.Add(new Tuple<int, int>(i,j));
                    }
                }
            }

            int index = positionGenerator.Next(0, freeList.Count);
            return freeList[index];
        }