The Cleaning Robot Console Application is a C# program that simulates an autonomous cleaning robot. The robot can navigate through a room, clean surfaces, and perform back-off strategies in case of obstacles or low battery.
The cleaning robot application is designed to demonstrate the capabilities of an autonomous cleaning robot. It receives a room map and a set of cleaning commands in JSON format, simulates the robot's movements, and generates an output JSON file with the final state of the robot.
- Reads room map and cleaning commands from an input JSON file.
- Simulates the robot's movements and cleaning actions based on the commands.
- Handles back-off strategies if the robot encounters obstacles or low battery.
- Logs the executed commands and back-off strategies to the console for monitoring.
To run the Cleaning Robot Console Application, you need the following:
- .NET Core SDK (version 3.1 or later)
- C# development environment (e.g., Visual Studio, Visual Studio Code)
- Clone this repository to your local machine.
- Open the solution file (
RobotCleaner.sln
) in your C# development environment. - Build the project to generate the executable file.
The input JSON file should contain the following parameters:
map: A 2D array representing the room map with cells (S: cleanable space, C: column). start: An object representing the initial position and facing direction of the robot (X: x-coordinate, Y: y-coordinate, Facing: "N", "W", "S", or "E"). commands: An array of strings representing the commands for the robot (e.g., ["TL", "A", "C", "A"]). battery: An integer representing the initial battery level of the robot.
The output JSON file will contain the following parameters:
Visited: An array of objects representing the unique positions visited by the robot during the cleaning process. Cleaned: An array of objects representing the unique positions where the robot cleaned. FinalPosition: An object representing the robot's final position and facing direction. Battery: An integer representing the remaining battery after the cleaning process.