Tower of Hanoi by kaki

b="";s="ABC"*99;puts (1...2**t=gets.to_i).map{|n|b<<s[-~(n|~-n)*k=2-t%2];s[(n&~-n)*k,1]}*"",b

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page