Quantcast
Channel: Lined up circle, n points - Code Golf Stack Exchange
Browsing all 24 articles
Browse latest View live

Image may be NSFW.
Clik here to view.

Answer by plannapus for Lined up circle, n points

R, 108 bytesplot(x<-cos(t<-seq(0,2*pi,l=21)),y<-sin(t),as=1);apply(expand.grid(1:21,1:21),1,function(e)lines(x[e],y[e]))Could shave 5 bytes off if I got rid of argument ,as=1 which forces an...

View Article



Image may be NSFW.
Clik here to view.

Answer by user62131 for Lined up circle, n points

Bash + Jelly + GraphViz, 52 characters, 52 or 63 bytesGiven that the programs in question disagree on which character encoding to use, the program is full of control characters. Here's what it looks...

View Article

Image may be NSFW.
Clik here to view.

Answer by wyldstallyns for Lined up circle, n points

NetLogo - 44 bytescro 20[create-links-to other turtles fd 20]

View Article

Answer by Neil for Lined up circle, n points

JavaScript (ES5)/SVG (HTML5), 181 bytesdocument.write('<svg viewBox=-1e3,-1e3,2e3,2e3><path stroke=#000 fill=none...

View Article

Image may be NSFW.
Clik here to view.

Answer by Frédéric for Lined up circle, n points

R, 127 123 bytesplot((e=cbind(sin(t<-seq(0,2*pi,l=(n=21)))*2,cos(t)*2)));for(i in 2:n)for(j in 1:i)lines(c(e[i,1],e[j,1]),c(e[i,2],e[j,2]))Produces :Nice axis' labels uh ?-4 bytes thanks to @Titus !

View Article


Image may be NSFW.
Clik here to view.

Answer by user41805 for Lined up circle, n points

Processing, 274 bytes (239 +size call and function call)void d(int s){float a=2*PI/s,x=0,y=-400,m,n;float[][]p=new float[2][s];translate(400,400);for(int...

View Article

Image may be NSFW.
Clik here to view.

Answer by Luis Mendo for Lined up circle, n points

MATLAB, 36 bytes@(n)plot(graph(ones(n),'Om'),'La','c')This is an anoymous function that creates the plot.@(n) Define an anonymous fuction of 𝘯 ones(n) Create an 𝘯×𝘯 matrix of ones graph( ,'Om') Create...

View Article

Image may be NSFW.
Clik here to view.

Answer by Mario for Lined up circle, n points

PHP + HTML SVG, 316 263 bytesGolfed version with hardcoded n points and no input n parameter:<svg height="610"...

View Article


Image may be NSFW.
Clik here to view.

Answer by Tyler MacDonell for Lined up circle, n points

PICO-8, 131 bytesI wasn't really sure if I'd be breaking any rules, but I did it anyway!Golfedp={}for i=0,19 do add(p,{64+64*cos(i/20),64+64*sin(i/20)})end for x in all(p)do for y in all(p)do...

View Article


Image may be NSFW.
Clik here to view.

Answer by TheBikingViking for Lined up circle, n points

GeoGebra, 92 bytesa=polygon((0,0),(1,0),20)sequence(sequence(segment(vertex(a,i),vertex(a,j)),j,1,20),i,1,20)Each line is separately entered into the input bar. Here is a gif showing the execution:How...

View Article

Image may be NSFW.
Clik here to view.

Answer by Titus for Lined up circle, n points

PHP, 186184 196...

View Article

Image may be NSFW.
Clik here to view.

Answer by Dada for Lined up circle, n points

Perl, 229 bytesIt uses the same formula as most languages that don't have convenient builtin for this challenge (even if I didn't look at them to find it, but that's a fairly easy to find formula). So...

View Article

Image may be NSFW.
Clik here to view.

Answer by flawr for Lined up circle, n points

MATL, 16 14 bytesAs I'm not terribly fluent with MATL I expect that this is somewhat more golfable. (Would be nice to at least beat Mathematica :-) I.e. the the flip w is not optimal, it could probably...

View Article


Image may be NSFW.
Clik here to view.

Answer by steenbergh for Lined up circle, n points

QBIC, 98 94 bytes$SCREEN 11|:i=6.3/a j=230[0,a|[b,a|line(cos(b*i)*j+j,sin(b*i)*j+j)-(cos(c*i)*j+j,sin(c*o)*j+j)I've converted my original QBasic answer @LevelRiverSt 's answer to QBIC. I thought this...

View Article

Image may be NSFW.
Clik here to view.

Answer by Level River St for Lined up circle, n points

BBC BASIC, 98 ascii charactersTokenised filesize 86 bytesr=600V.5142;29,r;r;:I.n:t=2*PI/n:F.i=1TOn*n:a=i DIVn*t:b=i MODn*t:L.r*SINa,r*COSa,r*SINb,r*COSb:N.Dowload interpreter at...

View Article


Image may be NSFW.
Clik here to view.

Answer by flawr for Lined up circle, n points

Octave, 50 48 46 45 bytes@(N)gplot((k=0:2*pi/N:N)+k',[cos(k);sin(k)]')This is an anyonmous function that plots the graph we're looking for.Explanation:(k=0:2*pi/N:N)+k' Makes a full N+1 x N+1 adjecency...

View Article

Answer by darrylyeo for Lined up circle, n points

HTML + JS (ES6), 34 +177164 162 = 196 bytesUsing the HTML5 Canvas API.See it on...

View Article


Image may be NSFW.
Clik here to view.

Answer by steenbergh for Lined up circle, n points

QBasic 4.5, 398 271 bytesCLS:SCREEN 11:DEFSTR M-Z:DEFDBL A-LINPUT"N",A:I=(360/A)*.0175:J=230Q=",":FOR E=0 TO AFOR F=E TO...

View Article

Image may be NSFW.
Clik here to view.

Answer by Alecto Irene Perez for Lined up circle, n points

Mathematica, 42 bytesCreates a set of 37 points arranged in a circle, and then draws lines between all possible subsets of two points. Someone posted a shorter answer that takes advantage of...

View Article

Image may be NSFW.
Clik here to view.

Answer by Stewie Griffin for Lined up circle, n points

Octave, 88 69 bytesN=input('');t=0:2*pi/N:N;k=nchoosek(1:N,2)';line(cos(t)(k),sin(t)(k))Output for N=37:Output for N=19:

View Article
Browsing all 24 articles
Browse latest View live




Latest Images