The robot like algorithm challenge
This is a brief solution for the mower robot problem.
Some suppositions were done in order to achieve the job :
- We can have different grass areas(Area instance is not a Singleton)
- Mowers collision is ignored
- No mowers cycle detection
- Escaping the non recognizable instructions while interpreting a move sequence( Example: GAGAKKGA algorithm will escape KK
-
-
CommandInterpreter.toArea : is the main one, it maps the instructions input string (File) into an Area object containing the related mowers
-
Mower.move : the core algorithm which interprets the move sequence.
-
-
- Omitting the security checks, the algorithm is O(4n) where n is the move sequence length
You can simply execute the test : CommandInterpreter.toArea_interview_dataset() note that you can modify the input string
A javadoc is provided(you can start the index.html file in the javadoc directory)
- Sources : Not all getters/setters are implemented
- Tests : Atomic methods are not tested
Cheers !