forked from mame/quine-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QR.rb
59 lines (59 loc) · 12.2 KB
/
QR.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
eval$s=%q(eval(%w(B=92.chr;g=32.chr;puts(eval(%q(N=10.chr;n=0;e=->s{Q[Q[s,B],?"].K(N,B+?n)};E=->s{'("'+e[s]+'")'};d=->s,t=?"{s.K(t){t+t}};def~f(s,n)s.K(/.{1,#{n*255}}/m){yield$S=E[$s=$&]}end;Q=->s,t=?${s.K(t){B+
$&}};R=";return~0;";V=->s,a,z{s.K(/(#{B*4})+/){a+"#{$&.size/2}"+z}};C=%w(System.Console~Write);$C=C*?.;$D="program~QR";$G="~contents~of"+$F="~the~mix!g~bowl";$L="public~static";"object~QR~extends~App{#{f(%((disp
lay~"#{e[%(#{f(%[echo~-En~"#{Q[e[e["Transcript~show:~'#{d["Z"+E[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~130;List.tabulate(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(proc~f~{n}~{sJ~repeat~"Y"~$n};puts~a::
=`x7e[reK~-all~{.}~"#{V[Q[e["!t~mX{Z#{d[E[%(module~QR;!itial~beg!~#{f(%(Module~QR:Sub~MX:Dim~s,n,i,c~As~Object:n=Chr(10):For~Each~c~!"#{d["<?xml#{O="~version='1.0'"}?><?xml-#{I="stylesheet"}~type='text/xsl'href=
'QR.xslt'?><xsl:#{I+O}~xmlns:xsl='http://www.w3.org/1999/`x58SL/Transform'><xsl:output~method='text'/><#{U="xsl:template"}~match='/'><`x21[CDATA[#{%(H,format="#{y="";f("^H{-}{txt}{#{Q[E[%(with~Ada.Text_Io;proced
ure~qr~is~beg!~Ada.Text_Io.Put_L!e("#{d[%(Z"#{e[%W[STRINGz:=~226+~153,a:=z+~166,b:=a+"2"+z+~160,c:=b+"8"+z+~165,t:="#{d["H('#{Q[e["implement~ma!0()=Z"+E[%(BEGIN{s=#{E[(s="#!clude<iostream>`n!t~mX{std::cout<<#{E[
"class~Program{#$L~void~MX{#{$C+E[(%(let~f(c ~:Int):La t!1=if~c=127then""else(sJ_of~c@"~g~caffe!e~"@sJ_of~c@"`n")@f(c+1)!~Z("Qu!e~Relay~Coffee.`n`nIngredients.`n"@f~10@"`nMethod.`n");let~g(SJ~->[])`n[c;t]->Z("P
ut~caffe!e~"@sJ_of(!t_of_char~c)@ "~!to# $F.` n");g~t` n|_~->Z("Liquify#$G.`nPour#$G~!to~the~bak!g~dish.`n`nServes~1.`n")!~g#{E[%((doseq[s(lazy-cat["IDENTIFICATION~DIVISION.""PROGRAM-ID.~QR.""PROCEDU
RE~DIVISION."'DISPLA`x59](map~# (st r "~~~~^""(.replace~%1"^"""^"^"")"^"&")(re-seq~#".{1,45}""#{e["(f=(n)->Array(n+1).jo!~ 'Y');console.log('%s',#{V[E[%((H-l!e"#{e["imp
ort~std.stdio;void~mX{H(`x60# {% (method~MX{Z(@"#{d["[#{%(class~QR:Application{void~f(SJ~const~s ,!t~n){for(Pr!t(s);n;n--)Pr!t("Y");}v
oid~MX{#{f("IO.puts"+E[%((p r!c~"#{e["`nma!(_)->`nio:fH#{E['Zfn("""'+d[?"+%(~:~A~."#{g*9 }"~;~:~B~A~."~WRITE(*,*)'"~A~;~:
~C~B~T`x59PE~."~'"~CR~;~:~ D~S"~#$D"~C~S^"~Z~^"(&"~C~S^"~#{e[%(Z"#{e["s:=Out putTextUser();WriteAll(s,#{E
[f('set~Z"-";Z'+E[%(packa ge~ma!;import(F"fmt";S"sJs");func~t(s~sJ)s J{r:="";for~i,n:=range~s{
if~n<48{r+="v"}else{r+= S.Repeat("Ww"[i%2:i%2+1],!t(n)-48)}};retu rn~r};func~mX{s:=t("01
3141")+S.Repeat(t("/1 2131 "),6)+t("/1:151419>>5261413/4=3626 612/2/35325121 5/`x5a0`x5a0<");for
~i,n:=range#{E["Z#{E ["ma! =putStr"+E["class~QR{#$L~fun ction~mX{neko.Lib.Z#{E[%(pro cedure~mX;i:=c:=0;
s:=#{E[%(.class~pub lic~ QR`n.super~#{$T="java/io/Pr !tStream"}`n.method~#$L~ma!([L#{S="jav a/lang/S"}J;)V~;
]`n.limit~stack~2`n getstatic~#{S}ystem/ou t~L#$T;`nldc~"#{e[%(cl ass~QR{#$L~void~ma!(SJ[]v){SJ~c[]=new~SJ[999 99],y="",z=y,s
="#{z=t=(0..r=q=126 ).ma p{|n|[n,[]]};a="";b=->n{a<<(n%78+5 5)%84+42};("conso le.log('%s',#{E[E[%(A=Z;A("k`x60");[(A("`x60`x60s" `x5e8*"i");fo
r~j=6:-1:0;x=(Int(c)> >j)%2+1;A("`x60"*"kki"[x:x+1])end)for~c~!~jo!(["S ection`x48ead er+name:=QR;SectionPublic-ma!<-(";["^"$(replace(replac e(s,"Y","YY
"),"^"","Y^""))^". Z;"for~s=matchall(r".{1,99}",#{Q[E[%(@s=global[#{i= (s=%(`x48AI~ 1.2`nVISIBLE~"#{"x=sJ.K(#{V[E["all:`n`t@echo~'#{d["l!el:99 999;Z#{E["
solve~satisfy;o utput~[#{E[%(.assembly~t{}.method~#$L~void~MX{.entrypo!t ~ldstr"# {e["m:db`x60#{e[s="$Z#{E["Zf#{E["echo"+E["#import<stdio.h>#{N }!t~mX{pu
ts#{E["Z_sJ"+E ["s=toascii#{E["Z#{E["#$D(output);beg!~H(#{f((p="eval";%($_= "#{s =%(<?php~$z=3+$w=strlen($s=#{Q[E["!t~mX{H#{E["(#{?_*11})dup~=/s(| ~~~~~.~~
~|)def(#{Q[" qr:-H('#{Q[e[%(for~c~!"".jo!(["say~'%s'^n"%l~for~l~!#{E[d["eval $s =%q(#$s)",?']]}.split("^n")]):Z('cat("r=fput(char(%d))^n")'%ord(c))`nZ('cat("en d^n")'))
],?']}')." ,B]}){9~7{exch~dup~1~and~79~mul~32~add~exch~2~idiv~3~1~roll~s~exch~ 2~!dex ~exch~put~1~sub~dup~6~eq{1~sub}if}repeat~s~=~pop~pop}forall~=~q uit"]+R
}}"]]})*3 ;echo"^x89PNG^r^n^x1a^n";$m="";$t="^xc0^0^xff";for($i=-1;++$i<128*$z;$ m.=$c--?($w-$c||$i>$z)&&$i/$z<($c<$w?ord($s[(!t)($c /3)]):
$c--%3+2 )?$t[2].$t[$c%3%2].$t[$c%3]:"^0^0^0":"^0")$c=$i%$z;foreach(array("I`x48D R".pack("NNCV",$w+2,128,8,2),"IDAT".gzcompress ($m),"
IEND")a s$d)echo~pack("NA*N",strlen($d)-4,$d,crc32($d)););v="";127.upto(287){|j|o={ };m=n=0;s.size.times{|i|o[f=s[i,2]]||=0;c =o[f]+
=1;m<c& &(m=c;n=f)};v=n+v;s=s.K(n,(j%256).chr)};s="$_='#{Q[s,c=/['Y]/]}';$n=32;$s='# {Q[v,c]}';$s=`x7es{..}{$a=$&;$b=chr(- -$n&25
5);`x7 es/$b/$a/g;}eg;Z";(s+N*(-s.size%6)).unpack("B*")[0].K(/.{6}/){n=$&.to_i~2;((n+1 4)/26*6+n+47).chr}}";s|.|$n=ord$&; subst
r~unpa ck(B8,chr$n-!t($n/32)*6-41),2|eg;eval~pack'B*',$_).scan(/[~,-:A-z]+|(.)/){p="s++ #{$1?"chr~#{$1.ord}+e":$&+?+};" +p};p
),1){ "'#$s',"}}'')end."]};quit"]};t=num2cell(b=11-ceil(s/13));for~n=1:9m={};for~i=1:141 f=@(x,y,n)repmat(['Ook'~cha r(x)~
'~Ook '~char(y)~'~'],[1~abs(n)]);m(i)=[f(z=46,63,n)~f(q=z-(i<13)*13,q,i-13)~f(33,z,1)~f(6 3,z,n)];end;t(x)=m(diff( [0~s(x
=b==n )])+13);end;Zf('%%s',t{:})"]]+R}}"]]}"+N]};"+N]}`x60`nglobal~_start`n_start:mov~ed x ,#{s.size}`nmov~ecx,m `nmov~
ebx,1 `nmov~eax,4`n!t~128`nmov~ebx,0`nmov~eax,1`n!t~128"]}"call~void~[mscorlib]#{C*":: "} (sJ)ret})] }];" ]};quit();",?$].K( ?'){"'
^''"} }'"],?&,?&]},'&(%d+)&',function(s)return~sJ.rep('Y',tonumber(s))end);Z(x)".K(/[ : "]/,":^0")}"` n`x4bT`x48` x58B`x59E~B`x59 E)).siz
e+1}x~ i8]c"#{s.K(/[^"`n]/){"^%02`x58"%$&.ord}}^00"declare~i32@puts(i8*)def!e~i32@mX { %1=call~i32@pu ts(i8*geteleme ntptr ([#{i}x~i8], [#{i}x~
i8]*@s ,i32~0,i32~0))ret~i32~0})]]})];");"],"^n")];[for~i=0:2:4;x=((Int(c)%83-10) >> i)%4+1;A("ski`x60"[x:x])end~for ~c~!"AG-`x48 -`x48Fy.I lD==;=jd
lAy=;=j ldltldltl{lAulAy=jtlldlAyFy=?=jdlAyGFyFyG2AFy>zlAFFBCjldGyGFy>GFy.AGy=G= =n`x 48==nlldC=j@=jtlldltldlAut11"])] ]})").bytes{|n|r ,z=z[n ]||(b[r/7
8];b[r]; q<6083&&z[n]=[q+=1,[]];t[n])};b[r/78];b[r]}";!t~i=0,n=0,q=0;for(;++n< 126;)c[n ]=""+(char)n;for(;i<#{a.size};){ q=q*78+(s.charAt(i) -13 )%84;if(i+
+%2>0){y =q<n?c[q]:y;c[n++]=z+y.charAt(0);System.out.Z(z=c[q]);q=0;}}}})]}" `n!vokevir tual~#$T/Zln(L#{S}J;)V`nreturn`n.end~method)+N]};H(" D O,1<-#"||*s
);s?while ~t:=ord(move(1))do{i+:=1;u:=-i;every~0to~7do{u:=u*2+t%2;t/:=2}; H("PLEASE")^(i %4/3);H("DO,1SUB#"||i||"<-#"||((c-u)%256));c:=u;} ;H("PLEASERE
ADOUT,1^nP LEASEGIVEUP");end)]};}}"]]}"]}{s+="W"+S.Repeat("w",(215+i-!t (n))%96+1)};F.Pr!t ("algoritmo~QR;!^xC3^xADcio~imprima(^`""+s+t( "/35512416612G
61913@921/17 A331513")+"^`");fim");})],61){"Zn#$S`n"}]});CloseStream (s);QUIT;"]}")]}"~DUP ~A~."~DO~10~I=1,"~.~CR~S"~&A,&"~C~."~10 ~~~~~~CONTINUE"
~CR~S^"~&A)^" ,&"~C~0~DO~B~."~&char("~COUNT~.~."~),&'"~CR~LOOP~S^ "~&^"^""~C~S"~end~#$D"~C ~A~."~STOP"~CR~A~."~END"~CR~B`x 59E~;~D~).K(?"){'
"34,"'}+?",?%]+ '~""")']}."]}"))],15){"f(#{V[$S[1..-2],'",',' );f("']},0);"}}}})}]pq"]}"); })}`x60);}"]}"))]. K(?`x60,"Yx60"),'#{
f(',')}']})"]}")) ["~~~~^"~^".""STOP~RUN."])](Zln(str"#{g *8}"s)))).reverse]}))]};}}"]};}/** **//****/";t={};b="";
L="";n=i=0;D=->n{L< <(n+62)%92+35;D};s.bytes{|c|n> 0?n-=1:(t[c]=(t[c]||[]).reject{|j|j<i- 3560};x=[];t[c].map{|j|
k=(0..90).f!d{|k|not~ s[i+1+k]==s[j+k ]}||91;k>4&&x<<[k,j]};x=x.max)?(n,j=x;x=b.si ze;(u=[x,3999].m!;D[u%87][
u/87];L<<b[0,u];b[0,u]=" ";x-=u)while~x>0;x=4001+i-j;D[x%87][x/87][n-5]):b< <c;t[c]+=[i+=1]};"#!clude<std
io.h>`nchar*p=#{E[L]},s[999 99],*q=s;!t~mX{!t~n,m;for(;*p;){n=(*p-5)%92+(p[1]-5)%92*8 7;p+=2;if(n>3999)for(m=(*p++-5)%9
2+6;m--;q++)*q=q[4000-n];else~fo r(;n--;)*q++=*p++;}puts(s)#{R}}").tr~B,?`x21]};K(/`x21/,"Y",s);fo r(Z"def!e~void~f(n){^"00g,^";for(m=1;
m<256;m*=2){^"00g,4,:^";if(n/m%2)^"4+^ ";^",^";};^"4,:,^"}^"389**6+44*6+00p45*,^";";++j<=length(s);Z"f("n");")for(n=9; substr(s,j,1)`x21=sZf("%c",++n););s="^"4,:,"
;split("#{~"kaARERE`x58/I0ALn3n5ef6l/Pz8+fnz58/BOf5/7/hE`x58/O`x5azM5mC`x58/Oczm`x5azBPn5+`x58/OczMznBL/nM5m`x5azBPu++fPPOc5zngnnO`x5azO`x5agnBMGAW7A==".unpack(?m)[0].bytes~*~g~}",a);for(i~!~a){s=s~0;for(c=a[i]+
0;c;c--)s=s"1+";s=s",";}Z~s"@^"^nquit"})]],?']}');"]}";FORiTO`~UPBtDO`~INTn:=ABSt[i];Z(~(50+n%64)+c+~(50+n%8MOD8)+c+~(50+nMOD8)+b+"`x4a"+a)OD]*"REPR"]}")]}");end;)]+"`nsys.exit~0",/[^{}]/]}}",35){y<<",`n"+$S;"%s
"}}")+y}]]></#{U}></xsl:#{I}>"].K~N,'"&~VbLf~&"'}":s="~~~":For~i=0To~7:s~&=Chr(32-(Asc(c)>>7-i~And~1)*23):Next:#$C(s~&n~&Chr(9)&n~&"~~"):Next:#$C(n~&n~&n):End~Sub:End~Module),3){%($H("%s",#$S);)+N}}end~endmodule
)],?%]+R}}".reverse],/[`[`]$]/],"[f~",?]]}"~^x60.&]k^n::=^na)]};Z"0~0~-1";)],?']}';cr"]]]}"|sed~-E~-e~'s/([`x5eY]|Y.){1,118}/()=Zf("%s","^0");^n/g'],7){%(Zf("%s","#{d[d[$s],?']}")`n)}}quit)]}")),196){%(Z#$S;)}}}
").gsub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug_fixes_#_buffer_for_future_bug
################################################################## Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke #################################################################)