class MauxRobot::Table
This class represents a table according to simulation rules
Public Class Methods
new(x: [0, 4], y: [0, 4])
click to toggle source
# File lib/maux_robot/table.rb, line 6 def initialize(x: [0, 4], y: [0, 4]) # rubocop:disable Naming/UncommunicativeMethodParamName @x = x @y = y end
Public Instance Methods
contains?(position)
click to toggle source
# File lib/maux_robot/table.rb, line 11 def contains?(position) position.valid_direction? && position.x.between?(@x[0], @x[1]) && position.y.between?(@y[0], @y[1]) end