Exemplo n.º 1
0
        public static bool IsCombination(ref Three three)
        {
            var result = false;
            var four   = new Four(three);

            foreach (var variant in four.ThreeVariants)
            {
                if (variant.Orientation == Orientation.Horizontal && variant.Cells[2].Right.IsNotNullOrEmpty() && variant.Cells[2].Right.ChildItem.Type == four.Type)
                {
                    four.FourVariants.Add(new Variant()
                    {
                        Cells = new Cell[] { variant.Cells[0], variant.Cells[1], variant.Cells[2], variant.Cells[2].Right }, Orientation = Orientation.Horizontal
                    });
                    result = true;
                }
                if (variant.Orientation == Orientation.Vertical && variant.Cells[2].Up.IsNotNullOrEmpty() && variant.Cells[2].Up.ChildItem.Type == four.Type)
                {
                    four.FourVariants.Add(new Variant()
                    {
                        Cells = new Cell[] { variant.Cells[0], variant.Cells[1], variant.Cells[2], variant.Cells[2].Up }, Orientation = Orientation.Vertical
                    });
                    result = true;
                }
            }
            if (result)
            {
                four.Cells = four.FourVariants.FirstOrDefault().Cells;
                three      = four;
            }
            return(result);
        }
Exemplo n.º 2
0
        public static bool IsCombination(ref Four four)
        {
            var result = false;
            var five   = new Five(four);

            foreach (var variant in five.FourVariants)
            {
                if (variant.Orientation == Orientation.Horizontal && variant.Cells[3].Right.IsNotNullOrEmpty() && variant.Cells[3].Right.ChildItem.Type == five.Type)
                {
                    five.Cells = new Cell[5];
                    Array.Copy(variant.Cells, five.Cells, variant.Cells.Length);
                    five.Cells[4] = variant.Cells[3].Right;
                    result        = true;
                }
                if (variant.Orientation == Orientation.Vertical && variant.Cells[3].Up.IsNotNullOrEmpty() && variant.Cells[3].Up.ChildItem.Type == five.Type)
                {
                    five.Cells = new Cell[5];
                    Array.Copy(variant.Cells, five.Cells, variant.Cells.Length);
                    five.Cells[4] = variant.Cells[3].Up;
                    result        = true;
                }
            }
            four = result ? five : null;
            return(result);
        }
Exemplo n.º 3
0
 public static bool IsCombination(ref Three three)
 {
     var result = false;
       var four = new Four(three);
       foreach(var variant in four.ThreeVariants) {
     if(variant.Orientation == Orientation.Horizontal && variant.Cells[2].Right.IsNotNullOrEmpty() && variant.Cells[2].Right.ChildItem.Type == four.Type) {
       four.FourVariants.Add(new Variant() { Cells = new Cell[] { variant.Cells[0], variant.Cells[1], variant.Cells[2], variant.Cells[2].Right }, Orientation = Orientation.Horizontal });
       result = true;
     }
     if(variant.Orientation == Orientation.Vertical && variant.Cells[2].Up.IsNotNullOrEmpty() && variant.Cells[2].Up.ChildItem.Type == four.Type) {
       four.FourVariants.Add(new Variant() { Cells = new Cell[] { variant.Cells[0], variant.Cells[1], variant.Cells[2], variant.Cells[2].Up }, Orientation = Orientation.Vertical });
       result = true;
     }
       }
       if(result) {
     four.Cells = four.FourVariants.FirstOrDefault().Cells;
     three = four;
       }
       return result;
 }
Exemplo n.º 4
0
 public static bool IsCombination(ref Four four)
 {
     var result = false;
       var five = new Five(four);
       foreach(var variant in five.FourVariants) {
     if(variant.Orientation == Orientation.Horizontal && variant.Cells[3].Right.IsNotNullOrEmpty() && variant.Cells[3].Right.ChildItem.Type == five.Type) {
       five.Cells = new Cell[5];
       Array.Copy(variant.Cells, five.Cells, variant.Cells.Length);
       five.Cells[4] = variant.Cells[3].Right;
       result = true;
     }
     if(variant.Orientation == Orientation.Vertical && variant.Cells[3].Up.IsNotNullOrEmpty() && variant.Cells[3].Up.ChildItem.Type == five.Type) {
       five.Cells = new Cell[5];
       Array.Copy(variant.Cells, five.Cells, variant.Cells.Length);
       five.Cells[4] = variant.Cells[3].Up;
       result = true;
     }
       }
       four = result ? five : null;
       return result;
 }
Exemplo n.º 5
0
 public Four(Four four)
     : base(four)
 {
     FourVariants = four.FourVariants;
 }
Exemplo n.º 6
0
 public Four(Four four)
     : base(four)
 {
     FourVariants = four.FourVariants;
 }
Exemplo n.º 7
0
 public Five(Four four)
     : base(four)
 {
 }
Exemplo n.º 8
0
 public Five(Four four)
     : base(four)
 {
 }