Skip to content

Instantly share code, notes, and snippets.

@Poincare
Created June 18, 2012 18:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Poincare/2950025 to your computer and use it in GitHub Desktop.
Save Poincare/2950025 to your computer and use it in GitHub Desktop.
class Robot
def initialize
@coordinates = [0, 0]
@fired_at = []
end
def forward(n)
@coordinates[0] += n
end
def backward(n)
@coordinates[0] -= n
end
def right(n)
@coordinates[1] += n
end
def left(n)
@coordinates[1] -= n
end
def fire
@fired_at.push(@coordinates)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment