From e8b0180974a1f51ae3894d3e055461a1037c778d Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Mon, 19 Dec 2022 22:12:34 +0900 Subject: sample/trick2022/: adds the top-three entries of TRICK 2022 See https://github.com/tric/trick2022 for TRICK 2022. --- sample/trick2022/01-tompng/Gemfile | 2 + sample/trick2022/01-tompng/Gemfile.lock | 13 ++++ sample/trick2022/01-tompng/authors.markdown | 3 + sample/trick2022/01-tompng/entry.rb | 40 ++++++++++++ sample/trick2022/01-tompng/remarks.markdown | 51 +++++++++++++++ sample/trick2022/02-tompng/authors.markdown | 3 + sample/trick2022/02-tompng/entry.rb | 32 ++++++++++ sample/trick2022/02-tompng/remarks.markdown | 32 ++++++++++ sample/trick2022/03-mame/authors.markdown | 3 + sample/trick2022/03-mame/entry.rb | 27 ++++++++ sample/trick2022/03-mame/remarks.markdown | 96 +++++++++++++++++++++++++++++ sample/trick2022/03-mame/test.txt | 13 ++++ sample/trick2022/README.md | 14 +++++ 13 files changed, 329 insertions(+) create mode 100644 sample/trick2022/01-tompng/Gemfile create mode 100644 sample/trick2022/01-tompng/Gemfile.lock create mode 100644 sample/trick2022/01-tompng/authors.markdown create mode 100644 sample/trick2022/01-tompng/entry.rb create mode 100644 sample/trick2022/01-tompng/remarks.markdown create mode 100644 sample/trick2022/02-tompng/authors.markdown create mode 100644 sample/trick2022/02-tompng/entry.rb create mode 100644 sample/trick2022/02-tompng/remarks.markdown create mode 100644 sample/trick2022/03-mame/authors.markdown create mode 100644 sample/trick2022/03-mame/entry.rb create mode 100644 sample/trick2022/03-mame/remarks.markdown create mode 100644 sample/trick2022/03-mame/test.txt create mode 100644 sample/trick2022/README.md (limited to 'sample') diff --git a/sample/trick2022/01-tompng/Gemfile b/sample/trick2022/01-tompng/Gemfile new file mode 100644 index 0000000000..982b9de67f --- /dev/null +++ b/sample/trick2022/01-tompng/Gemfile @@ -0,0 +1,2 @@ +source 'https://rubygems.org' +gem 'matrix' diff --git a/sample/trick2022/01-tompng/Gemfile.lock b/sample/trick2022/01-tompng/Gemfile.lock new file mode 100644 index 0000000000..8bb3c69025 --- /dev/null +++ b/sample/trick2022/01-tompng/Gemfile.lock @@ -0,0 +1,13 @@ +GEM + remote: https://rubygems.org/ + specs: + matrix (0.4.2) + +PLATFORMS + x86_64-darwin-20 + +DEPENDENCIES + matrix + +BUNDLED WITH + 2.3.3 diff --git a/sample/trick2022/01-tompng/authors.markdown b/sample/trick2022/01-tompng/authors.markdown new file mode 100644 index 0000000000..26ebe24da6 --- /dev/null +++ b/sample/trick2022/01-tompng/authors.markdown @@ -0,0 +1,3 @@ +* Tomoya Ishida (tompng) + * tomoyapenguin@gmail.com + * cctld: jp diff --git a/sample/trick2022/01-tompng/entry.rb b/sample/trick2022/01-tompng/entry.rb new file mode 100644 index 0000000000..97beacc684 --- /dev/null +++ b/sample/trick2022/01-tompng/entry.rb @@ -0,0 +1,40 @@ + eval((s=%~c=(0..35 + ).map{s[2*_1+1]}*'';class$Inte + ger;def$quXinclude(Math ;spXo(a)=self* + a.pow(87X=h=32.chr;g=PI/480;ls=(sp*31X,89)%89; + def$abX+'eval((s=%'+(n=? .next)+s*88.chr+[nXs()=[a + =self%X+'.split(',sp*25+'?'+88.chr+');(0..36).mapX89,89- + a].miX{s[2*_1].split}',sp*31+".join.tr('$',$/)))"]*$/)Xn;end + ;reqX.split$/;trap(:INT){puts;exit};q=->t,i{a,y=((t+i*99)Xuire + 'matrX%960). ivmod(80);[(a*(7+i)+i*23)%79+(y+a)/(5+i%4)%2,39Xix';1 + 5.tiX-y/2]};p=->t,u{a=->b,c{(0..5).sum{(u%2-1)*E**(t*(b+c*_1)*gXmes{ + |i,*X.i+ i*u+=5+sin(u*u))}};x,z=a[5,3]. 5,3].rect;x+=y.Xv|z= + *?!Xi a[19,4];z+=w;r=(4+(x.abs+z.i).ab };t=(0..959).fX..? + W,?Xind{|t|(0..29).all?{x,y=q[t,_1];(x 2||h=ls[y][x]X[,* + ?]..X[/[^!-}]/]}};h=($**h+h).chr;eval( []} ->(x,yX?};a + =(0X,a,b){x=x*36+39.5;y=19.5-y*18;b*=1 |i|((yX..1 + 34)X-b).ceil..y+b).map{|j|((x-i)/a+(y j)/ .times{X.ma + p{zXx,z=p[t,_1];l=u```=0;while``````(l<1)``; u+```=0 ;d=x-y;X.in +dex(Xl+=(d.abs+(z-w``)``.i).ab``s*1.``1 ;x``,z=y``,w;o[v``=``x.r d.imag/Xc[i+ +15*Xd.abs*l*sin(2*``l-t``*g*80``-_1) l*(``1-l)/``6,a``=l*( -l)**2*0.X_1] +)};X7,a*2]&&o[v,z,``0.0``3,l**`` ``times``{|i``|(8+i).times{|Xw=* +MatXj|o[sin(i)/2+````` ```sin( `/2.0`````````)*j/200,j*0.0Xrix +[*(X5-1,0.02,0.1]``}} ``. q[t,``_1];m``[y][x]= };i=-X0.. +44).X1;$><<(['%%','[H .map{|j|(0..79).map{|k|x=(Xmap{ + |i,X -39.5)/35.8;y=( i+=1;m[j][k]?h:c[i]):ls[j]X*b| + v<l { v9 { P l ga%]AK$#BrjXb< Vector[24, 42, 83] +(matrix * answer).map { _1 % 89 } #=> Vector[1, 2, 3] +``` + +#### Resuming Animation + +The entire animation of this fish tank is a loop of 960 frames. +This program uses position of the floating bubbles to detect current frame number from the executed source code. diff --git a/sample/trick2022/02-tompng/authors.markdown b/sample/trick2022/02-tompng/authors.markdown new file mode 100644 index 0000000000..26ebe24da6 --- /dev/null +++ b/sample/trick2022/02-tompng/authors.markdown @@ -0,0 +1,3 @@ +* Tomoya Ishida (tompng) + * tomoyapenguin@gmail.com + * cctld: jp diff --git a/sample/trick2022/02-tompng/entry.rb b/sample/trick2022/02-tompng/entry.rb new file mode 100644 index 0000000000..2e2e2bcf74 --- /dev/null +++ b/sample/trick2022/02-tompng/entry.rb @@ -0,0 +1,32 @@ + q=->{!sleep _1/1e2};p=( + c=0..2).map{[_1/9r ,0,5**_1.i/3,1,0]} + require'socket';puts'op' "en http://localhost:#{( + w=TCPServer.new$*[0]||0).addr[1]}";Thread.new{q[2];f=[-1 + ]*s=3;t=Time.now.to_f;p.select!{0<_1[3]=[_1[3]+_1[4]/8.0,1 + ].min};9.times{h=p.map{[2**(_1*t.i)/_4**0.5/(1+Math.sin(2*t- + 9*_1%2)**32/16),_2+_4*( _3-_2)]};r=[s*3/2,84].min;g=->{x,y= +(s*(1+_1+1i)/2).rect;x<0 ||x>=s-1||y<0||y>=s-1?0:((l=f[y+1])[ +x+1]*(a=x%1)+(1-a)*l[x] )*(b=y%1)+(1-b)*((l=f[y])[x+1]*a+(1- +a)*l[x])};f=(1..r).map {|y|(1..r).map{|x|z=1.5+1.5i-3.0*(y +.i+x)/r;[h.sum{g[_1.*z +_2]}*0.9,1].min}};s=r};c=f.flatten +redo};loop{s=w.accept ; Thread.new{r=s.gets;h='HTTP/1.1 '+ +"200 OK\r\nContent-" 'T' "ype:text/html\r\n\r\n";r['/ ']?s. + <<(h+'