public void ExactCoverTest() { var sut = new DancingLinks(); var xKeys = sut.BuildSetMatrixKeys(4); var y = sut.BuildSubsetMatrix(4, 2, 2); var x = sut.ExactCover(xKeys, y); x.Dump(TestContext.WriteLine, $"Dumping x, item count = {x.Count}"); }
public void BuildSubsetMatrixTest1() { var sut = new DancingLinks(); var actualY = sut.BuildSubsetMatrix(4, 2, 2); Assert.AreEqual(64, actualY.Count); actualY.Dump(TestContext.WriteLine, $"Dumping actualY, item count = {actualY.Count}"); }
public void LoadCaseToSolveTest() { var grid = new[] { new[] { 1, 0, 3, 4 }, new[] { 3, 4, 1, 2 }, new[] { 2, 1, 4, 3 }, new[] { 4, 3, 2, 1 } }; var sut = new DancingLinks(); var xKeys = sut.BuildSetMatrixKeys(4); var y = sut.BuildSubsetMatrix(4, 2, 2); var x = sut.ExactCover(xKeys, y); sut.LoadCaseToSolve(grid, x, y); x.Dump(TestContext.WriteLine, $"Dumping x, item count = {x.Count}"); }