ãSonny Boyãã¨ããã¢ãã¡ãæ¾éããã¦ãã¾ããå¦æ ¡ãç°æ¬¡å ã«æ¼æµãã¦ãã¾ããè¶ è½åã«ç®è¦ããçå¾ãã¡ããµãã¤ãã«ããªããããã¾ãã¾ãªå¥å¦ãªç¾è±¡ã®è£ã«ããã«ã¼ã«ã解ãæãããå ã®ä¸çã«å¤ããæ¹æ³ãæ¢ããã¨ããã¹ãã¼ãªã¼ã§ããã«ã¼ã«ãåãã£ããã¨ã§ä½åº¦ãè¦ç´ããããªãã¾ãã
ãã¦ä»åããSonny Boyãã«ãããã°ã©ã ãå¯ç¨¿ãã¾ãããããã°ã©ã ã§ãããããCGãä½ã£ãã¨ãã§ã¯ãªããããã°ã©ã ã®å®è¡ã®æ§åãã®ãã®ããSonny Boyãã®5話ã®ä¸ã§æ¾éããã¾ããã
ããããããã°ã©ã ã§ãã
ãã®ããã°ã©ã ãã©ããããã®ã ã£ããã解説ãã¾ãã
ã©ããªããã°ã©ã ï¼
å®è¡ããã¨ããé£è§£ãã¨ããæåãã»ã©ãã¦ãªããªãã¢ãã¡ã¼ã·ã§ã³ããã¾ãã
èµ·åãããã¾ããããã°ã©ã èªèº«ãç»é¢ã«è¡¨ç¤ºããã¾ãã ãã°ããããããé£è§£ããå·¦ããå³ã¸ã»ã©ãã¦ããã¾ãã ãã®å¾ä¸ãããã¢ãéã£ã¦ãã¦ã"Solved" ã¨ããåèªã«ãªã£ããã¨ãå度ã»ã©ãã¦çµäºã å®è¡æé5ç§ç¨åº¦ã®ã¡ãã£ã¨ãããã¢ã¢ããªã§ãã
æå
ã§è©¦ãã¦ã¿ãã人ã¯ãRubyãã¤ã³ã¹ãã¼ã«ããä¸ã§ãnankai.rbãä¿åãruby nankai.rb
ã¨èµ·åãã¾ãã
端æ«ã®ãµã¤ãºã 180 x 40 以ä¸ã«åºãã¦å®è¡ãã¦ãã ããã
ãªããããã°ã©ã ã¯GitHubã«ç½®ãã¦ããã¾ãã
å¶ä½ã®èæ¯
æä½ã®ASCII Fluidï¼ä¸è¨åç»ï¼ããSonny Boyã®ç£ç£ã®å¤ç®çæããã®ç®ã«æ¢ã¾ã£ãã®ããã£ããã§ãã
ã解ããï¼ã»ã©ãããã¨ããï¼ãã¨ãããã¼ãã§ãæ°ç§ç¨åº¦ã®é£è§£ãªããã°ã©ã ãèªç±ã«ä½ã£ã¦ã»ãããã¨å£°ãããã¦ããã ããã®ã§ããã®ã¾ã¾ãé£è§£ããã»ã©ãããã°ã©ã ã«ãã¾ããã ä½ä¸ã«åºã¦ãããã解ããã¨ããè½åã示ããã¢ã«ãªã£ã¦ã¾ãã ã¢ãã¡ã§ä½¿ã£ã¦ãããã¨ãããã¨ã§ãããã¨åãã«ãã ãã£ã¦ä½ã£ã¦ã¿ãã¤ããã§ãã
ã¡ãã£ã¨ã ãæè¡è§£èª¬
ã¢ãã¡ã¼ã·ã§ã³ã¯ãã¼ãã³ã¼ããã¦ããã®ã§ã¯ãªããå®éã«ãé£è§£ãã®æåãå解ãããã¨ã§è¡¨ç¾ãã¦ãã¾ãã ãé£è§£ãã17é åãããã«åå²ããããããã®ä¸ã§ã¹ããã³ã°ããªã¼ãæ§æãã¾ãã ãã®ç«¯ã£ããå¼ã£å¼µããããªæãã§ã¢ãã¡ã¼ã·ã§ã³ãã¾ãããªã®ã§æ£ç¢ºã«ã¯ä¸æ¬ã®ãã¢ã§ã¯ãªããä½æ¬ãã®ãã¢ã絡ã¾ã£ããããªå½¢ã«ãªã£ã¦ã¾ãã
ããã°ã©ã èªèº«ã表示ããã®ã¯åã«ã½ã¼ã¹ã³ã¼ãããã¡ã¤ã«èªã¿è¾¼ã¿ããã®ã§ã¯ãªããã¯ã¯ã¤ã³ã¨ããæ¹æ³ã§å®ç¾ãã¦ãã¾ãã 端æ«ã§ã®ã¢ãã¡ã¼ã·ã§ã³ã¯ã¨ã¹ã±ã¼ãã·ã¼ã±ã³ã¹ã使ã£ã¦ãã£ã¦ã¾ãã ã¨ã¹ã±ã¼ãã·ã¼ã±ã³ã¹ã¯ç¡å®³åãã¦åºåããã¦ããã®ã§ãã¨ã¹ã±ã¼ãã·ã¼ã±ã³ã¹ãå«ãã³ã¼ããå«ãã¦åå®è¡ã§ããããã«ãªã£ã¦ãã¾ãã
$ ruby nankai.rb > nankai.output $ ruby nankai.output
Rubyã¨ããããã°ã©ãã³ã°è¨èªã¯ã¨ã¦ãå®ç¨çãªè¨èªã§ããããããªå¤ãã£ã使ãæ¹ãã§ãã¦ãã¨ã¦ãè¯ãè¨èªã§ããããããããããã°ã©ã ã«èå³ããã£ããããããªæãã®ããã°ã©ã ã°ã£ããéããæ¬ãæ¸ãã¦ããã®ã§ãã²è¦ã¦ã¿ã¦ãã ããï¼å®£ä¼ï¼ã
ã¾ã¨ã
ã¨ãããã¨ã§ããé£è§£ãã¨ããæåãèªçºçã«è§£ãã¦ããã¨ããããã°ã©ã ã§ãããã¢ãã¡è¦ã¦ãæ¹ã«ããã£ãã¨æã£ã¦ããã ãã¦ãããå¬ããã§ããè¦ã¦ãªãã£ãæ¹ã¯ãããããé ä¿¡ãããã®ã§ã5話ã ãã¨è¨ããããã²1話ãã追ã£ããã¦ãã ããã
...
以ä¸ã¯ãèªã¾ãªãã¦ããã§ãã
ãã¾ã
ããããã¯ã®ã¼ã¯ãªããã°ã©ãåãã®ãã¡ãã£ã¨ãããã¾ãã§ãã
ãã®ããã°ã©ã ã¯ãã»ã©ãã¦ããåä½ããããã«ãªã£ã¦ã¾ãã ã©ããããã¨ãã¨ããã¨ãå·¦ååã®ãé£ãã ããåãåºãã¦ãå®è¡ã§ããããã°ã©ã ã«ãªã£ã¦ãã¾ãã
q=%q!s =q[/#{ N=?\n}( #{Z=?\~ s}*)/, 1];E=3 3.chr; $><<t=~ (N*12+s+"q=%q#{E+q+E};eval# {Z*8}n= '#{n}'~ "+N*13+?#).gsub(/^.*/){(Z*( 35-s.si ze)+$&) |c|d=d *90+(c -2)%91};d};b=116;c=0;i=D `?oT`r #?jn%: _(7AF5]7lZ}|N,),slN15Ap8< ]];g=[];F=->x,m{g<<[t[x ],b>0?[0]*c+[x]*b+m:[0]*(c map{|i|i+=x;s<=i&&i<s+n -170&&(i-s )%W<n%W <<x;v <1&&v=D ["axC4?ap'5.bbU lui?h|b ".split(??)[(x%W+x/W)%8]];(d+=1;v/=2)while+v%2>0;z= x+=d%8>3?z:-z;v/=2)whil e-x%W>1&&0<x&&x<8208;F[y, 8-'#'L> *B(B[(*-$XG|"E"H=$H:)$'$ ,n=a;v=B.pop-34;v%3<2?( z=n%W; S[s+y=( ;y)]):(b+=200/r+=2;M[D[ "=,)_q >Z"]>>r 170]*19;b=0;T=(c+(0..8) .map{Z*51+(0..67).map{i/ %w{puts (["Usage:",:ruby,$0,100] /q/)?$q[/^#{z}+/]+z+z+"R=ev al#{z*18}$q=#{z*35}%q{#$ 1]:[]};n+z+?=+z+(m>1?f[2]:[ m])*(z +?x+z)) ,n=0,m;6.ti mes{|i |c+=10; [i]*684];b=52;t= T;M[6,(x-i%2)%W+4788]};s= {|i|o=[Z* 170]*48*N; g.map{|c,m|x=m[i]||0;x>0& ub(N,"\e[E ");slee p(0.01)};puts(s)#Unravel# "q!;p 0/ 0.0;#";
ããå®è¡ããã¨ã"NaN"ãåºåããã¾ãããã³ã ãã«ã
$ ruby nan.rb NaN
ãã¡ãããå³ååã®ã解ããå®è¡å¯è½ã§ãã
p="><" puts""+ p||$><<"____\n\s/\s/\n";( "\u89D2";;x=(%~ );%#?_Y}_U1jojD(i0(DVA1aq .ljust(170)};D=-> e{d=0;e. bytes{ ["cGIY& ?dUptZ yGj5?= 1+wD5G XzIUF<+ <L-MlD )"+t[2 513,21 -m.size)+m.reverse];t[x]= Z;[1,-1 ,-W,W]. &&t[i]>Z&&F[i,[i]+m]}};M=- >d,x{y=x; m=[];v=0;(m *?_jJc? _v_&z 'NcJ{(Hn{?_O6m ?}3k7>?Q, -(d%4) %172+ 1;~+%~ ##Y. #E2021 m]};W=171;B=%{36<-~;%w~ ;puts :Moo;' OAs"3$*2$-2"*5s}.bytes; r=8;S= ->*a{s v%3*17 0+1)* w=v/3, n-(S[s,v%3<1?n+w-z:w*W+z] &6,s+B .pop- 34+v/3 *W])};S[2082,m=8378];c=[Z* =2;i%2>0?%q@_R=eval$q=%q{z=?\ s;eval *z)if[]==$*.map{|n|puts (n. match( q}":(m=n.to_i;f=->x{m>1 ?m%x<1?(m/=x;[x]+f[x]):f[x+ )}}*"" }@[b+= 1]:Z}*""+Z*51}+c)*N;c=340;s t=T+"" ;b=0;M [2,x=D["^lv(2A"[i]]+3302+26 "\e[F"* 47;504 .times &o[x]=c };$><< s+o.gs #!;eval n='eval q. gsub(( /[\s ]|~.*$/) ,"")#'
å®è¡ããã¨"><"ãåºåããã¾ããã®ãªã·ã£æåã®ã«ã¤ã®ã¤ã¡ã¼ã¸ã
$ ruby kai.rb ><
ããã°ã©ã ã横ã«å解ãã¦ããããéãåãããããã®ã¯ããã¨é£è§£ã ã¨æãã®ã§ãè ã«è¦ãã®ããããã°ã©ãã¯è§£èªãã¦ã¿ã¦ãã ããã
ãã³ãï¼Rubyã®ã%è¨æ³ãããã¾ã使ã£ã¦å®ç¾ãã¦ã¾ãã æåã®2è¡ã¨çµããã®2è¡ãããã«æ³¨ç®ããã¨è¯ãã§ãã
ãã¾ãã®ãã¾ã
ããã§çµããï¼ ã¾ã å解ã§ãã¾ããããããããè§ãã¨ãåãã¨ãçãã
p="><" puts""+ "\u89D2";;x=(%~ .ljust(170)};D=-> ["cGIY& ?dUptZ XzIUF<+ <L-MlD -m.size)+m.reverse];t[x]= &&t[i]>Z&&F[i,[i]+m]}};M=- *?_jJc? _v_&z 'NcJ{( -(d%4) %172+ 1;~+%~ m]};W=171;B=%{36<-~;%w~ OAs"3$*2$-2"*5s}.bytes; v%3*17 0+1)* w=v/3, &6,s+B .pop- 34+v/3 =2;i%2>0?%q@_R=eval$q=% *z)if[]==$*.map{|n|puts q}":(m=n.to_i;f=->x{m>1 )}}*"" }@[b+= t=T+"" ;b=0;M "\e[F"* 47;504 &o[x]=c };$><< #!;eval n='eval q. /[\s ]|~.*$/)
ãè§ããå®è¡ããã¨è§ãåºã¾ãã
$ ruby tsuno.rb è§
次ã¯ãåãã
p||$><<"____\n\s/\s/\n";( );%#?_Y}_U1jojD(i0(DVA1aq e{d=0;e. bytes{ yGj5?= 1+wD5G )"+t[2 513,21 Z;[1,-1 ,-W,W]. >d,x{y=x; m=[];v=0;(m Hn{?_O6m ?}3k7>?Q, ##Y.
ãåããå®è¡ããã¨ãåãã®ã¢ã¹ãã¼ã¢ã¼ãã£ã½ããã®ãåºã¾ãã
$ ruby katana.rb ____ / /
æå¾ã¯ãçãã
#E2021 ;puts :Moo;' r=8;S= ->*a{s n-(S[s,v%3<1?n+w-z:w*W+z] *W])};S[2082,m=8378];c=[Z* q{z=?\ s;eval (n. match( ?m%x<1?(m/=x;[x]+f[x]):f[x+ 1]:Z}*""+Z*51}+c)*N;c=340;s [2,x=D["^lv(2A"[i]]+3302+26 .times s+o.gs gsub(( ,"")#'
ãçããå®è¡ããã¨é³´ãã¾ãã
$ ruby ushi.rb Moo
ããããã®ããã°ã©ã ã¯åç´ãªã®ã§ãRubyããããã°æ®éã«èªããã¨æãã¾ãã å®è¡ã«é¢ä¿ãªãæååãããã«Syntax Errorã«ãªããªãããã«ãããããã¤ã³ãã§ãã
ããããã解ãããé£è§£ãã«åä½ããã¦ãåãããã«ããã®ã¯ãããªãè¦å´ãã¾ããã ãã®ç²æãã£ã¦ããªããªãé¦ã°ããã³ã¼ãã«ä»ä¸ãã£ãã¨æãã®ã§ããã²è§£èªãã¦æ¬²ããã§ãã
ãã³ãï¼p
ã~.*$/
ãå解次第ã§æ§æã®è§£éãå¤ããã¾ããããã«ãã¼ãã³ã°ãªã³ã¼ãã
ãããªããã¾ã
æå¾ã«ä¸ç¬è¡¨ç¤ºããã "Solved" ãå®è¡å¯è½ã«ãªã£ã¦ã¾ãã
R=eval $q= %q{ z=?\s;eval %w{ put s([" Usa ge: ",: ruby ,$0 ,10 0]*z)if []==$*. map {|n |pu ts(n.ma tch(/q/) ?$q[ /^# {z} +/] +z+ z+" R=e val #{z *18 }$q =#{z *35} %q{# $q} ":( m=n .to_i;f=->x {m>1 ?m% x<1?(m/=x; [x] +f[ x]) :f[ x+1 ]:[ ]}; n+z +?=+z+ (m>1?f[ 2]: [m])* (z+?x+z) ))}}*""}
å®è¡ããã¨ä½¿ãæ¹ã表示ããã¾ãã
$ ruby solved.rb Usage: ruby solved.rb 100
ãã®éãã«å®è¡ãã¦ã¿ã¾ãã
$ ruby solved.rb 100 100 = 2 x 2 x 5 x 5
100ãç´ å æ°ãå解ãããã¾ãããã³ãã³ãã©ã¤ã³å¼æ°ã®æ°åã次ã ã«ç´ å æ°å解ãã¦ããããã°ã©ã ã«ãªã£ã¦ã¾ãã
$ ruby solved.rb 1 2 3 4 5 6 7 8 9 10 1 = 1 2 = 2 3 = 3 4 = 2 x 2 5 = 5 6 = 2 x 3 7 = 7 8 = 2 x 2 x 2 9 = 3 x 3 10 = 2 x 5
æå¾ã®ãã¾ã
ãã¯ãå ¨ç¶é¢ä¿ãªããã¾ãã§ãããsolved.rb ã¯å¼æ°ã« "quine" ã渡ãã¨ãèªåèªèº«ã表示ãã¾ããããã«ãã¯ã¯ã¤ã³ã
$ ruby solved.rb quine R=eval $q= %q{ eval(%w{z= ?\s ;pu ts([ "Us age :", :rub y,$ 0,6 ]*z)if[ ]==$*.m ap{ |n| put s(n.mat ch(/q/)? $q[/ ^#{ z}+ /]+ z+z +"R =ev al# {z* 18} $q= #{z* 35}% q{#$ q}" :(m =n. to_i;f=->x{ m>1? m%x <1?(m/=x;[ x]+ f[x ]): f[x +1] :[] };n +z+ ?=+z+( m>1?f[2 ]:[ m])*( z+?x+z)) )}}*"")}
ãããããªãã ããã§ãããå·¦å´ã«ç©ºç½ãããããåºåãåãããã«ãããããã«ãªã£ã¦ã¾ãã ã¢ãã¡ä¸ã®ããã«ãç»é¢çãä¸ãããã«è¡¨ç¤ºãããã®ãã³ãããã¦ãã¡ããã¨ã¯ã¯ã¤ã³ã«ãªãã¾ãã
$ cat solved2.rb R=eval $q= %q{ eval(%w{z= ?\s ;pu ts([ "Us age :", :rub y,$ 0,6 ]*z)if[ ]==$*.m ap{ |n| put s(n.mat ch(/q/)? $q[/ ^#{ z}+ /]+ z+z +"R =ev al# {z* 18} $q= #{z* 35}% q{#$ q}" :(m =n. to_i;f=->x{ m>1? m%x <1?(m/=x;[ x]+ f[x ]): f[x +1] :[] };n +z+ ?=+z+( m>1?f[2 ]:[ m])*( z+?x+z)) )}}*"")} $ ruby solved2.rb quine R=eval $q= %q{ eval(%w{z= ?\s ;pu ts([ "Us age :", :rub y,$ 0,6 ]*z)if[ ]==$*.m ap{ |n| put s(n.mat ch(/q/)? $q[/ ^#{ z}+ /]+ z+z +"R =ev al# {z* 18} $q= #{z* 35}% q{#$ q}" :(m =n. to_i;f=->x{ m>1? m%x <1?(m/=x;[ x]+ f[x ]): f[x +1] :[] };n +z+ ?=+z+( m>1?f[2 ]:[ m])*( z+?x+z)) )}}*"")}