public void DeterminableCellsOf_5_3_l10() { int length = 10; var lineRule = new PicrossLineRule(lineStructure: new [] { 5, 3 }, lineLength: length); var activeLine = new PicrossActiveLine( cells: (new PicrossLine(length: length, state: PicrossCellState.Undetermined)).Cells, rule: lineRule, type: LineType.Row, index: 0); var determinableCells = activeLine.GetDeterminableCells(); var expectedSolution = new PicrossLine( new List <PicrossCell> { new PicrossCell() { State = PicrossCellState.Undetermined }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Undetermined }, new PicrossCell() { State = PicrossCellState.Undetermined }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Undetermined }, } ); Assert.True(expectedSolution.Print() == determinableCells.Print()); }
public void GenerateCandidatesOf_2_2_l5() { int length = 5; var lineRule = new PicrossLineRule(lineStructure: new[] { 2, 2 }, lineLength: length); var candidates = lineRule.GenerateCandidates(); var expectedSolution = new List <PicrossLine> { new PicrossLine( new List <PicrossCell> { new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Void }, new PicrossCell() { State = PicrossCellState.Filled }, new PicrossCell() { State = PicrossCellState.Filled } }) }; Assert.True(candidates.Count() == expectedSolution.Count); foreach (PicrossLine candidateLine in candidates) { Assert.Contains( expectedSolution, line => line.Print() == candidateLine.Print()); } }