public static void swap(ref BlockStruct[,] a, int n, int x, int y)
        {
            Random      rand      = new Random();
            BlockStruct tempBlock = a[x, y];
            int         newX      = rand.Next(0, n);
            int         newY      = rand.Next(0, n);

            if (a[x, y].Center == false && a[newX, newY].Center == true)
            {
                a[x, y]       = a[newX, newY];
                a[newX, newY] = tempBlock;
            }
        }
        public static BlockStruct[,] InitializeBlockArray(int n)
        {
            //blocks[row,col]
            BlockStruct[,] blocks = new BlockStruct[n, n];

            int         numOfWhite = (int)((n * n) * 0.52);
            List <bool> list       = new List <bool>();

            //need a two diminsional array to get the blocks
            for (int i = 0; i < numOfWhite; i++)
            {
                list.Add(true);
            }
            for (int i = 0; i < n * n - numOfWhite; i++)
            {
                list.Add(false);
            }

            Random ran = new Random();
            int    index;

            //i is row
            for (int i = 0; i < n; i++)
            {
                //j is column
                for (int j = 0; j < n; j++)
                {
                    index = ran.Next(list.Count);
                    blocks[i, j].Center      = list[index];
                    blocks[i, j].Visited     = false;
                    blocks[i, j].Counter     = 0;
                    blocks[i, j].StayPut     = false;
                    blocks[i, j].IslandValue = 0;
                    list.RemoveAt(index);
                }
            }

            CheckAllWhiteRow(ref blocks);

            return(blocks);
        }