Skip to content

Instantly share code, notes, and snippets.

@clockworkpc
Last active March 6, 2017 02:00
Show Gist options
  • Save clockworkpc/ff1b9721b4b3c3f34195ad0d0a69fee4 to your computer and use it in GitHub Desktop.
Save clockworkpc/ff1b9721b4b3c3f34195ad0d0a69fee4 to your computer and use it in GitHub Desktop.
Create a Table with Positive Values Only
module ToyRobot
class Table
def initialize(width, length)
@width = width
@length = length
end
def valid_location?(east, north)
(0...@width).cover?(east) &&
(0...@length).cover?(north)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment