$b='bcdefghia';eval($s='t={h:[1,0],j:[0,-1],k: [0,1],l:[-1,0],i:[0,0]};p=->a,b{i=$b.index(?a ); x = i% 3+ a;y = i/3+b;(x< 0 ||2 0&& ( sra n d(o ); a= b=n = 45; ( p[* (a ,b =(t . values-[[ - a,-b],[0, 0] ]) .sa m ple)]&&n- = 1)while(n >0 ); ) ; en d;print("$b=\47#$b\47;eval($s=\47");n="111114 1424414143341142414424344111143434".scan(/.{, 5} / ) ;m =" 000 001 1 00101111" . scan(/.{, 3} /) ;s= 0;b = ->_=1{_.t i mes{print ($ s[ (s+ =1) - 1]) } };w =- >_ =13 {pr i nt" \ 40" *_ }; b[22];put s ;3.times{ | y|b[45];p ut s; b[2];w[]; b [];w[];b[ ] ;w[];b[2] ;p ut s;1 0 .ti m es{ |l| b[ 2] ;3. t ime s {|x |w[ 2] ;$ b[y * 3+x]==?a? ( (l==3&&!p ri nt ("\ 4 0\40\124\ 1 22\111\10 3\ 11 3 \ 40 \40"))||(l==5&&!print("\105\120\111\123\117\1 04\105\40\111"))||w[9]):m[n[$b[y*3+x].ord-98] [l / 2 ]. to _i].chars { (_1==?1?b : w) [3 ]};w[2];b [ x/2+1]};p u ts }; b[2 ] ;w[ ];b [ ]; w[ ];b [ ];w []; b TRICK [2 ]; put s ;b[45];pu t s} ;b [9] ; puts("\47 . EPISODE I gs ub (/[ [ :sp ace : ][ :u ppe r :]] /,% % %) ); "); i ||break;p r in t( "\1 2 enter\40[ h jk l] \ 4 0o r\40[q]uit\40>\40");o=:"#{$stdin.gets.chomp}" ;puts;end'.gsub(/[[:space:][:upper:]]/,%%%));