class Hanoi::Jane::ConstrainedTowers
Public Class Methods
find_stack(stacks:, from:, disc: nil, total: if from == 1)
click to toggle source
# File lib/hanoi/jane/towers/constrained_towers.rb, line 19 def ConstrainedTowers.find_stack stacks:, from:, disc: nil, total: # if we're in the middle if from == 1 # we always move to the right on an even total if total % 2 == 0 return 2 else return 0 end end
new(discs = 3)
click to toggle source
Calls superclass method
# File lib/hanoi/jane/towers/constrained_towers.rb, line 4 def initialize discs = 3 super @base = 3 end
Public Instance Methods
inspect()
click to toggle source
Calls superclass method
# File lib/hanoi/jane/towers/constrained_towers.rb, line 13 def inspect i = super i[:ternary] = i.delete :binary i end
ternary()
click to toggle source
# File lib/hanoi/jane/towers/constrained_towers.rb, line 9 def ternary rebased end