CLI Application
A CLI application for robots which receives a string of commands and outputs the robot's distance from it's starting point.This distance will be the minimum amount of units the robot will need to traverse in order to get back to it's starting point.
Robot receives commands in order to move. These commands will tell the robot to go forwards or backwards, and turn left or right.
Format : CommandNumber
F- move forward 1 unitB- move backward 1 unitR- turn right 90 degreesL- turn left 90 degrees
The robot can only turn 90 degrees at a time while forward/backward steps could be any. For example 'L1' means 'turn left by 90 degrees once'. 'B2' would mean go backwards 2 units.
A string of comma-separated commands eg F1,R1,B2,L1,B3.
The minimum amount of distance to get back to the starting point (4 in this case).
Input can be given as command line arguments or as a file to the python file "distance.py".
Format : python PyFile InputString/File
- File "distance.py" is the the name of the python file
- File "command.txt" is provided to give command string
- Example: python distance.py command.txt || python distance.py distance.py L1,F2,B2
Unit test cases for the CLI application are available in the file "test_distance.py".
- Example: python test_distance.py