Exemplo n.º 1
0
        public int SetFigure(Figure f, bool rewrite)
        {
            int res = 4;

            try
            {
                if (Tiles[f.YC, f.XC] == TileType.Empty || rewrite)
                {
                    Tiles[f.YC, f.XC] = f.Type;
                }
                else
                {
                    --res;
                }
            }
            catch (IndexOutOfRangeException)
            { --res; }


            try
            {
                if (Tiles[f.Y1, f.X1] == TileType.Empty || rewrite)
                {
                    Tiles[f.Y1, f.X1] = f.Type;
                }
                else
                {
                    --res;
                }
            }
            catch (IndexOutOfRangeException)
            { --res; }

            try
            {
                if (Tiles[f.Y2, f.X2] == TileType.Empty || rewrite)
                {
                    Tiles[f.Y2, f.X2] = f.Type;
                }
                else
                {
                    --res;
                }
            }
            catch (IndexOutOfRangeException)
            { --res; }

            try
            {
                if (Tiles[f.Y3, f.X3] == TileType.Empty || rewrite)
                {
                    Tiles[f.Y3, f.X3] = f.Type;
                }
                else
                {
                    --res;
                }
            }
            catch (IndexOutOfRangeException)
            { --res; }

            return(res);
        }
Exemplo n.º 2
0
 protected bool CanMoveRight(Figure f)
 {
     return(CanMoveRight(f.YC, f.XC) && CanMoveRight(f.Y1, f.X1) &&
            CanMoveRight(f.Y2, f.X2) && CanMoveRight(f.Y3, f.X3));
 }
Exemplo n.º 3
0
 public bool CanMoveLeft(Figure f)
 {
     return(CanMoveLeft(f.YC, f.XC) && CanMoveLeft(f.Y1, f.X1) &&
            CanMoveLeft(f.Y2, f.X2) && CanMoveLeft(f.Y3, f.X3));
 }
Exemplo n.º 4
0
 protected void EraseFigure(Figure f)
 {
     f.Type = TileType.Empty;
     SetFigure(f, true);
 }