Esempio n. 1
0
        public void Solution1()
        {
            const string givens   = "..15.6.9.37.19....9.......6...643.1...........4.981...5.......2....25.68.8.4.93..";
            const string expected = "821536794376194285954872136295643817138257649647981523569318472413725968782469351";

            var input        = _converter.Deserialize(givens);
            var actual       = _bruteForceSolver.Solve(input);
            var actualString = _converter.Serialize(actual);

            Assert.Equal(expected, actualString);
        }
Esempio n. 2
0
        public StorageDto Load()
        {
            try
            {
                Grid grid       = null;
                var  difficulty = Difficulty.Unknown;
                if (_storageProvider.HasKey(nameof(StorageDto.Grid)))
                {
                    grid = _gridSerializer.Deserialize(_storageProvider.Load <string>(nameof(StorageDto.Grid)));
                }

                if (_storageProvider.HasKey(nameof(StorageDto.Difficulty)))
                {
                    difficulty = _storageProvider.Load <Difficulty>(nameof(StorageDto.Difficulty));
                }

                return(new StorageDto(grid ?? new Grid(), difficulty));
            }
            catch (Exception e)
            {
                throw new LoadException("Load failed.", e);
            }
        }