Esempio n. 1
0
        public void Solve(String source, String expectedResult)
        {
            Grid   sourceGrid   = GridConverter.Convert(source);
            Solver solver       = new Solver();
            Grid   destGrid     = solver.Solve(sourceGrid);
            String actualResult = GridConverter.Convert(destGrid);

            Assert.That(actualResult, Is.EqualTo(expectedResult));
        }
Esempio n. 2
0
        private IList <Tuple <String, Grid> > ReadInput(String filename)
        {
            IList <Tuple <String, Grid> > dest = new List <Tuple <String, Grid> >();

            String[] lines = File.ReadAllLines(filename);
            for (Int32 index = 0; index < lines.Length; index += (1 + Defs.GridSide))
            {
                String   name      = lines[index];
                String[] gridLines = new String[Defs.GridSide];
                Array.Copy(lines, index + 1, gridLines, 0, Defs.GridSide);
                Grid grid = GridConverter.Convert(gridLines);
                dest.Add(new Tuple <String, Grid>(name, grid));
            }
            return(dest);
        }