Exemplo n.º 1
0
            private int TestForBestPosition()
            {
                int[] posis = new int[Length];
                for (int x = 0; x < Width; x++)
                {
                    if (WinChecker.DoCheck(field, WinChecker.Directories.Down, ' ', new Vector2i(x, 0)) == Width)
                    {
                        posis[x]++;
                    }
                }
                for (int y = 0; y < Height; y++)
                {
                    if (WinChecker.DoCheck(field, WinChecker.Directories.Right, ' ', new Vector2i(0, y)) == Height)
                    {
                        posis[y]++;
                    }
                }
                for (int x = 0; x < Width; x++)
                {
                    for (int y = 0; y < Height; y++)
                    {
                        if (x + (Width - 1) < Width && y + (Width - 1) < Height)
                        {
                            if (WinChecker.DoCheck(field, WinChecker.Directories.RightDown, ' ', new Vector2i(x, y)) == Width)
                            {
                                posis[(x + 1) * (y + 1) - 1]++;
                            }
                        }
                    }
                }
                for (int x = 0; x < Width; x++)
                {
                    for (int y = 0; y < Height; y++)
                    {
                        if (WinChecker.DoCheck(field, WinChecker.Directories.LeftDown, ' ', new Vector2i(x, y)) == Width)
                        {
                            posis[(x + 1) * (y + 1) - 1]++;
                        }
                    }
                }
                int ret = -1;

                ret = posis.GetHighestIndex();
                return(ret);
            }