Class: Hanoi::Jane::ConstrainedTowers

Inherits:
Towers
  • Object
show all
Extended by:
ConstrainedStackFinder
Defined in:
lib/hanoi/jane/towers/constrained_towers.rb

Instance Attribute Summary

Attributes inherited from Towers

#base, #disc, #discs, #from, #stacks, #to, #total

Instance Method Summary collapse

Methods included from ConstrainedStackFinder

find_stack

Methods inherited from Towers

#binary, #each, #move, #rebased, #solved, #to_s

Methods included from StackFinder

#find_stack

Constructor Details

#initialize(discs = 3) ⇒ ConstrainedTowers

Returns a new instance of ConstrainedTowers.



6
7
8
9
# File 'lib/hanoi/jane/towers/constrained_towers.rb', line 6

def initialize discs = 3
  super
  @base = 3
end

Instance Method Details

#inspectObject



15
16
17
18
19
# File 'lib/hanoi/jane/towers/constrained_towers.rb', line 15

def inspect
  i = super
  i[:ternary] = i.delete :binary
  i
end

#ternaryObject



11
12
13
# File 'lib/hanoi/jane/towers/constrained_towers.rb', line 11

def ternary
  rebased
end