Class: Board

Inherits:
Object
  • Object
show all
Defined in:
lib/my_own_maze/model/board.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(points, width, height) ⇒ Board

Returns a new instance of Board.



4
5
6
7
8
# File 'lib/my_own_maze/model/board.rb', line 4

def initialize(points, width, height)
  @points = points
  @width = width
  @height = height
end

Instance Attribute Details

#heightObject

Returns the value of attribute height.



2
3
4
# File 'lib/my_own_maze/model/board.rb', line 2

def height
  @height
end

#pointsObject

Returns the value of attribute points.



2
3
4
# File 'lib/my_own_maze/model/board.rb', line 2

def points
  @points
end

#widthObject

Returns the value of attribute width.



2
3
4
# File 'lib/my_own_maze/model/board.rb', line 2

def width
  @width
end

Instance Method Details

#find_point(x, y) ⇒ Object



10
11
12
# File 'lib/my_own_maze/model/board.rb', line 10

def find_point(x, y)
  @points.find { |point| point.x == x && point.y == y }
end