示例#1
0
        static void Main(string[] args)
        {
            int input = 277678;
            SpiralMemorySolver solver = new SpiralMemorySolver(input);

            Console.WriteLine(solver.SolveManhattanDistance());
            Console.ReadLine();
        }
示例#2
0
        public void SolveManhattanCornerDistanceTest()
        {
            SpiralMemorySolver solver = new SpiralMemorySolver(17);

            Assert.AreEqual(4, solver.SolveManhattanDistance());
        }
示例#3
0
        public void SolveManhattanEdgeDistanceTest()
        {
            SpiralMemorySolver solver = new SpiralMemorySolver(18);

            Assert.AreEqual(3, solver.SolveManhattanDistance());
        }
示例#4
0
        public void SolveManhattanZeroDistanceTest()
        {
            SpiralMemorySolver solver = new SpiralMemorySolver(1);

            Assert.AreEqual(0, solver.SolveManhattanDistance());
        }