Skip to content

Instantly share code, notes, and snippets.

@dscataglini
Created August 26, 2013 19:53
Show Gist options
  • Save dscataglini/6345869 to your computer and use it in GitHub Desktop.
Save dscataglini/6345869 to your computer and use it in GitHub Desktop.
Robot Problem
# There are 2 robots placed on an infinitely wide 2 dimensional line.
# The robots can’t see each other.
# Each robot has 1 marker to the right but 1 of them doesn’t have one on the left.
# - unit of distance
# ^ marker
# ~ indefinite amount of units of distance
# ---~---(Robot)---~---^---~---(Robot)---~--^---~---
# Write a program that will make that 2 robots collide using the following Robot Api:
# move_left(n)
# move_right(n)
# at_marker?
# stop
# this program will be fed to both robots
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment