Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.96 KB | None | 0 0
  1. -200:200 0:200!PYyq10/k12-t8<*t0>*Q7B.561FTh.295Oh.51h4BPFTF6Bl.5hOh4B8$v255*k5M/YG
  2.  
  3. % STEP 1: CREATE MATRIX DEFINING THE RAINBOW BANDS
  4. -200:200 % row vector [-200, -199, ..., 200]
  5. 0:200 % row vector [0, 1, ..., 200]
  6. !P % transpose and flip: convert into column vector [200; 199; ...; 0]
  7. Yy % hypotenuse function with broadcast: distance from each point to (0,0)
  8. q10/k % subtract 1, divide by 10, floor (round down). Gives 20 circular bands
  9. % 10 pixels wide, with values from 0 to 19
  10. 12- % subtract 12
  11. t8<* % values larger than 7 are set to 0
  12. t0>* % values less than 0 are set to 0. We now have 7 bands with values
  13. % 1, ..., 7, and the white background with value 0
  14. Q % add 1: white becomes 1, bands become 2, ..., 8
  15.  
  16. % STEP 2: CREATE MATRIX DEFINING THE COLORMAP
  17. 7B % first row: [1 1 1] (7 converted to binary: color white)
  18. .561FTh % second row (light purple)
  19. .295Oh.51h % third row (dark purple)
  20. 4BP % fourth row: [0 0 1] (4 converted to binary and flipped: blue)
  21. FTF % fifth row (green)
  22. 6B % sixth row: [1 1 0] (6 converted to binary: yellow)
  23. l.5hOh % seventh row: orange
  24. 4B % eigth row: [1 0 0] (4 converted to binary: red)
  25. 8$v % vertically concatenate the 8 eight rows
  26. 255*k % multiply by 255 and round down. Gives exact color values
  27. 5M/ % push 255 again and divide. This is needed because colors in MATL are
  28. % defined between 0 and 1, not between 0 and 255
  29.  
  30. % STEP 3: DISPLAY
  31. YG % display image with that colormap
  32.  
  33. <svg viewBox='0 0 400 200'><circle cx='200' cy='200' r='200' fill='red'/><circle cx='200' cy='200' r='190' fill='#ff7f00'/><circle cx='200' cy='200' r='180' fill='yellow'/><circle cx='200' cy='200' r='170' fill='lime'/><circle cx='200' cy='200' r='160' fill='blue'/><circle cx='200' cy='200' r='150' fill='indigo'/><circle cx='200' cy='200' r='140' fill='#8f00ff'/><circle cx='200' cy='200' r='130' fill='white'/></svg>
  34.  
  35. "<svg viewBox=0,0,400,200>"V8s["<circle cx=200 cy=200 r="-200*TN" fill="@c"red #ff7f00 #ff0 #0f0 #00f indigo #8f00ff #fff"dN" />
  36.  
  37. <svg viewBox=0,0,400,200>
  38. <circle cx=200 cy=200 r=200 fill=red />
  39. <circle cx=200 cy=200 r=190 fill=#ff7f00 />
  40. <circle cx=200 cy=200 r=180 fill=#ff0 />
  41. <circle cx=200 cy=200 r=170 fill=#0f0 />
  42. <circle cx=200 cy=200 r=160 fill=#00f />
  43. <circle cx=200 cy=200 r=150 fill=indigo />
  44. <circle cx=200 cy=200 r=140 fill=#8f00ff />
  45. <circle cx=200 cy=200 r=130 fill=#fff />
  46.  
  47. Graphics@MapIndexed[{#,Disk[{0,0},4-#/5&@@#2,{Pi,0}]}&,RGBColor/@TextWords@"#f00 #ff7f00 #ff0 #0f0 #00f #4b0082 #8f00ff #fff"]
  48.  
  49. i<svg viewBox=0,0,400,200><cr><circle cx=2<C-n> cy=2<C-n> r=2<C-n> fill=red<cr>#ff7f00<cr>#ff0<cr>#0f0<cr>#00f<cr>indigo<cr>#8f00ff<cr>#fff<esc>2Gqq0y4f=jPBB10<C-x>@qq@qV2G:norm A /><cr>
  50.  
  51. summon FallingSand ~ ~1 ~ {Block:log,Time:1,Passengers:[{id:FallingSand,Block:redstone_block,Time:1,Passengers:[{id:FallingSand,Block:activator_rail,Time:1,Passengers:[{id:MinecartCommandBlock,Command:"summon ArmorStand ~ ~ ~ {Tags:["b"]}"},{id:MinecartCommandBlock,Command:"summon Pig ~ ~ ~ {NoAI:1b}"},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14"}},{id:MinecartCommandBlock,Command:setblock ~-1 ~-2 ~4 chain_command_block 3 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~4 chain_command_block 4 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~5 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~6 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~7 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10"}},{id:MinecartCommandBlock,Command:setblock ~ ~-2 ~8 chain_command_block 2 replace {auto:1,Command:"execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~8 chain_command_block 4 replace {auto:1,Command:"tp @e[type=Cow] ~1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~7 chain_command_block 3 replace {auto:1,Command:"tp @e[type=Bat] ~-1 ~ ~"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~6 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~5 chain_command_block 3 replace {auto:1,Command:"execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}"}},{id:MinecartCommandBlock,Command:setblock ~1 ~-2 ~4 repeating_command_block 3 replace {auto:1,Command:"tp @e[type=Pig] ~ ~1 ~"}},{id:MinecartCommandBlock,Command:setblock ~ ~ ~1 command_block 0 replace {Command:fill ~ ~-3 ~-1 ~ ~ ~ air}},{id:MinecartCommandBlock,Command:setblock ~ ~-1 ~1 redstone_block},{id:MinecartCommandBlock,Command:kill @e[type=MinecartCommandBlock,r=1]}]}]}]}
  52.  
  53. INIT:summon ArmorStand ~ ~ ~ {Tags:["b"]}
  54. INIT:summon Pig ~ ~ ~ {NoAI:1b}
  55. tp @e[type=Pig] ~ ~1 ~
  56. execute @e[type=Pig] ~ ~ ~ summon Cow ~ ~ ~ {NoAI:1b}
  57. execute @e[type=Pig] ~ ~ ~ summon Bat ~ ~ ~ {NoAI:1b}
  58. tp @e[type=Bat] ~-1 ~ ~
  59. tp @e[type=Cow] ~1 ~ ~
  60. execute @e[tag=b] ~ ~ ~ execute @e[rm=130,r=140] ~ ~ ~ setblock ~ ~ ~ wool 2
  61. execute @e[tag=b] ~ ~ ~ execute @e[rm=140,r=150] ~ ~ ~ setblock ~ ~ ~ wool 10
  62. execute @e[tag=b] ~ ~ ~ execute @e[rm=150,r=160] ~ ~ ~ setblock ~ ~ ~ wool 11
  63. execute @e[tag=b] ~ ~ ~ execute @e[rm=160,r=170] ~ ~ ~ setblock ~ ~ ~ wool 13
  64. execute @e[tag=b] ~ ~ ~ execute @e[rm=170,r=180] ~ ~ ~ setblock ~ ~ ~ wool 4
  65. execute @e[tag=b] ~ ~ ~ execute @e[rm=180,r=190] ~ ~ ~ setblock ~ ~ ~ wool 1
  66. execute @e[tag=b] ~ ~ ~ execute @e[rm=190,r=200] ~ ~ ~ setblock ~ ~ ~ wool 14
  67. execute @e[tag=b] ~ ~ ~ execute @e[rm=200] ~ ~ ~ tp @e[c=1] ~ -99 ~
  68.  
  69. document.write`<svg width=400 height=200>${`f00
  70. ff7f00
  71. ff0
  72. 0f0
  73. 00f
  74. 4b0082
  75. 8f00ff
  76. fff`.replace(/.+/g,c=>`<circle cx=200 cy=200 r=${i--}0 fill=#${c} />`,i=20)}`
  77.  
  78. `[...].map((c,i)=>...)`
  79.  
  80. `...`.replace(/.+/g,c=>...,i=20)
  81.  
  82. public void r() throws IOException{BufferedImage i=new BufferedImage(400,200,2);Graphics2D g=i.createGraphics();g.setStroke(new BasicStroke(10));int[]c={0xFF0000,0xFF7F00,0xFFFF00,0xFF00,255,0x4B0082,0x8F00FF};for(int v=0;v<7;v ++){g.setColor(new Color(c[v]));g.drawArc(v*10+5,v*10+5,390-v*20,390-v*20,0,360);}ImageIO.write(i,"PNG",new File("a.png"));}}
  83.  
  84. public void ungolfed() throws IOException {
  85. BufferedImage i = new BufferedImage(400, 200, 2); // 2 is TYPE_INT_ARGB
  86. Graphics2D g = i.createGraphics();
  87. g.setStroke(new BasicStroke(10));
  88. int[] c = {0xFF0000, 0xFF7F00, 0xFFFF00, 0x00FF00, 0x0000FF, 0x4B0082, 0x8F00FF};
  89. for(int v = 0; v < 7; v ++) {
  90. g.setColor(new Color(c[v]));
  91. g.drawArc(v * 10 + 5, v * 10 + 5, 390 - v * 20, 390 - v * 20, 0, 360);
  92. }
  93. ImageIO.write(i, "PNG", new File("a.png"));
  94. }
  95.  
  96. 1 p,k=20,x1=0,x2=400,y=200
  97. 2 FOR EACH s IN [16711680,16744192,16776960,65280,255,4915330,9371903]: PALETTE p,s: INC p: NEXT s
  98. 3 CLS 15: DRAW 0,200 TO 70,200: DRAW 330,200 TO 400,200
  99. 4 FOR i=1 TO 7
  100. 5 INK k: DRAW x1,y TO x2,y,-PI: DRAW x1+10,y TO x2-10,y,-PI: FILL x1+5,190
  101. 6 x1+=10,x2-=10,k+=1
  102. 7 NEXT i
  103.  
  104. canvas .c -bg #FFF -bo 0 -highlightt 0;pack .c -e 1 -f both;wm ge . 400x200;foreach {r c} {200 #FF0000 190 #FF7F00 180 #FFFF00 170 #00FF00 160 #0000FF 150 #4B0082 140 #8F00FF 130 #FFF} {.c cr o -$r -$r $r $r -outline $c -f $c};after 100 {.c x s -5 u;.c y s -10 u}
  105.  
  106. canvas .c -bg #FFF -borderwidth 0 -highlightthickness 0
  107. pack .c -expand yes -fill both
  108. wm geometry . 400x200
  109. foreach {r c} {
  110. 200 #FF0000
  111. 190 #FF7F00
  112. 180 #FFFF00
  113. 170 #00FF00
  114. 160 #0000FF
  115. 150 #4B0082
  116. 140 #8F00FF
  117. 130 #FFFFFF
  118. } {
  119. .c create arc -$r -$r $r $r -extent 180 -outline $c -fill $c
  120. }
  121. after 100 {
  122. .c xview scroll -5 units
  123. .c yview scroll -10 units
  124. }
  125.  
  126. body{width:400px;height:200px;background-image:radial-gradient(500px at bottom,#FFF 26%,#8F00FF 26%,#8F00FF 28%,#4B0082 28%,#4B0082 30%,#00F 30%,#00F 32%,#0F0 32%,#0F0 34%,#FF0 34%,#FF0 36%,#FF7F00 36%,#FF7F00 38%,red 38%,red 40%,#FFF 40%)}
  127.  
  128. #define X printf("%c",s<169|s/401?y:s
  129. i=8e4,t,y=255;main(s){for(puts("P6 400 200 255");i--;X/288?y:s<195?143:s<225?75:0),X<256|s/360?0:s/323?127:y),X<225&s/195?130:s<256?y:0))s=i/400,t=i%400-200,s=(s*s+t*t)/100;}
  130.  
  131. documentclass{proc}input tikzbegin{document}defz#1!#2!#3!#4!{definecolor{t}{rgb}{#1,#2,#3}fill[color=t](200pt,0)circle(#4pt);}tikz{clip(0,0)rectangle(400pt,200pt);z1!0!0!200!z1!.5!0!190!z1!1!0!180!z0!1!0!170!z0!0!1!160!z.29!0!.51!150!z.56!0!1!140!z1!1!1!130!}end{document}
  132.  
  133. documentclass{proc}
  134. input tikz
  135. begin{document}
  136.  
  137. %Define macro "z" with 4 arguments.
  138. % The first 3 arguments are rgb values for the color
  139. % Last argument is the radius in pt that we draw a full circle with
  140.  
  141. defz#1!#2!#3!#4!
  142. {definecolor{t}{rgb}{#1,#2,#3}
  143. fill[color=t](200pt,0)circle(#4pt);}
  144.  
  145. % Start a Tikz figure
  146.  
  147. tikz{
  148.  
  149. % We only draw the top half of the circle
  150.  
  151. clip(0,0)rectangle(400pt,200pt);
  152.  
  153. % Draw each circle from biggest to smallest
  154.  
  155. z1!0!0!200!
  156. z1!.5!0!190!
  157. z1!1!0!180!
  158. z0!1!0!170!
  159. z0!0!1!160!
  160. z.29!0!.51!150!
  161. z.56!0!1!140!
  162.  
  163. % Draw a white circle last
  164.  
  165. z1!1!1!130!
  166. }
  167. end{document}
  168.  
  169. <?php $a=imagecreate(400,200);define("b",255);$c=array(b,b,b,b,0,0,b,127,0,b,b,0,0,b,0,0,0,b,75,0,130,143,0,b,b,b,b);for($i=0;$i<9;$i++){imagefilledellipse($a,200,200,420-$i*20,420-$i*20,imagecolorallocate($a,$c[$i*3],$c[$i*3+1],$c[$i*3+2]));}header("Content-type:png");imagepng($a);?>
  170.  
  171. 00000000: b329 2e4b 5728 cb4c 2d77 caaf b035 d031 .).KW(.L-w...5.1
  172. 00000010: d031 3130 d031 3230 b0e3 b249 ce2c 4ace .110.120...I.,J.
  173. 00000020: 4955 48ae b005 f215 922b c154 1198 4ccb IUH......+.T..L.
  174. 00000030: ccc9 b12d 4a4d 51d0 c7ad ced0 12aa 4e39 ...-JMQ.......N9
  175. 00000040: 2dcd 3c0d 2884 4fad 0542 2d7e 85e6 3085 -.<.(.O..B-~..0.
  176. 00000050: 0604 149a c115 1aa4 e155 680a 5598 9997 .........Uh.U...
  177. 00000060: 9299 9e8f 57a9 09cc 4c0b a07f d2f0 1b6b ....W...L......k
  178. 00000070: 8cf0 1148 2100 0a ...H!..
  179.  
  180. png(,400,200)
  181. par(mar=0*1:4)
  182. plot(as.raster(outer(199:0,-199.5:200,function(y,x)c(rep("white",13),"#8F00FF","#4B0082",4,"green",7,"#FF7F00",2)[1+(x^2+y^2)^.5%%200/10])))
  183.  
  184. perl -MSVG -E '$z=SVG->new(width=>4e2,height=>2e2);@x=qw/#fff #8f00ff indigo #00f #0f0 #ff0 #ff7f00 red/;$z->circle(cx=>200,cy=>200,r=>200-10*$a++,style=>{fill=>pop@x})for 1..8;say$z->xmlify'
  185.  
  186. imagefill($a=imagecreatetruecolor($r=400,200),0,0,$w=0xffffff);foreach([255<<16,0xff7f00,$w-255,65280,255,4915330,9371903,$w]as$i)imagefilledellipse($a,200,200,$r,20+$r-=20,$i);imagepng($a);
  187.  
  188. php -r 'imagefill($a=imagecreatetruecolor($r=400,200),0,0,$w=0xffffff);foreach([255<<16,0xff7f00,$w-255,65280,255,4915330,9371903,$w]as$i)imagefilledellipse($a,200,200,$r,20+$r-=20,$i);imagepng($a);' | display
  189.  
  190. php -r '$r=410;imagesetthickness($a=imagecreatetruecolor(400,200),10);foreach([255<<16,0xff7f00,0xffff00,65280,255,4915330,9371903]as$i)imagearc($a,200,200,$r-=20,$r,1,0,$i);imagepng($a);' | display
  191.  
  192. php -d error_reporting=30709 -r '$a=imagecreatetruecolor($r=400,200);foreach([255<<16,0xff7f00,0xffff00,65280,255,4915330,9371903]as$i)for(;++$$i<21;)imageellipse($a,200,200,$r,$r--,$i);imagepng($a);' | display
  193.  
  194. 00000000: 3188 0131 2030 2e35 3631 8800 3120 302e 1..1 0.561..1 0.
  195. 00000010: 3237 3888 0030 2e35 3188 0030 8801 3088 278..0.51..0..0.
  196. 00000020: 0130 8801 3188 0031 2030 2e35 8800 3188 .0..1..1 0.5..1.
  197. 00000030: 0030 87c8 0038 7b34 2031 9287 929d 87c8 .0...8{4 1......
  198. 00000040: 0030 2032 9258 3087 b400 9205 9216 9242 .0 2.X0........B
  199. 00000050: 880a 92a9 7d92 83 ....}..
  200.  
  201. int d=400;size(d,d/2);background(-1);noStroke();int[] c={#ff0000,#ff7f00,#ffff00,#00ff00,#0000ff,#4b0082,#8f00ff,-1};for(int i=0;i<8;i++){fill(c[i]);ellipse(200,200,d,d);d-=20;}
  202.  
  203. PROGRAM r;
  204. local
  205. c[]=22,26,235,41,54,82,249,15,15;
  206. BEGIN
  207. set_mode(400200);
  208. for(x=-80;x<80;x+=10)
  209. y=399-x;
  210. draw(5,c[abs(x)/10],15,0,x,x,y,y);
  211. x+=70*(x<0);END
  212. LOOP;FRAME;END
  213. END
  214.  
  215. PROGRAM r;
  216.  
  217. local
  218. c[]=22,26,235,41,54,82,249,15,15;
  219.  
  220. BEGIN
  221.  
  222. set_mode(400200);
  223.  
  224. for(x=-80;x<80;x+=10)
  225.  
  226. y=399-x;
  227.  
  228. draw(5,c[abs(x)/10],15,0,x,x,y,y);
  229.  
  230. x+=70*(x<0);
  231.  
  232. END
  233.  
  234. LOOP;FRAME;END
  235.  
  236. END
  237.  
  238. : ^ 2 ** ;
  239. : b 0.9 * dup x .5 - ^ y 2.01 / ^
  240. + sqrt dup rot > swap rot .045
  241. + < * * + ;
  242. 0 .56 .2 b .29 .25 b 1 .4 b
  243. 1 .45 b 1 .5 b 0 1 .35 b 1 .4 b
  244. 0.5 .45 b 0 1 .2 b .51 .25 b
  245. 1 .3 b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement