Class: Amaze::Algorithm

Inherits:
Object
  • Object
show all
Defined in:
lib/amaze/algorithm.rb

Defined Under Namespace

Classes: AldousBorder, BinaryTree, GrowingTree, HuntAndKill, RecursiveBacktracker, Sidewinder, Stat, Wilson

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#durationObject (readonly)

The time the algorithm takes to generate the maze



22
23
24
# File 'lib/amaze/algorithm.rb', line 22

def duration
  @duration
end

Instance Method Details

#on(grid) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/amaze/algorithm.rb', line 24

def on grid
  @duration = Benchmark.realtime do
    work grid do |stat|
      yield stat if block_given?
    end
  end
  grid
end

#speedObject



33
34
35
# File 'lib/amaze/algorithm.rb', line 33

def speed
  0.06
end