class Hanoi::Jane::Animation

Attributes

disc[RW]
from[RW]
height[RW]
stacks[RW]
to[RW]

Public Class Methods

new() { |self| ... } click to toggle source
# File lib/hanoi/jane/animation/animation.rb, line 8
def initialize
  @stacks = [[0]]
  @disc = 0
  @from = 0
  @to = 1
  @height = 7

  yield self if block_given?

  @stacks = PaddedStacks.new @stacks, @height
  @lifter = Lifter.new @stacks[@from]
  @dropper = Dropper.new @stacks[@to], @disc
end

Public Instance Methods

each() { |self| ... } click to toggle source
# File lib/hanoi/jane/animation/animation.rb, line 22
def each
  @lifter.each do |state|
    @stacks[@from] = state.to_a
    yield self
  end

  @dropper.each do |state|
    @stacks[@to] = state.to_a
    yield self
  end
end