public override Figure Turn(Label[,] _Labels, int[] posI, int[] posJ)
        {
            Figure name = new turnedI();
            if ((posJ[1] - 1) >= 0 && posJ[1] + 2 <= 24)
                if (_Labels[posI[1], posJ[1] - 1].Tag == "0" && _Labels[posI[1], posJ[1] + 2].Tag == "0" && name.CanMoveDown(_Labels, posI, posJ))
                {
                    for (int i = 0; i < 4; i++)
                    {
                        _Labels[posI[i], posJ[i]].Tag = "0";
                    }
                    int k = posJ[1] - 1;
                    for (int i = 0; i < 4; i++)
                    {
                        posJ[i] = i + k;
                        posI[i] = posI[2];
                    }

                    name = new I();
                    for (int i = 0; i < 4; i++)
                    {
                        _Labels[posI[i], posJ[i]].Tag = "1";
                    }

                }
            return name;
        }
Beispiel #2
0
        public virtual Figure Turn(Label[,] _Labels, int[] posI, int[] posJ)
        {
            Figure name = new I();
            if ((posI[1] - 2) >= 0 && posI[1] + 1 <= 9 && _Labels[posI[1] - 2, posJ[1]].Tag == "0" && name.CanMoveLeft(_Labels, posI, posJ) && name.CanMoveRight(_Labels, posI, posJ))
            {
                for (int i = 0; i < 4; i++)
                {
                    _Labels[posI[i], posJ[i]].Tag = "0";
                }
                int k = posI[1] - 2;
                for (int i = 0; i < 4; i++)
                {
                    posI[i] = i + k;
                    posJ[i] = posJ[1];

                }
                name = new turnedI();
                for (int i = 0; i < 4; i++)
                {
                    _Labels[posI[i], posJ[i]].Tag = "1";
                }

            }
            return name;
        }