Skip to content

Instantly share code, notes, and snippets.

@paractmol
Created September 22, 2018 09:27
Show Gist options
  • Save paractmol/4eb14caf27d69a4f43896dd38b492599 to your computer and use it in GitHub Desktop.
Save paractmol/4eb14caf27d69a4f43896dd38b492599 to your computer and use it in GitHub Desktop.
def self.parse(string)
commands = string.split("\n")
rover = new(*commands.delete_at(0).split(' '))
output = ''
commands.each_slice(2) do |deploy_coords, instructions|
rover.deploy(*deploy_coords.split(' '))
output << rover.process(instructions) + "\n"
end
output
 end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment