forked from mame/quine-relay
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathQR.rb
57 lines (57 loc) · 6.9 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
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}};Q=->s,t=?${s.K(t){B+$&}};M=->s{"<stdio.h>#{N}!t~mX{puts#{E[s]};return~0;}"};V=->s,a,z{s.K(/(#{B*4})+/){a+"#{
$&.size/2}"+z}};$D="program~QR";%(object~QR~extends~App{Z#{E[%((display~"#{e[%[echo~-En~"#{Q[e[e["Transcript~show:~'#{d[%(H
#{Q[E[%(fun~p~n=Z(Int.toSJ~n`x5e"~");p~0;p~0;p~ 130;Lis t.tabula te(127,p);SJ.map(fn~c=>(p(3+ord~c);Z"-1~0~";c))#{E[%(pro
c~f~{n}~{sJ~repeat~"Y"~$n};puts~a::=`x 7e[re K~-a ll~{ .}~"#{V[Q[e[%[!t~mX{sJ~s=#{E[%(with~Ada.Text_Io;procedure
~qr~is~beg!~Ada.Text_Io.Put_L!e("#{d [%( Z ("#{d[%(BEGIN{s=#{E[%(f={n~as~!t|'Y'*n};a=0;s=#{
V[Q[E["#!clude"+M["#!clude<i ostre a m>`n!t~mX{std::cout<<#{E[%(class~Program{public~s
tatic~void~MX{System.Consol e.W rite(#{E[%((doseq[s(lazy-cat["IDENTIFIC
ATION~DIVISION.""PROGRAM-I D .~QR.""PROCEDURE~DIVISION."'DISPLA`x59](
map~#(str"~~~~^""(.replac e~%1"^"""^"^"")"^"&")(re-seq~#".{
1,45}""#{e[%((f=(n)->Arr ay(n+1).jo!~"Y");console.log("%s",
#{V[E[%((H-l!e"#{e[%(~: ~A~."#{g*9}"~;~:~B~A~."~WRITE
(*,*)'"~A~;~:~C~B~T`x5 9PE~."~'"~CR~;~:~D~S"~#$D"~C~S
^"~Z~^"(&"~C~S^"~#{e [%(packag e~ma!;import"fmt";func~mX{
fmt.Pr!t#{E[%(Z'#{ e[("ma!=putStr"+E[%(proce dure~mX;i:=c:=0;s:=#{E[%(.c
lass~public~QR`n. super~#{$T="java/io/Pr!tStream"}`n .method~public~static~ma!(
[L#{S="java/lan g/"}SJ;)V~;]`n.limit~stack~2`ngetstatic~# {S}System/out~L#$T;`nldc
~"#{e[%(class~ QR{public~static~void~ma!(SJ[]v){SJ~c[]=new~SJ [8000],y="",z=y,s="#{z=
t=(0..r=q=126 ).map{|n|[n,[]]};a="";b=->n{a<<(n%78+55)%84+42};(% (@s=global[#{i=(s=%(PR
~"`x48AI^~1. 2~PR~"VISIBLE^~"#{Q["Z"+E[%(all:`n`t@echo~'#{d["l!el: 99999;Z#{E[%(.assembl
y~t{}.metho d~static~void~MX{.entrypo!t~ldstr"#{e[%(m:db`x60#{e[s="$ Z#{E[%(Zf#{E["requir
e('util'). Z#{E["#import"+M["Z_ sJ"+E[%(s=toascii#{E["Z#{E[%(say"#{e[" #$D(output);beg!~H(#
{((p="eval ";%($_="#{s=%(<?php~ function~f($n){return~str_repeat("Y",$n );};$f="f";$z=3+$w=
strlen($s =#{V[Q[E["!t~mX{H#{E [ %((___________)dup~=/s(|~~~~~.~~~|)def( #{Q["qr:-H('#{Q[e[
%(for~c~! "".jo!(["say~'%s'^n" %l~ for~l~!#{E[d[%(eval$s=%q(#$s)),?']]}.s plit("^n")]):Z('ca
t("r=fput (c har(%d))^n")'%ord(c) )`nZ( 'cat("end^n")'))],?']}').",B]}){9~7{ex ch~dup~1~and~79~m
ul~32~add ~exch~2~idiv~3~1~rol l~s~exc h~2~!dex~exch~put~1~sub~dup~6~eq{1~sub }if}repeat~s~=~po
p~pop}fora ll~=~qui t)]};return~0;}"]],"{$f(" ,")}"]})*3;echo"^
x89PNG^r^n^ x1a ^n";$m=""; $t="^xc 0^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`x48DR".pack( "NNCV",$w+2,128,8, 2), "IDAT".gzcompress ($m ),"IEND")as$d)echo~pack("NA*N ",strlen($d)-4,$d
,crc32($d));?>);(s+N* (-s.size%6)).un p ack("B*")[0].K(/.{6 } /){n=$&.to_i~2;((n+14)/26*6+n+ 47).chr}}";s|.|$n
=ord$&;substr~unpack( B8,chr$n-!t($n/3 2)*6-41),2|eg;Z~pack" B*",$_).scan(/[~,-:A-z]+|(.)/){ p="s++#{$1?"chr~#
{$1.ord}+e":$&+?+};"+ p};p)).K(/.{1,2 5 5}/){|s|"'#{s}',"}} ' ')end."]}"`nend)]};quit" ] };t=num2cell(b=11
-ceil(s/13));for~n=1: 9m={};for~i=1 :14 1f=@(x,y,n)repmat ([" Ook"~x~"~Ook " ~ y~32],[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)]; e n d;t(x)=m(diff(
[0~s(x=b==n)])+13);end ;Zf(strjo! (t,"")) )]]]}"]})+N]} ;"+N]}` x60`nglobal~_s t a rt`n_start:mo
v~edx,#{s.size}`nmov~ec x,m`nmov~ ebx,1`nmov~e a x ,4`n!t~128`n
mov~ebx,0`nmov~eax,1`n! t~128)]}"call~void~[m scorlib ]System.Console::Write(sJ )ret})]} ; q uit();",?$].
K(?'){"'^''"}}')].K(/[:" ]/,":^0"),/[~Y`t;"(){ }`[`] ]/]}"~PR~"`x4bT`x48`x58B`x59E~B`x5 9 E )).size+1}x
~i8]c"#{s.K(/[^"]/){"^%`x 58"%$&.ord}}^00"decla re~ i32@puts(i8*)def!e~i32@mX{%1=call~i3 2 @puts(i8*ge
telementptr([#{i}x~i8]*@s, i32~0,i32~0))ret~i32~ 0 })).bytes{|n|r,z=z[n]||(b[r/78];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<s.lengt
h();){q=q*78+(s.charAt(i)-13 )%84;if(i++%2>0){y=q <n?c[q]:y;c[n++]=z+y.charAt(0);Syst e m.out.Z(z=
c[q]);q=0;}}}})]}"`n!vokevirt ual~#$T/Zln(L#{S}SJ;)V`nreturn`n.end~method)+N]};H(" DO,1<-# "||*s);s?w
hile~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("PLEASEREADOUT,1^nPLEASEGIVEUP");end)]) .tr(B,?&)]}'.tr('&' ,'YY');)]}
;})]}"~DUP~FOR~S"~&A,&"~C~NE`x58T~ S^"~&A)^",&"~C~0~DO~B~."~&char("~COU NT~.~."~),&'"~CR~LOOP~ S^"~&^"^"
"~C~S"~end~#$D"~C~A~."~STOP"~CR~A~."~ END"~CR~B`x59E~;~D~)]}"))],' #{f(',')}']}))]}"))["~~~ ~^"~^".""
STOP~RUN."])](Zln(str"#{g*8}"s)))).tr~B ,?`x7e]}.Repl ace("`x7e","Y"));}})]};}"]]],"$(f(",")
)"]};for~i~!~range(len(s)):b~as~!t=s[i];a-= b;Z(('+'*-a~if~0>a~else'-'*a)+'.');a=b;).
tr~B,?`x21]};K(/`x21/,"Y",s);Z~s})]}"))]}");end ~qr;)]};!t~i,j;Z("module~QR;!itial~beg!~");for
(i=0;i<s.length;i++){Z("$H(^"~~~");for(j=6;j>=0;j--)Z( (s[i]>>j)%2>0?"Yt":"~");Z("YnYtYn~~^`");");}Z("$displ
ay(^"YnYn^");end~endmodule");return~0;}].reverse],/[`[`]$]/],"[f~",?]]}"~^x60.&]k^n::=^na)]};Z"0~0~-1";)]]};),?']}';cr"]]]}
"|sed~-E~-e~'s/([`x5eY]|Y.){1,120}/Zf("%s","^0");^n/g'].K(/.{1,3000}/){%(Zf("%s","#{d[d[$&],?']}")`n)}+"quit"]}"))]};})).gs
ub(/[!HJKXYZ^`~]/){[B*2,:write,B,:tring,:gsub,"ain()",B*4,:print,g,:in][$&.ord%47%12]})))*"")#_buffer_for_future_bug_fixes_
###################### Quine Relay -- Copyright (c) 2013, 2014 Yusuke Endoh (@mametter), @hirekoke #####################)