예제 #1
0
        public void Line_PartiallyKnown_Full()
        {
            CellValue[] line = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
            };

            int[] hints = { 4, 3 };

            CellValue[] expectedResult = new CellValue[8] {
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Blank,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
            };

            var result = lineSolver.Solve(line, hints);

            Assert.IsTrue(expectedResult.SequenceEqual(result));
        }
예제 #2
0
        public void Line_Overlapping()
        {
            CellValue[] line = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
            };

            int[] hints = { 3, 3 };

            CellValue[] expectedResult = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Unknown,
            };

            var result = lineSolver.Solve(line, hints);

            Assert.IsTrue(expectedResult.SequenceEqual(result));
        }
예제 #3
0
        public void Merge()
        {
            CellValue[] permutation1 = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Unknown,
                CellValue.Unknown,
            };

            CellValue[] permutation2 = new CellValue[8] {
                CellValue.Filled,
                CellValue.Unknown,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Unknown,
                CellValue.Filled,
            };

            var permutations = new List <CellValue[]> {
                permutation1,
                permutation2,
            };

            CellValue[] expectedResult = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Unknown,
                CellValue.Unknown,
            };

            var clone = new CellValue[8] {
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
                CellValue.Unknown,
            };

            lineSolver.Merge(clone, permutations);

            Assert.IsTrue(expectedResult.SequenceEqual(clone));
        }
예제 #4
0
        public void Line_Complete()
        {
            CellValue[] line = new CellValue[8] {
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
                CellValue.Filled,
            };

            int[] hints = { 8 };

            var result = lineSolver.Solve(line, hints);

            Assert.IsTrue(line.SequenceEqual(result));
        }