Beispiel #1
0
        public async Task Oblique_WhenNxNMatrix_ShouldReturnOblique()
        {
            var dna = new List <string>
            {
                "ABCDEF",
                "GHIJKL",
                "MNOPQR",
                "STUVWX",
                "YZ1234",
                "567890"
            };
            var oblique = new List <string>
            {
                "AHOV30",
                "FKPUZ5",
                "GNU29",
                "LQV16",
                "BIPW4",
                "EJOTY",
                "MT18",
                "RW27",
                "CJQX",
                "DINS"
            };
            var result = await UtilsArray.GetObliques(dna);

            Assert.Equal(result, oblique);
        }
Beispiel #2
0
        public async Task <bool> IsMutant(List <string> dna)
        {
            var total = dna.Count(item => _itemsToSearch.Where(item.Contains).Any());

            if (total > 1)
            {
                return(true);
            }
            var verticals = await UtilsArray.GetVerticals(dna);

            total += verticals.Count(item => _itemsToSearch.Where(item.Contains).Any());
            if (total > 1)
            {
                return(true);
            }
            var obliques = await UtilsArray.GetObliques(dna);

            total += obliques.Count(item => _itemsToSearch.Where(item.Contains).Any());
            return(total > 1);
        }