x:=list f:=method(n,a,b,c,if(n>0,f(n-1,a,c,b);a print;x push(c);f(n-1,b,a,c))) f(File standardInput readLine asNumber,"A","B","C") write(" ",x join)

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

download

return to the top page