Skip to content

waliding/mower

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mower

The robot like algorithm challenge

Introduction

This is a brief solution for the mower robot problem.

Suppositions

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

Interesting things

  • Core functions/methods :

    • 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.

  • Mower.move comparison complexity:

    • Omitting the security checks, the algorithm is O(4n) where n is the move sequence length

Example :

You can simply execute the test : CommandInterpreter.toArea_interview_dataset() note that you can modify the input string

Javadoc :

A javadoc is provided(you can start the index.html file in the javadoc directory)

N.B :

  • Sources : Not all getters/setters are implemented
  • Tests : Atomic methods are not tested

Cheers !

About

A robot move challenge algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages