Skip to content

A self-reproducing program that shapes the station names of Yamanote Line

Notifications You must be signed in to change notification settings

atari-sog/yamanote-quine

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Yamanote Quine(山手Quine)

This is a self-reproducing program that shapes "Tokyo"(東京), a station name of Yamanote Line.

n=0;eval$S=%w!d="2-,<'%*+D-)+4?>F*(>,%'&<9M&(%-9)%},;'+'E}
,'-BB+(1+9,JJS.;z,33&/&)HH,,&dys%3}5,),(+@@&*&5&}2%&6(*81(
(&,&m-4477%+=*0)0,'*$,0}++$)&-/.+*$}&.&E%$($$$*$'}#}|%$%|,
$-$+0<}|+?)'lQ(Rr%XWD&l>`4.&;k5;d6qU-L;J8-*qjU1x11.&^1.B7/
?L.7/6/%98}1r//?L[4[;S8C?,/~d.dz~A(AAmzAm.+-,ED}ND5;+DI}%Q
%>RR**c)S+HL5(<</4(&G<<d}5+I@=AV%Py/+%~-/T-/*wi,v/R(1I==j+
V~c'18(&A%8P/s=@[)N}1s1~x/*J  *@)Lh18&;vL,'r.^W/h'>k'X<)'g
_l.^ER3W<)8h<)3F,l_b.b8+U*XU  )l;/=2'^K~(:2(:2,*}+2()F,*}+
Kw+Kw+Kw+2                                      ,*F%#DN-})
Z*/,(R^*^Q5<5%,1;)/7(&yN+#&G  *O@*#OOO#h3W.j);~#U6U6j);]3?
?YYHL?3r[Chz&2+/2+j%z22.K.%,  p2WK9kKx2:(2T(2}L(.B#&Q^rG^*
i'/-#1.-'#/61x/x                          ~11%;ZCC5&9]9S*~
#h*aJZLNC4[CZM3G  (_GyGGG+3)  `4F&9E4ZMO  @oOo3?)&1C(b*I1^
%/71<S*'49&?Wupn  u&;W4>;W'?  )'l.v}8g(Y  YY>)1b%,9R(1YYY;
?i/R+/+qTIT&A&'3                          Z~MOoWu`4ErP1'I1
x14[/61I'i'/%3<M  W#6/+',9+1  ':H87.EC?,  1_q@*1G.:8+%W2Wm
#ND&l>`CC]&1#3-3  -[gN//71.1  8'F>#[4]3#  n5)ET8P..7/YHE~y
/f.f}N,8b8@''IrU                          J9L#6/6/+<L#6/+2
/+-)L+-.b._//5Z%[(nQ&>3,.C      &'7/6*%G(6:V2*~1D'>)1)M2'~
/-1r5?R(#1I1Ic9?+4(&b%&Q  *8  //  8h*&PN+&f1/-'8h'8#h*JZ;[
C8Hi1*P6-2G{*PDs5)i'c,  ?:~'  c,&>  *WP.d.69Q?Q.^E4r&1(WP#
.:+)k%::2:(KQ5Lma)Z+  49_;6*  @9;*@9  ;*3_&T.P2::%:dAA4&?p
aJ;Za;ZaJo3l&T~&y5  ;#TIT5;T  &',&>]>?  YL?39`C3Zp*#aJW<p*
#aJW#<n4[43pFe    7tete7t3^M  )Q>)/5+}H.    -',):<)R*Q&T;`
u)'GX../HF    'gLlsR1P8+%;?1  ~%/h*#/6RA#I:I    :gcQ.+Xsv}
sX+'v}+1%:N#:8d..F,&1E'R'(Q/  T&A-QQ%Q+Q*%:-*2'(wQ%(-%XP{i
A1i1)Fz&1~%&A,M+4X&b%&IE1..1E*&PN+&f&1-[C?`CC4F,8*.U*ATwG%
wGn5?*%.,_>K.K);#K6j);#K6K);K15;'43(?,19Q,*R_+X&{Ng>`4ZMOo
@o8[A8:.x/i)F1Fv&f%N(E-*.qc~1s#/6.-95f&1-[41H8/?<*3^b/11%=
2'DD%1DDUDw%,(}82}>+~2*A2*A2  j+,5*AcA'};6*%);*%.*%/,>/Mk2
#.K1-K^22GKX*KD*2A-)L+-/i'c}  W}#+N9?8:}/}+#6P673<&>%&y&^%
n-k51{6+m+#GU#6U6,&>/~#+N+;S  ],`C4F&9ECZMO@oO@o]?F7tR%.}Q
p_1E*9SE[Z                                      ~F7t8*9S=J
3FFeB7teB7t]3FFe7R,FX%&IE1..1E*n6%fs='8//8'3?,KT*2AN)p4;Zu
L./?L./?L(._/>3,::1-*-'K-+A-K:-K_?)*;)/5+}.B5>'B/1-5>+%P2+
PkF+qPq5>*gA%V+Ac%                      ,/>])`#CCF>#CCM,[C
&G<?~#I:#I:(<?#I:I  +)Z:8:L?]z/->)T.-A  .m+.m+~.d59+T'd-cR
//)M%.1H+'8,F(/B1H  /E'>k'b+'v}+X#k~AA  (AA}5AA(Agd9k+V%)L
2+#I:P-X+T(-+};+z'  (&PN+L).'bm**:G(RA  (.d./<L#6/q/%9L~q/
%9L%JE'H)&;3n?,19Q  ,*R_+X&{Ng>`4Lp4>9  (/G5SG(/G8*9S=J'&2
(.61(O%PyP#fT-fT-f                      *Dc))f+R*2*x%jA#UG
U.>5'_.^]?&9~#V'#V'V'5&9~#V'  #V'5&9]eB5?K-:{%:+g:+RP65?I~
:+':%;?j*.B7M)/1b+==(/PL,AN4  MFet]9`Cu,1;X,*^'G.:&KnD&lF~
MOoWu`u2}+,12}v%<X:D  {)%5A-  %X<)    %D,QR)*j+-+<5U::,Rm;
5)Q1%6(A";88.times{|  i|d=i=  =31?d.gs  ub(?~){$'[0,3]}.gs
ub(?#){$'[0,2]}:d.  gsub(""<  <123-i,d[0  ,z=i/82+2])[z..-
1]};i=j=-k=b=1;d  .bytes{|c|  d=b+=b+k^=c&  1};c=33.chr;n=
($*[0]?n-1:n    +1)%30;n==25  &&ENV["NO_TGW"  ]&&n=($*[0]?
n-1:n+1)%30;0.upto(n%30)      {k=(c*58<<10)*m=b%4*23+30;b/
=4;9.step(m,23){|m|i+=v=b%2;760.times{|p|k[p%38+(p/38+m)*5
9-226]=""<<d[249+(v<1?b/2%64:i)*380+p/2]+32};b>>=7-v*6}};p
uts((c*58<<10<<k<<c*54).gsub(c){"n=#{n};eval$S=%w#{c+$S[0,
2680]*9}"[j+=1]}+c+"*''")#d="2-,<'%*+D-)+4?>F*(>,%'&<9M&(%
-9)%},;'+'E},'-BB+(1+9,JJS.;z,33&/&)HH,,&dys%3}5,),(+@@&*&
5&}2%&6(*81((&,&m-4477%+=*0)0,'*$,0}++$)&-/.+*$}&.&E%$!*''

When executed, it prints the next station of Tokyo, i.e., "Kanda"(神田); the output is an executable Ruby code, which prints "Akihabara"(秋葉原). It returns to the original shape when executed 30 times (as Yamanote Line has 30 stations).

Bonus

  • It runs counter-clockwise by default. You can reverse the direction by adding any command-line argument: ruby yamanote-quine-inner-circle.rb rev prints "Yurakucho"(有楽町).
  • yamanote-quine-outer-circle.rb is a clockwise variant.
  • "Takanawa Gateway"(高輪ゲートウェイ) is now supported (a new station opened in 2020 🎉). If you don't like it, you may want to set an environment variable NO_TGW to skip the station: export NO_TGW=1.

About

A self-reproducing program that shapes the station names of Yamanote Line

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 99.6%
  • Shell 0.4%