Tower of Hanoi by hallvabo

s=t=''
m=1<<input()
_='CAB_A'[::m%3]
while~-m:m-=1;s+=_[-~(m|m-1)%3];t+=_[(m&m-1)%3]
print s+'\n'+t

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

download

return to the top page