예제 #1
0
        private void CheckNeighbor0(Int32 x, Int32 y)
        {
            _Field.SetReveal(x, y, true);
            _Field.SetRevealedFields(_Field.GetRevealedFields + 1);
            Int32 RowStart;

            if (x > 0)
            {
                RowStart = x - 1;
            }
            else
            {
                RowStart = 0;
            }
            Int32 ColStart;

            if (y > 0)
            {
                ColStart = y - 1;
            }
            else
            {
                ColStart = 0;
            }
            for (int RowNum = RowStart; RowNum <= x + 1; RowNum++)
            {
                for (int ColNum = ColStart; ColNum <= y + 1; ColNum++)
                {
                    if (!(RowNum == x && ColNum == y) && (RowNum < _Field.GetFieldSize && ColNum < _Field.GetFieldSize))
                    {
                        if ((_Field.GetFieldValue(RowNum, ColNum) == 0) && !_Field.GetFieldReveal(RowNum, ColNum))
                        {
                            CheckNeighbor0(RowNum, ColNum);
                        }
                    }
                }
            }
        }