Brute-force algorithm to solve the Towers of Hanoi problem in Ruby