# Tag Info

0

Haskell + hip, 256 bytes import Graphics.Image (d?s)w@(x,y)|k<-div s$2^d,k>0,(y,x)<-(d+1)?s$(y,x)=(mod(x+(-1)^(mod(div y k)2+d)*div k 2)s,y)|1>0=w q::Image VS YCbCr Word8->IO() q i=writeImageExact JPG[]"o"\$backpermute(dims i)(2?rows i)i main=readImageExact JPG"i">>=either print q I lose a lot of bytes in this answer ...

0

Java 8, 367 bytes import java.awt.*;v->new Frame(){{add(new Panel(){public void paint(Graphics g){g.drawPolygon(new int[]{185,340,170,140,440,255},new int[]{0,280,280,335,335,0},6);g.fillPolygon(new int[]{440,140,225,190,35,410},new int[]{335,335,185,120,400,400},6);g.setColor(Color.GRAY);g.fillPolygon(new int[]{35,190,275,340,185,0},new int[]{400,120,...

1

Mathematica (Wolfram Language) 76 bytes After Mathematica 11.1, there is a HilbertCurve function, but i don't want to use it Region@Line@ReIm@Nest[Join[w=I Conjugate@#-1-I,t=#+I-1,t+2,-2I-w]/2&,{0},#]&

3

Javascript (Browser) I recommend opening a blank page (about:blank), then pasting this into the console. It clears the page and creates its own canvas to draw on. You can watch it drawing live, which takes around 30 seconds on my chromebook. (async function() { var canvas = document.createElement("canvas"); canvas.width = 256; canvas....

0

JavaScript + HTML, 248 bytes 235 bytes for JavaScript + 13 bytes for HTML ( // code start n=>{with(c.getContext('2d'))['#4285f4','#34a853','#fbbc05','#ea4335'].map((c,i)=>{beginPath(fillStyle=strokeStyle=c,lineWidth=n/5,a=Math.PI/2);arc(h=n/2,h,r=n*.4,j=i*a-a/2,j+a);stroke();if(!i){clearRect(0,0,n,r);fillRect(h,r,r,n/5)}})} // code end )(100); <...

1

R, 40 bytes image(matrix(1:0,9,9)[-1,-1],c=1:0,ax=F) This nicely exploits R's argument-recycling to fill a matrix() with dimensions of 9,9 with values of 1:0 recycled to fill it. We then use negative indexing [-1,-1] to chop-off the first row & column. The image() function converts a matrix directly into a coloured image. Here we specify the color as ...

1

APL (Dyalog Extended), 51 bytes 'P1' 2⍴400 (50×50/⍳8)⌽(400 400⍴((50⍴'0'),(50⍴'1'))) Outputs a netpbm image. Save the result to a .pbm file and view here. Since the output is too large for tio, here's the generated output. Here's the output converted to png: Try it online!

0

R, 100 bytes function(n,p,P=p*n*1.08){bmp(,P,P) par(mar=!1:4) plot.new() segments((1:n-1)/n,1,0,1:n/n) dev.off()} Saves output to bitmap file 'Rplot001.bmp'. There are some 'wasted' pixels at the top & on the left (so the curve is in the top left corner but not touching the edge). This seems to be within the spec, but could be removed for +13 bytes. ...

2

Java 8, 143 bytes import java.awt.*;n->p->new Frame(){{add(new Panel(){public void paint(Graphics g){for(int m=0;m<n;)g.drawLine(0,m*p,n*p-++m*p,0);}});show();}} Output for $n=25, p=15$: Output for $n=5, p=50$: Explanation: import java.awt.*; // Required import for almost everything n->p-> // Method ...

3

Basic 7.0, Commodore 128, 60 58 bytes 0inputn,p:gR1:s=n*p:do:dR1,s,0to0,n:s=s-p:n=n+p:loOwHs>=0 Watch a video of it running: Unfortunately, INPUT command hasn't an abbreviation :(

3

Java + Processing, 95 bytes noStroke();arc(r,r,r,r,0,PI/3);arc(r+r/2,r,r,r,2*PI/3,PI);arc(r+r/4,r+r/2.3,r,r,4*PI/3,5*PI/3); Takes input as variable r, outputs a Reuleaux triangle at $(r,r)$, given an adequately sized canvas. Code As a function with size call, 124 bytes void a(int r){size(r*2,r*2);noStroke();arc(r,r,r,r,0,PI/3);arc(r+r/2,r,r,r,2*PI/3,PI);...

1

Java 8, 512 bytes import java.awt.*;n->new Frame(){{add(new Panel(){public void paint(Graphics g){for(int N=n,o=0,p=1,t,q,u;N-->0;o+=8*p,p*=2)for(t=(int)Math.pow(2,N);t-->0;g.setColor(new Color(116,196,96)),g.fillRect(o,q=u*t,u,u),g.setColor(new Color(110,170,90)),g.fillRect(p+o,p+q,6*p,6*p),g.fillRect(o,4*p+q,p,p),g.fillRect(3*p+o,q,p,p),g....

2

APL (dzaima/APL), 28 bytes {P5.G.ln↓⍉↑(⍵×⍳⍺)⍬⍬(⍵×⍺-⍳⍺)} Anonymous function which takes n and p as left and right arguments, and displays the pattern, given an adequately sized canvas. Full Program here. Made with a lot of advice and golfing from dzaima. Test Cases 25, 15 20, 20 6,72 Java + Processing, 62 bytes The original function I made for this ...

0

APL (dzaima/APL), 50 - 12.5 = 37.5 37 - 9.25 = 27.75 bytes P5.draw←{P5.G.ln ↑r+r×2 1○ᑈs÷⍨2×○0…s} Shortened heavily with the help of The APL Orchard. Explanation: P5.draw←{P5.G.ln ↑r+r×2 1○ᑈs÷⍨2×○0…s} P5.draw←{ } Draw the following on the canvas every frame: P5.G.ln Draw a line using array(x1,y1,x2,y2....

4

Mathematica, 122 characters Graphics[Polygon/@ReIm@NestList[Join@@({##3}+Cos[t=Random[]Pi/2]E^(I t){I Tan@t(#2-{##}),{##}-#}&)@@@#&,{{0,1,1+I,I}},#]]& Ungolfed version: Clear["`*"]; next=Compile[{{z,_Complex,1},t},{z[]-E^(I t) (z[]-z) Cos[t],z[]+I E^(I t) (z[]-z) Sin[t]},RuntimeAttributes->{Listable}]; n=15; list=ReIm@...

1

APL (dzaima/APL), 186 161 bytes Uses dzaima's Processing integration. G←P5.G P5.draw←{p←G.pt G.stroke←'00f' p 3 3 G.stroke←'0ff' p 2 3 3 2 G.stroke←'f0f' p 1 3 3 1 G.stroke←'0f0' p 2 2 G.stroke←'ff0' p 1 2 2 1 G.stroke←'f00' p 1 1} -25 bytes after applying some of dzaima's suggestions and 3 character color codes. Grid (Heavily Magnified): Actual size:

2

Wolfram Language (Mathematica), 96 90 84bytes Region@Polygon@ReIm@Nest[Join[Tr/@Tuples@{.62p,t=.39#},-t]&,{p=(-1)^(.4Range@5)},#]&

0

Java 10, 690 bytes import java.awt.*;v->new Frame(){{add(new Panel(){RenderingHints R;Math M;public void paint(Graphics g){Graphics2D G=(Graphics2D)g;G.setRenderingHint(R.KEY_ANTIALIASING,R.VALUE_ANTIALIAS_ON);var v=new Font("Hei",0,8).createGlyphVector(G.getFontRenderContext(),"ICATION MEANS FASTER CODING MEANS FEWER CODERS MEANS EASIER ...

1

Funky2, 156 Bytes, Non-competeing I=draw.newImageData(arg[1)C=[]j=i=0I.mapPixels((x,y,r)=>C[i++]=r)C=C:sort((a,b)=>(a.r*256+a.g+a.b/256)-(b.r*256+b.g+b.b/256))I.mapPixels(@C[j++)I.export"o" Non-Competing due to the fact that several features were implemented in response to this challenge, including image exporting and list sorting. Also ...

2

Desmos, 50 49 bytes \sum_{n=1}^c \sqrt{(x-a[n].x)^2+(y-a[n].y)^2}<=t -1 byte from finding a new quirk in Desmos' syntax while working on another problem. View it online It just kinda... works. Input n in the variable c, t in the variable t, and the points as an array a of coordinates. Lips example: Guitar pick example: Note: If you try to copy the ...

Top 50 recent answers are included