public static ListСell RelativeComplement(params ListСell[] sets) { var relativeComplement = new ListСell(); foreach (Сell field in sets[0]) { if (!sets[1].IsPresent(field)) { relativeComplement.Add(field); } } if (sets.Length > 2) { var list = new List <ListСell>(); list.Add(relativeComplement); for (var i = 2; i < sets.Length; i++) { list.Add(sets[i]); } return(RelativeComplement(list.ToArray())); } return(relativeComplement); }
public static ListСell Intersection(params ListСell[] sets) { var intersection = new ListСell(); foreach (Сell field in sets[0]) { if (sets[1].IsPresent(field)) { intersection.Add(field); } } if (sets.Length > 2) { var list = new List <ListСell>(); list.Add(intersection); for (var i = 2; i < sets.Length; i++) { list.Add(sets[i]); } return(Intersection(list.ToArray())); } return(intersection); }
public ListСell GetAroundCellsNoTags(Сell field, Сell maxCell) { var aroundCells = new ListСell(); for (var row = field.Row - 1; row <= field.Row + 1; row++) { for (var column = field.Column - 1; column <= field.Column + 1; column++) { if (row >= 0 && row < maxCell.Row && column >= 0 && column < maxCell.Column) { if (!(row == field.Row && column == field.Column)) { var newCell = new Сell(row, column); if (!IsPresent(newCell)) { aroundCells.Add(newCell); } } } } } return(aroundCells); }
public static ListСell GetReverseCells(Сell maxCell, params ListСell[] cells) { var listСell = new ListСell(); foreach (ListСell field in cells) { listСell.Add(field); } var listNoTags = new ListСell(); for (var row = 0; row < maxCell.Row; row++) { for (var column = 0; column < maxCell.Column; column++) { var item = new Сell(row, column); if (!listСell.IsPresent(item)) { listNoTags.Add(item); } } } return(listNoTags); }
public static ListСell Generate(Сell maxCell, int count) { var gList = new ListСell(); while (gList.Count < count) { gList.Add(Сell.Random(maxCell)); } return(gList); }