Last active
March 6, 2017 02:00
-
-
Save clockworkpc/ff1b9721b4b3c3f34195ad0d0a69fee4 to your computer and use it in GitHub Desktop.
Create a Table with Positive Values Only
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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