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); }
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); }
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; }
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; }
public Four(Four four) : base(four) { FourVariants = four.FourVariants; }
public Five(Four four) : base(four) { }