Class: Robulator::Tabletop
- Inherits:
-
Object
- Object
- Robulator::Tabletop
- Defined in:
- lib/robulator/tabletop.rb
Instance Method Summary collapse
-
#initialize(size) ⇒ Tabletop
constructor
A new instance of Tabletop.
- #placeable_spot?(x, y) ⇒ Boolean
Constructor Details
#initialize(size) ⇒ Tabletop
Returns a new instance of Tabletop.
3 4 5 6 |
# File 'lib/robulator/tabletop.rb', line 3 def initialize(size) size = Integer(size) @placeable_spots = {x: 0...size, y: 0...size} end |
Instance Method Details
#placeable_spot?(x, y) ⇒ Boolean
8 9 10 11 12 13 |
# File 'lib/robulator/tabletop.rb', line 8 def placeable_spot?(x, y) @placeable_spots[:x].include?(Integer(x)) && @placeable_spots[:y].include?(Integer(y)) rescue ArgumentError false end |