array.rb: enforce towers of hanoi rules