//Methods private static void UniteCells(ref Labyrinth labyrinth, CellPoint first, CellPoint second, ref int NextId) { int Id1 = labyrinth[first.Row, first.Col].Id; int Id2 = labyrinth[second.Row, second.Col].Id; if (Id1 != 0 && Id2 != 0) { for (int i = 0; i < labyrinth.Rows; ++i) { for (int j = 0; j < labyrinth.Columns; ++j) { if (labyrinth[i, j].Id == Id2) { labyrinth[i, j].Id = Id1; } } } } if (Id1 == 0 && Id2 == 0) { labyrinth[first.Row, first.Col].Id = NextId; labyrinth[second.Row, second.Col].Id = NextId; ++NextId; } else if (Id1 == 0) { labyrinth[first.Row, first.Col].Id = Id2; } else if (Id2 == 0) { labyrinth[second.Row, second.Col].Id = Id1; } }
public StepInfo(CellPoint item1, CellPoint item2) { Item1 = item1; Item2 = item2; }