Пример #1
0
    //Добавлене фигуры
    void AddFigure()
    {
        int n = RandomFigure();

        figure = mas[n];
        figure.Figure();
        n = figure.GetSize();
        int[] coord = figure.GetCoord();
        int[,] tmp       = new int[n, n];
        int[,] tmpFigure = figure.GetFigure();

        for (int y = coord [0]; y < coord [0] + n; y++)
        {
            for (int x = coord [1]; x < coord [1] + n; x++)
            {
                if (y >= 0)
                {
                    tmp [y - coord [0], x - coord [1]] = table [y, x];
                    if (tmpFigure [y - coord [0], x - coord [1]] > 0 && tmp [y - coord [0], x - coord [1]] == 2)
                    {
                        return;
                    }
                }
            }
        }

        for (int y = coord [0]; y < coord [0] + n; y++)
        {
            for (int x = coord [1]; x < coord [1] + n; x++)
            {
                if (y >= 0)
                {
                    table [y, x] = tmpFigure [y - coord [0], x - coord [1]];
                }
            }
        }
    }