Toy Robot is a coding challenge commonly used as part of the interviewing process for software development roles. The challenge is to write an application that fits the following requirements:
- The toy robot is placed on a 5x5 table top.
- The toy robot cannot be placed outside these bounds and cannot be moved outside these bounds.
- The user can issue one of five commands to the robot: PLACE X,Y,F; MOVE; LEFT; RIGHT; REPORT.
- PLACE must be the first command used, since the other commands require the robot to be on the table already.
- PLACE X,Y,F will place the robot on the table at the coordinates given, facing in the direction specified (N, S, E or W).
- LEFT will turn the robot 90º to the left.
- RIGHT will turn the robot 90º to the right.
- MOVE will move the robot forward one unit, in whichever direction it is facing.
- REPORT will cause the robot to output its position and direction.
- In my example, I've also implemented an EXIT command to quit the application.
- Install the .NET Core SDK.
- Clone the solution to your local machine.
- Using a terminal, navigate to the
toy-robot
directory. - Run the application by typing
dotnet run
.
- Install the .NET Core SDK.
- Clone the solution to your local machine.
- Using a terminal, navigate to the
toy-robot.tests
directory. - Run the unit tests by typing
dotnet test
.