Beispiel #1
0
 private string GetRobotAt(RobotPosition robo)
 {
     if (robo == null) return string.Empty;
     // eg. Output: 0,0,WEST
     return String.Format(">> Robot At: {0},{1},{2}", robo.XVal, robo.YVal, robo.Facing);
 }
Beispiel #2
0
 public SimulationServices(RobotPosition robot)
 {
     _robotAt = robot;
     // Initialize and configure default placement settings
     _configs = ConfigurePlacements();
 }
Beispiel #3
0
        public string PerformAction(InputInfo inputInfo)
        {
            switch (inputInfo.CmdKey)
            {
                case Commands.PLACE:
                    _robotAt = Place(inputInfo);
                    break;
                case Commands.MOVE:
                    _robotAt = Move(inputInfo);
                    break;
                case Commands.LEFT:
                    _robotAt = Turning(inputInfo, Turns.Left);
                    break;
                case Commands.RIGHT:
                    _robotAt = Turning(inputInfo, Turns.Right);
                    break;
                case Commands.REPORT:
                    return GetRobotAt(_robotAt);
                    break;
                default:
                    return("Oops something gone wrong!");
                    break;
            }

            return string.Empty;
        }