Last active
June 2, 2018 15:56
-
-
Save tompng/923ad9fb233cdb37fbc032ff6200c98e to your computer and use it in GitHub Desktop.
s4: christmas tree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p,i,u,f,v,q,h,x=[],Math,->x{i.sin x},->x,y,z{x*=1.2 | |
r,a,m=(1-y=y*1.4+0.15)/2+0.1,y+u[3*x+4*y+5*z*=1.2]/12,x*x+z*z | |
l,s,b=m**0.5,i.atan2(z,x),u[6*a]**2/36+((x*x+z*z)**0.5-r)**2-(1-a*a)/1000 | |
l-=(1-y)/8*d=(u[2*s+3*3*t=1-y-l/2]*u[3*s-3*2*t])**2/(1+i.exp(10*t-14.5)) | |
e=4*l/(1+(0.01+(1-a=y-d*(1-y)/8)**2)**0.5-a)*(1-a*a+(0.01+(1-a*a)**2)**0.5)**0.5 | |
(i.atan((1-0.2*i.asin(0.98*u[5*i.atan2(y=3*y-3.4,x*=3)]))*((0.01+x*x+y*y)**0.5-0.1)+4*(0.01+z*z*4)**0.5-1)*i.atan(a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b}, | |
%&MMM##TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];-~'ga;,,,.'MerryChristmas!&,->x,y,z,s,m{ | |
if m==1 | |
g=f[x+=s/2,y+=s/2,z+=s/2] | |
a,b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z]-g,f[x,y,z+d]-g | |
p<<[x,y,z,a/d=(a*a+b*b+c*c)**0.5,b/d,c/d] | |
else | |
(r=0...n=[m,4].min).map{|i|r.map{|j|a,b=[f[x+k=s*i/n,y+l=s*j/n,z+s],f[x+k,y+l,z],f[x,y+k,z+l],f[x+l,y,z+k],f[x+s,y+k,z+l],f[x+l,y+s,z+k]].minmax | |
return 8.times{|i|q[x+s*i[0],y+s*i[1],z+s*i[2],s,m/2]}if a*b<0&&s/=2}} | |
end},0,1..j=128 | |
8.times{|i|q[i[0]-z=1.0,i[1]-z,i[2]-z,z,64] | |
$><<v[2*i+64,2]} | |
sleep 1 | |
loop{r,s,m,l,d,w=i.cos(h+=0.02),u[h],i.cos(m=u[2.3*h]/5),u[m],x.map{[7]*j},x.map{[7]*j} | |
p.each{|x,y,z,a,b,e|x,z=x*r+s*z,z*r-s*x | |
y,z=m*y+l*z,m*z-l*y;x,y=64*(x+1),64*(1-y) | |
x<j&&y<j&&z<d[x][y]&&(d[x][y],w[x][y]=z,(8*(1+(a*r+b+e*s)/2)/2).floor)} | |
32.times{|i|4.times{|x|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][(h/2+u[i*i])%1*j+x[1]]=5}} | |
$><<"\e[1;1H"+(0..63).map{|y|x.map{|x|v[w[x-=1][2*y]*8+w[x][2*y+1]]}*''}*$/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'zlib' | |
code=File.read('christmas.rb') | |
compressed=[Zlib.deflate(code)].pack('m') | |
codezip = "require'zlib';eval Zlib.inflate *%(#{compressed}).unpack('m')" | |
codestr = "eval %w("+ | |
code.gsub(",\n",',').gsub(/if [^}\n]+/){|a|a.gsub(' ','(')+')'}.gsub(/return .+if/){|a| | |
'return('+a[7..-3]+')if' | |
}.gsub(/ ./){|a|'('+a[1]+')'}.strip.lines.map(&:strip).join(';')+")*''" | |
puts codezip | |
puts | |
puts codestr | |
require 'chunky_png' | |
img=ChunkyPNG::Image.from_file('mc.png');w,h=img.width,img.height | |
show=->s{ | |
lines=[] | |
s.ceil.times{|y| | |
iy=y*w/s*2 | |
break if iy>=h | |
lines<<s.ceil.times.map{|x| | |
ix=x*w/s | |
((img[ix.round,iy.round]>>8)&0xff)<128 ? '#' : ' ' | |
}.join | |
} | |
a=lines.map{|a|a.scan(/^ */)[0].size}.min | |
b=lines.map{|a|a.scan(/ *$/)[0].size}.min | |
lines=lines.map{|s|s[a..-b-1]} | |
puts $out=lines*$/ | |
[lines.join.count('#'), lines[0].size] | |
} | |
require 'pry' | |
binding.pry | |
shape=File.read('tmp.rb') | |
a=zip.chars;formatted=shape.gsub(/%\([^)]+\)/){|s|s.gsub('#'){a.shift||'#'}} | |
__END__ | |
ffmpeg -i christmas.mov -vf crop="1200:1200:28:23" -ss 5 -t 24 -s 720x720 -r 40 -vf format=yuv420p -pass 1 out.mp4 | |
ffmpeg -i christmas.mov -vf crop="1200:1200:28:23" -ss 5 -t 24 -s 720x720 -r 40 -vf format=yuv420p -pass 2 -vb 128k out.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p,i,u,f,v,q,h,x=[],Math,->x{i.sin x},->x,y,z{x*=1.2 | |
r,a,m=(1-y=y*1.4+0.15)/2+0.1,y+u[3*x+4*y+5*z*=1.2]/12,x*x+z*z | |
l,s,b=m**0.5,i.atan2(z,x),u[6*a]**2/36+((x*x+z*z)**0.5-r)**2-(1-a*a)/1000 | |
l-=(1-y)/8*d=(u[2*s+3*3*t=1-y-l/2]*u[3*s-3*2*t])**2/(1+i.exp(10*t-14.5)) | |
e=4*l/(1+(0.01+(1-a=y-d*(1-y)/8)**2)**0.5-a)*(1-a*a+(0.01+(1-a*a)**2)**0.5)**0.5 | |
(i.atan((1-0.2*i.asin(0.98*u[5*i.atan2(y=3*y-3.4,x*=3)]))*((0.01+x*x+y*y)**0.5-0.1)+4*(0.01+z*z*4)**0.5-1)*i.atan(a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b}, | |
%&MMM##TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];-~'ga;,,,.'MerryChristmas!&,->x,y,z,s,m{ | |
if m==1 | |
g=f[x+=s/2,y+=s/2,z+=s/2] | |
a,b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z]-g,f[x,y,z+d]-g | |
p<<[x,y,z,a/d=(a*a+b*b+c*c)**0.5,b/d,c/d] | |
else | |
(r=0...n=[m,4].min).map{|i|r.map{|j|a,b=[f[x+k=s*i/n,y+l=s*j/n,z+s],f[x+k,y+l,z],f[x,y+k,z+l],f[x+l,y,z+k],f[x+s,y+k,z+l],f[x+l,y+s,z+k]].minmax | |
return 8.times{|i|q[x+s*i[0],y+s*i[1],z+s*i[2],s,m/2]}if a*b<0&&s/=2}} | |
end},0,1..j=128 | |
8.times{|i|q[i[0]-z=1.0,i[1]-z,i[2]-z,z,64] | |
$><<v[2*i+64,2]} | |
sleep 1 | |
loop{r,s,m,l,d,w=i.cos(h+=0.02),u[h],i.cos(m=u[2.3*h]/5),u[m],x.map{[7]*j},x.map{[7]*j} | |
p.each{|x,y,z,a,b,e|x,z=x*r+s*z,z*r-s*x | |
y,z=m*y+l*z,m*z-l*y;x,y=64*(x+1),64*(1-y) | |
x<j&&y<j&&z<d[x][y]&&(d[x][y],w[x][y]=z,(8*(1+(a*r+b+e*s)/2)/2).floor)} | |
32.times{|i|4.times{|x|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][(h/2+u[i*i])%1*j+x[1]]=5}} | |
$><<"\e[1;1H"+(0..63).map{|y|x.map{|x|v[w[x-=1][2*y]*8+w[x][2*y+1]]}*''}*$/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
eval %w(p,i,u,f,v,q,h,x=[],Math,->x{i.sin(x)},->x,y,z{x*=1.2;r,a,m=(1-y=y*1.4+0.15)/2+0.1,y+u[3*x+4*y+5*z*=1.2]/12,x*x+z*z;l,s,b=m**0.5,i.atan2(z,x),u[6*a]**2/36+((x*x+z*z)**0.5-r)**2-(1-a*a)/1000;l-=(1-y)/8*d=(u[2*s+3*3*t=1-y-l/2]*u[3*s-3*2*t])**2/(1+i.exp(10*t-14.5));e=4*l/(1+(0.01+(1-a=y-d*(1-y)/8)**2)**0.5-a)*(1-a*a+(0.01+(1-a*a)**2)**0.5)**0.5;(i.atan((1-0.2*i.asin(0.98*u[5*i.atan2(y=3*y-3.4,x*=3)]))*((0.01+x*x+y*y)**0.5-0.1)+4*(0.01+z*z*4)**0.5-1)*i.atan(a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b},%&MMM##TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];-~'ga;,,,.'MerryChristmas!&,->x,y,z,s,m{;if(m==1);g=f[x+=s/2,y+=s/2,z+=s/2];a,b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z]-g,f[x,y,z+d]-g;p<<[x,y,z,a/d=(a*a+b*b+c*c)**0.5,b/d,c/d];else;(r=0...n=[m,4].min).map{|i|r.map{|j|a,b=[f[x+k=s*i/n,y+l=s*j/n,z+s],f[x+k,y+l,z],f[x,y+k,z+l],f[x+l,y,z+k],f[x+s,y+k,z+l],f[x+l,y+s,z+k]].minmax;return(8.times{|i|q[x+s*i[0],y+s*i[1],z+s*i[2],s,m/2]})if(a*b<0&&s/=2)}};end},0,1..j=128;8.times{|i|q[i[0]-z=1.0,i[1]-z,i[2]-z,z,64];$><<v[2*i+64,2]};sleep(1);loop{r,s,m,l,d,w=i.cos(h+=0.02),u[h],i.cos(m=u[2.3*h]/5),u[m],x.map{[7]*j},x.map{[7]*j};p.each{|x,y,z,a,b,e|x,z=x*r+s*z,z*r-s*x;y,z=m*y+l*z,m*z-l*y;x,y=64*(x+1),64*(1-y);x<j&&y<j&&z<d[x][y]&&(d[x][y],w[x][y]=z,(8*(1+(a*r+b+e*s)/2)/2).floor)};32.times{|i|4.times{|x|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][(h/2+u[i*i])%1*j+x[1]]=5}};$><<"\e[1;1H"+(0..63).map{|y|x.map{|x|v[w[x-=1][2*y]*8+w[x][2*y+1]]}*''}*$/})*'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require'zlib';eval Zlib.inflate *%(eJxlVG1v2zYQ/s5fkaWtI52OlCjJroeYBbZ9GVAEWICgwKDxA20rthzJcSU7 | |
kWSrv71HSdlaDBB0d7y3hw95PGCGJ3zEF/yKW6xVovHOHLfIP9XnTFTZ/qru | |
rIENtucalBQhK9FgoRzJG9WAFLEXCDl1/dBKbLxTEkHtxdB4U2j7DO3LEGta | |
bKFlOVa4VAVAIKaYCXM0+9BpsXbxlMzAaIDQj2ae44wJbh/JS5Ihp6YGjOvL | |
IAhYznsQrj+HtXJOSQiVF0EER0WrPPdDDRZLxSMI4ahtAd+RXibS+uDIAI5c | |
xmLquixVMeTW5QQioD81UQ1fw1jdJo4ojAsDhB9CCc+/AcOfOcO+HHIHIgSy | |
iEnK+HVOiKbwtutGRdDwSMREjopc7VL1oa7dewPN2JV4dYnQwUWUQDw6pDvW | |
ciykFFIuuQz6ncQBFBQlA2LSeBQog950XW7LuLDskH2Y3N3dvXv38PBwf//7 | |
578evnw53P/2NP37Ixw2r3H0YqV5LhdwvdmYk/a/XVtxy7/dbMwtIoqbu7Qs | |
mz+2ZVYdC1P9Mnm7K3TIxZllj1eFUpJt1GNSe6ryQ7ofvWh7oZnBJa5671pZ | |
XDZX8w3SCoWufzAoZU0GOywWg4nGp2O3G1/C0lvBaiAFl/4aV/5aszSvUuaU | |
VFeIvUoKjLUosr0rCnM4X7JLOSi7C4FQicXwpCrI/D11zknbkdZ6lcbeZRcJ | |
zojsiTz54Ml7bE+DUf3PR0vW27cuTM3K9Hgq91dzccyKtLI4vto8yJJA22hS | |
pLZ9SQm15ZF46ohJA8tFMJlUvgq7jqX7dYcBSiF2SoZz9lM9W4u3NHoB2mq8 | |
RVuLRIuzWLP3nxaLFxqXzJvFSMVZlafp4Uqy/Pn5cC5tT8xxja8qE6vnytl6 | |
9mxCO6FbjcNaoWjgRARb7U+to9BY93wmHzXsup8MdhCpWW3Pl/Hc6MxT0ltV | |
Q0n7JFhQ8gpqRl56GYhoWiug5Tk0t5SjZnT5a7rEaBU7lKxe7CaTxv7axTqp | |
ddLoycQZNXwdpGrRmYOdBkONljQgFT1T9hOPtNXS7VgU/sdb/KbWl9fEoQcl | |
A4g0vWdbP/Yy7dPU7byaqHU/7HTibOnFszEZ2bL3SK3VlM7G8nv9T5rIW/nn | |
tX0pxCwab11zGYihHi8JweRKajqJRsPc61GT7lGdDm5uOnjvd+w7XhCbnw== | |
).unpack('m') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; | |
;; | |
;;;; | |
;;;;; | |
require( | |
'zlib');;;; | |
;;eval Zlib. | |
inflate *%(eJxl | |
VG1v2zYQ/s5fkaWtI52O | |
lCj JroeYBbZ9GVAEWICgwKDxA2 | |
0rthzJcSU7 kWSrv71HSdlaDBB0d7y3hw95PGCGJ3zE | |
F/yKW6x VovHOHLf IP9XnTFTZ/qrurIENtucalBQhK9F | |
goR zJG9W AFLEX CD l1/dBKbLxTEkHtxdB4U2j7DO3LEGt | |
ab KFl OVa4 VAV AIKaYCXM0+9BpsXbxlMzAaIDQj2ae4 | |
4w Jbh/ JS 5Ihp 6Y GjO vL IAh Yz nsQ rj +H | |
tXJ OS QiV F0 EE R 0WrPP dDDR ZLx SMI4 aht Ad+R Xi | |
b S+ uD I AI5 cx mL qui xVM eT W5 | |
QQ ioD8 1UQ 1fw1 jdJ o4oj As DhB9 CC c+/ | |
Ac OfOc O+H HI HIg SyiE nK +HVO iKb wtu | |
tGRdDwS M REjopc7VL1oa 7d ewPN 2J V4dYn QwUW UQ | |
Dw6pDvWc iyk FFIuuQ z6ncQBFB Ql A2LSeB | |
Qog950XW7LuLDskH2Y3N3dvXv38PBwf//7578evnw53P/2NP 37 Ixw2r3H0Y | |
qV5L hdwvdmYk/a/XVtxy7/dbMwtIoqbu7Qsmz+2ZVYdC1P9Mnm7K 3T IxZllj1eFUpJt1GN | |
S e6ryQ7ofvWh7oZnBJa 5671pZXDZX8w3SCoWufzAoZ U 0GOywWg4nGp2 | |
O3G1/C0lv Ba iAFl/4aV/5aszSvUu aUV FeIvUoKjLUosr0rCnM4X7J LOSi7C 4FQicXwpC | |
rI/ D1 1z knbkdZ6lcbeZRcJz oj siTz54Ml7 bE +DUf3PR0 vW27cuT | |
M3 K9 Hg q9 1dz cc yKtLI 4vto8yJJA 22 hS pL Z 9SQm 15Z | |
F4 6o hJA8t FMJl Uvg q7jq X7 d YcBSiF2S oZz9 lM9W4 u3NHo B2 mq8R V uL | |
RI uzW LP 3 nxa L Fx qXz Jv FSM VZl af p4 Uqy /Pn | |
5c C5t T8 xx ja8q E6 vny tl 69m xC O6 Fb jc Na oWj | |
gRA R b7 U+ t o9 BY93 wm H zXs up 8M dh Cp W W3 Pl/H c6M | |
xT0lt VQ0n 7J FhQ8 gpq Rl56 GYho Wi ug 5T k0 t5S jZ nT5a 7rEaB U7l Kx e7 | |
Ca T xv7axT qpd dL o | |
ycQZNXwdpGrRmYOdBkONljQgFT1T9hOPtNXS7VgU/sdb/KbWl9fE | |
oQclA4g0vWdbP/Yy7dPU7byaqHU/7HTibOnFszEZ2bL3SK3VlM7G8 | |
nv9T5rIW /nntX0pxCwab11zGYihHi8JweRK | |
a jqJRsPc61GT7lGdDm5uO | |
njvd+w7XhCbnw#### | |
############## | |
########). | |
unpack(' | |
m')### | |
#### | |
### | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p,i,u,f,v,q ,h,x=[], | |
Math,->x{i.sin x},->x,y,z{ | |
x*=1.2; r,a,m=(1 -y=y*1.4+0.15)/2+0.1,y+u[3*x+4*y+5*z*=1.2] /12,x* | |
x+z*z; l,s,b= m**0.5,i.atan2(z,x),u[6*a]**2/36+((x*x+z*z)**0.5-r)** | |
2-(1- a* a)/2 /500;l-= (1-y )/8 *d= (u[ 2*s +3*3*t =1-y- | |
l/2]* u[ 3* s-3*2 * t]) **2/( | |
1+i. exp( t *10- 9- 5.5 ));e =4*l /( 1+( 0.01+ | |
(1-a=y-d* ( 1 -y) /8)** 2)**0.5 -a)*(1-a * a+((1- | |
a*a)**2+ 0.01 )** 0.5 )** 0.5 ;(i.atan( (1-0.2*i. asin( | |
0.98* u[+ +5.0 * i. atan2(y= 3*y-3.4,x *=3)] | |
))*( (0.01+x*x+ y*y )** 0.5-0.1) +4*(0.01+z *z*4 | |
)**0.5-1)* i.atan( a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b},%w& MMM## | |
TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];-~'ga;,,,.'MerryChristmas!&*'',->x ,y,z, | |
s,m{if(m== 1);g=f [x+=s/2,y+=s/2,z+=s/2];a, b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z]- g,f[x, | |
y,z+d] -g; p<<[x,y,z,a/d=(a*a+b*b+c *c)**0.5,b/d,c/d];else;(r=0 ...n=[m,4].min).map{|i|r.map{ | |
|j|a, b=[f[ x+k =s*i/n,y+l=s*j/n,z+s],f [x+k,y+l,z],f[ x,y+k,z+l],f[x+l,y,z+k],f[x+s,y+k,z+l],f[x+l,y++s, | |
z+k]]. minmax;return 8. times { | i|q[x + s * i [0],y+s *i[1] ,z+s* | |
i[2], s,m/2]}if a*b <0 && s/= 2 }} ; end}, 0,1 .. j=128 | |
(0..7) .each{|i|q[i[ 0] -z= 1.0,i[1 ]-z ,i[2] -z,z,64] ; $><< v[2 *i+64 ,2]};;; | |
sleep 1;loop{ r,s ,m, l,d, w=i.cos( h+=0.02 ),u[ h],i.cos( m= u[ 2.3 *h ]/5),u [++m], | |
x.map {[7]*j}, x. map {[7] *j};;p. each{| x,y ,z,a,b, e| x, z=x *r +s*z,z *r-s* | |
x;y,z =m*y+ l*z ,m *z -l*y;x, y=64* (x+ 1 ),64 *( 1- y ) ;x<j &&y< | |
j&&z< d[x ][ y]&& (d[x][y] ,w [x][ y]=z ,( 8* (1 +( a*r+b+ | |
e*s)/2) /2).floor)};32.times{|i|4.times{|x|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][(h/2+u[i*i])%1*j+x[1]]=5}};f=[1,1] | |
$><<27.chr+ ?[+f* ';'+?H+(0..63) .map{|y|x.map{|x| v[w[x-=1 ][2*y]*8+w[x][2*y+ 1]]}.join}*$/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p, | |
i=[ | |
],Math | |
u,f,v,q,h, | |
x=->x{i.sin x | |
},->x,y,z{x*=1.2; | |
r,a,m=(1-y=y*1.4+0.15 | |
)/2+0.1,y+u[3*x+4*y+5*z*=1.2]/12 ,x* | |
x+z*z;l,s,b=m**0.5,i.atan2(z,x),u[6*a]**2/36+((x* | |
x+z*z)**0.5-r)**2-(1-a*a)/1000;l-=(1-y)/8*d=(u[2*s+ | |
3*3*t=1-y-l/2]*u[3*s-3*2*t])**2/(1+i.exp(10*t-14.5));e= | |
4*l/(1+(0.01+(1-a=y-d*(1-y)/8)**2)**0.5-a)*(1-a*a+(0.01+(1-a*a)** | |
2)**0.5)**0.5;(i.atan((1-0.2*i.asin(0.98*u[5*i.atan2(y=3*y-3.4, | |
x*=3)]))*((0.01+x*x+y*y)**0.5-0.1)+4*(0.01+z*z*4)**0.5-1)*i. | |
atan(a*a+e*e-1-10/(1+(40*m)**10+((a+1)*10)**10))-0.01)*b}, | |
%w&MMM##TTTQQBKPTVVpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau];- | |
'ga;,,,.'MerryChristmas!&*?~,->(x,y,z,s,m){if m==1;g=f[ | |
x+=s/2,y+=s/2,z+=s/2];a,b,c=f[x+d=0.01,y,z]-g,f[x,y+d,z | |
]-g,f[x,y,z+d]-g;p<<[x,y,z,a/d=(a*a+b*b+c*c)**0.5,b/d,c/ | |
d];else;(r=0...n=[m,4].min).map{|i|r.map{|j|a,b=[f[x+k= | |
s*i/n,y+l=s*j/n,z+s],f[x+k,y+l,z],f[x,y+k,z+l],f[x+l,y,z+ | |
k],f[x+s,y+k,z+l],f[x+l,y+s,z+k]].minmax;return 8.times{| | |
i|q[x+s*i[0],y+s*i[1],z+s*i[2],s,m/2]}if a*b<0&&s/=2}}end | |
},0,1..j=128;8.times{|i|q[i[0]-z=1.0,i[1]-z,i[2]-z,z,64] | |
$><<v[2*i+64,2]};sleep 1;loop{r,s,m,l,d,w=i.cos(h+=0.02 | |
),u[h],i.cos(m=u[2.3*h]/5),u[m],x.map{[7]*j},x.map{[7]*j} | |
p.each{|x,y,z,a,b,e|x,z=x*r+s*z,z*r-s*x;y,z=m*y+l*z,m*z-l*y;x, | |
y=64*(x+1),64*(1-y);x<j&&y<j&&z<d[x][y]&&(d[x][y],w[x | |
][y]=z,(8*(1+(a*r+b+e*s)/2)/2).floor)};32.times{|i| | |
4.times{|x|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][ | |
(h /2+u[i*i])%1*j+x[1]]=5}};$><< | |
"\e[1;1H"+(0..63).map{ | |
|y|x.map{|x|v[## | |
w[x-=1][2*y]* | |
8+w[x][2* | |
y+1]]}* | |
''}* | |
$/} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p,i,u,f,v,q,h,x=[],Math,->x{i.sin(x)},->x,y,z{x*=1.2;r,a,m=0.1+(1-y=y*1.4+0.15)/ | |
2,y+u[3*x+4*y+5*z*=1.2]/12,x*x+z*z;l,s ,b=m**0.5,i.atan2(z,x),u[6*a]**2/36+(( | |
x*x+z*z)**0.5-r)**2-(1-a*a)/1000;l-= (1-y)/8*d=(u[2*s+3*3*t=1-y-l/2]*u[3* | |
s-3*2*t])**2/(1+i.exp(10*t-14.5));e=4 *l/((0.01+(1-a=y-d*(1-y)/8)**2)**0.5- | |
a+1)*+(1-a*a+(0.01+(1-a*a)**2)**0.5) **0.5;(i.atan((1-i.asin(u[5*i.atan2( | |
y=3*y-3.4,x*=3)]*0.98)/5)*((0.01+x*x+y *y)**0.5-0.1)+4*(0.01+z*z*4)**0.5-1)*+ | |
i.atan(a*a+e*e-1-10/(1+(40*m)**10+((a+1 )*10)**10))-0.01)*b},%w&MMM##TTTQQBKPTV | |
VpQAk5Y7*pgw43v7*pgaor<*"ggau]/~"gau ];-~'ga;,,,.'MerryChr&*''+'istmas!', | |
->x,y,z,s,m{;if(m==1);g=f[x+=s/2, y+=s/2,z+=s/2];a,b,c=f[x+d=0.001, | |
y,z]-g,f[x,y+d,z]-g,f[x,y,z+d] -g;p<<[x,y,z,a/d=(+a*a+b*b+c*c | |
)**0.5,b/d,c/d];else;(r=0...n=[m, 4].min).map{|i|r.map{|j|a,b=[f[x+ | |
k=s*i/n,y+l=s*j/n,z+s],f[x+k,y +l,z],f[x,y+k,z+l],f[x+l,y,z+k | |
],f[x+s,y+k,z+l],f[x+l,y+s, z+k]].minmax;return((0..7). | |
each{|i|q[x+s*i[0],y+s*i [1],z+s*i[2],s,m/2]})if( | |
a*b<0&&s/=2)}}end},0,1..j=8 *16;(0..7).map{|i|q[i[0]-z= | |
1.0,i[1]-z,i[2]-z,z,64]; $><<v[2*i+64,2]};sleep(1 | |
);loop{r,s,m,l,d,w=i. cos(h+=2/100.0),u[h], | |
i.cos(m=u[2.3*h]/5),u[m] ,x.map{[7]*j},x.map{[7]* | |
j};p.each{|x,y,z,a,b, e|x,z=x*r+s*z,z*r-s*x | |
y,z=m*y+l*z,m*z-l* y;x,y=64*(x+1),64* | |
(1.0-y);x<j&&y< j&&z<d[x][y]&&( | |
d[x][y],w[x][y]=z,(8*(1+(a*r+b+e*s)/ 2)/2).floor)};32.times{|i|4.times{|x | |
|w[((u[i**3]+u[h/4+i]/4)*j+x[0])%j][ (h/2+u[i*i])%1*j+x[1]]=5}};$><<"\e"+ | |
'[%d;%dH'%[1,1]+(0..63).map{|y|x.map{|x|x-=1;v[w[x][2*y]*8+w[x][2*y+1]]}*''}*$/} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment