Пример #1
0
        public void FindCol()
        {
            const string givens = "..4156728215873496678249513....21367.61387.4...769.18.1.3.628747...3.651.4671.239";
            var          grid   = GridSerializerFactory.Make(GridSerializerName.Hodoku).Deserialize(givens);

            var results = _finder.FindAll(grid).OfType <FullHouse>().ToList();

            Assert.Single(results);
            var result = results[0];

            Assert.Equal(Value.Nine, result.Value);
            Assert.True((6, 4) == (result.Position.X, result.Position.Y));
        }
        public void FindsAll()
        {
            const string givens = "3..1....9...4..26..7..298..9....5......812......9....1..469..3..87..3...1....8..2";
            var          grid   = GridSerializerFactory.Make(GridSerializerName.Hodoku).Deserialize(givens);

            var techniques = _finder.FindAll(grid).OfType <HiddenSingle>().ToList();

            (int r, int c, int value)[] expected = new[]
Пример #3
0
        public void FindSingle()
        {
            const string givens = "EIRgDqW22GMovaU8am095lFCgjGUAQqGGCBYgQLEysDUGwEzEuCABYbUAQYKdKQEICYg1thbbghGIAgTiGoJQMq1BSDFNAA";
            var          grid   = GridSerializerFactory.Make(GridSerializerName.Base64).Deserialize(givens);

            var results = _finder.FindAll(grid).OfType <TwoStringKite>().ToList();

            Assert.Single(results);
            var result = results[0];

            Assert.Equal(Value.Five, result.Value);

            var expectedLegalPositions = new (int x, int y)[] { (5, 5), (1, 6) };
        public void FindAll()
        {
            const string givens = "....3.2.4.....19.6.4.5..37.6...5..23.82...1955......678273.564.4.56..7...69.8.5..";
            var          grid   = GridSerializerFactory.Make(GridSerializerName.Hodoku).Deserialize(givens);

            grid.FillAllLegalCandidates();

            var results = _finder.FindAll(grid).OfType <LockedCandidatesClaiming>().ToList();

            Assert.Equal(2, results.Count);
            Assert.Contains(results, result => result.Value == 4);
            Assert.Contains(results, result => result.Value == 9);

            (int r, int c)[] expectedPositions = new[]
        public void FindAll()
        {
            const string givens = "...91...7..1..6394.694..15..94.3.2.....6.1943..3.4978..18.67439..6......9...84...";
            var          grid   = GridSerializerFactory.Make(GridSerializerName.Hodoku).Deserialize(givens);

            grid.FillAllLegalCandidates();

            var results = _finder.FindAll(grid).OfType <LockedCandidatesPointing>().ToList();

            Assert.Equal(3, results.Count);

            var expectedValues = new[] { 3, 5, 8 };

            Assert.True(expectedValues.All(value => results.Any(t => t.Value == value)));
        }