public CleaningRobot(InputJson inputJson) { this.Battery = inputJson.battery; this.PositionX = inputJson.start.x; this.PositionY = inputJson.start.y; this.FacingTo = inputJson.start.facing; this.visitedCells = new HashSet <OutputJson.Cell>(); visitedCells.Add(new OutputJson.Cell { X = PositionX, Y = PositionY }); this.cleanedCells = new HashSet <OutputJson.Cell>(); this.Map = parseMap(inputJson.map); }
static void Main(string[] args) { string inputFile = args[0]; string outputFile = args[1]; InputJson inputJson = JsonConvert.DeserializeObject <InputJson>(File.ReadAllText(inputFile)); CleaningRobot bot = new CleaningRobot(inputJson); List <IBasicInstruction> commandList = InstructionsHelper.ConvertToBasicInstrucctions(inputJson.commands); Simulation simulation = new Simulation(bot, commandList); simulation.Run(); simulation.PrintResult(outputFile); }