public void LMLMLMLMM_Should_Result_Into_13N()
        {
            var initialPosition = new PositionModel { Orientation = Orientation.N, Coordinates = new CoordinatesModel { X = 1, Y = 2 } };

              var robot = new Robot(initialPosition, _upperRight);

              robot.Move(new List<Instruction>
              {
            Instruction.L,
            Instruction.M,
            Instruction.L,
            Instruction.M,
            Instruction.L,
            Instruction.M,
            Instruction.L,
            Instruction.M,
            Instruction.M
              });

              var position = robot.GetPosition();

              Assert.AreEqual(1, position.Coordinates.X);
              Assert.AreEqual(3, position.Coordinates.Y);
              Assert.AreEqual(Orientation.N, position.Orientation);
        }
        public void MMRMMRMRRM_Should_Result_Into_51E()
        {
            var initialPosition = new PositionModel { Orientation = Orientation.E, Coordinates = new CoordinatesModel { X = 3, Y = 3 } };

              var robot = new Robot(initialPosition, _upperRight);

              robot.Move(new List<Instruction>
              {
            Instruction.M,
            Instruction.M,
            Instruction.R,
            Instruction.M,
            Instruction.M,
            Instruction.R,
            Instruction.M,
            Instruction.R,
            Instruction.R,
            Instruction.M
              });

              var position = robot.GetPosition();

              Assert.AreEqual(5, position.Coordinates.X);
              Assert.AreEqual(1, position.Coordinates.Y);
              Assert.AreEqual(Orientation.E, position.Orientation);
        }
示例#3
0
        public void Manage()
        {
            var input = _inputService.GetGlobalInput();

              var robots = new List<Robot>();
              foreach (var robotInput in input.RobotInputs)
              {
            var robot = new Robot(robotInput.InitialPosition, input.UpperRight);
            robot.Move(robotInput.Instructions);
            robots.Add(robot);
              }
              Robots = robots;
        }