public void ShouldCountConnectedComponents() { KnotHash kh = new KnotHash(); GridCreator g = new GridCreator(kh); var grid = g.Generate("flqrgnkx"); Defragmentor f = new Defragmentor(); Assert.Equal(1242, f.CountUsedGroups(grid)); }
public void ShouldCalculateUsedSpace() { KnotHash kh = new KnotHash(); GridCreator g = new GridCreator(kh); var grid = g.Generate("flqrgnkx"); Defragmentor f = new Defragmentor(); Assert.Equal(8108, f.GetUsedSpace(grid)); }
static void Main(string[] args) { KnotHash kh = new KnotHash(); GridCreator d = new GridCreator(kh); Defragmentor f = new Defragmentor(); var square = d.Generate("nbysizxe"); // Part one Console.WriteLine(f.GetUsedSpace(square)); // Part two Console.WriteLine(f.CountUsedGroups(square)); }