permutation date by aglias

b=[]
[*3..9].permutation.map{|a|a[3]<6&&a[5]<6&&b<<[0,a[0],2,a[1],1,a[2..-1]]*""&&a[2]<4&&b<<b[-1].tr('12','21')}
puts b.sort

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

download

return top