Class: Theseus::TransparentMask

Inherits:
Object
  • Object
show all
Defined in:
lib/theseus/mask.rb

Overview

This is the default mask used by a maze when an explicit mask is not given. It simply reports every cell as available.

mask = Theseus::TransparentMask.new(20, 20)
maze = Theseus::OrthogonalMaze.new(mask: mask)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width = 0, height = 0) ⇒ TransparentMask

Returns a new instance of TransparentMask.



103
104
105
106
# File 'lib/theseus/mask.rb', line 103

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

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



101
102
103
# File 'lib/theseus/mask.rb', line 101

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



101
102
103
# File 'lib/theseus/mask.rb', line 101

def width
  @width
end

Instance Method Details

#[](x, y) ⇒ Object

Always returns true.



109
110
111
# File 'lib/theseus/mask.rb', line 109

def [](x,y)
  true
end