예제 #1
0
        public void Turn_Left5_W()
        {
            Compass compass = new Compass('N');

            compass.Turn('L');
            compass.Turn('L');
            compass.Turn('L');
            compass.Turn('L');
            compass.Turn('L');

            Assert.AreEqual(compass.GetDirection(), 'W');
        }
예제 #2
0
        public void TurnRight_FromSouth()
        {
            ICompass c = new Compass(Orientation.South);

            c.Turn(TurnDirection.Right);

            Assert.AreEqual(Orientation.West, c.Direction);
        }
예제 #3
0
        public void TurnLeft_FromSouth()
        {
            ICompass c = new Compass(Orientation.South);

            c.Turn(TurnDirection.Left);

            Assert.AreEqual(Orientation.East, c.Direction);
        }
예제 #4
0
        public void TurnRight_FromWest()
        {
            ICompass c = new Compass(Orientation.West);

            c.Turn(TurnDirection.Right);

            Assert.AreEqual(Orientation.North, c.Direction);
        }
예제 #5
0
        public void TurnLeft_FromEast()
        {
            ICompass c = new Compass(Orientation.East);

            c.Turn(TurnDirection.Left);

            Assert.AreEqual(Orientation.North, c.Direction);
        }
예제 #6
0
        public void Turn_Right_N()
        {
            Compass compass = new Compass('W');

            compass.Turn('R');

            Assert.AreEqual(compass.GetDirection(), 'N');
        }
예제 #7
0
        public void TurnRight_InitWithNorth_E()
        {
            Compass compass = new Compass('N');

            compass.Turn('R');

            Assert.AreEqual(compass.GetDirection(), 'E');
        }
예제 #8
0
        public Day1Solution()
        {
            var input = Week1_ParseInput();

            Console.WriteLine("Starting at square 1... : " + Compass.CurrentPlacement.Item1[0] + "N, " + Compass.CurrentPlacement.Item1[1] + "E, " + "currently facing " + Compass.CurrentPlacement.Item2);
            foreach (var val in input)
            {
                Console.WriteLine("Input from file: " + val);
                AdventCompass.Turn(val);
                Console.WriteLine(Compass.CurrentPlacement.Item1[0] + "N, " + Compass.CurrentPlacement.Item1[1] + "E, " + "currently facing " + Compass.CurrentPlacement.Item2);
            }

            Console.WriteLine("Distance to Easter Bunny HQ: " + (Compass.CurrentPlacement.Item1[0] + Compass.CurrentPlacement.Item1[1]) + " blocks");

#if DEBUG
            Console.WriteLine("Debugger waiting...");
            Console.ReadLine();
#endif
        }