class Hanoi::Jane::DropIn
Attributes
animtype[R]
disc[R]
discs[RW]
height[RW]
stacks[R]
Public Class Methods
new() { |self| ... }
click to toggle source
# File lib/hanoi/jane/animation/drop_in.rb, line 9 def initialize @height = 7 @discs = 3 @animtype = :tween yield self if block_given? @stacks = PaddedStacks.new [[], [], []], @height @disc = discs - 1 @dropper = Dropper.new @stacks[0], @disc, true end
Public Instance Methods
each() { |self| ... }
click to toggle source
# File lib/hanoi/jane/animation/drop_in.rb, line 24 def each while @disc >= 0 @dropper = Dropper.new @stacks[0], @disc, (@disc == 0 ? false : true) @dropper.each do |state| @stacks[0] = state.to_a yield self end @disc -= 1 end end
to_dots()
click to toggle source
# File lib/hanoi/jane/animation/drop_in.rb, line 35 def to_dots Formatters::Matrix.new do |m| m.stacks = @stacks m.digits = '0' * (@discs - @disc) end end
value()
click to toggle source
# File lib/hanoi/jane/animation/drop_in.rb, line 20 def value '0' * (@discs - @disc) end