Draw a regular polygon
LOGO 37 - 25% = 27.75 (with variables)
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
LOGO 49 - 25% = 36.75 (as a function)
TO P:R:S REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]END
Triangle
Called with variables
Make "R 100
Make "S 3
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
Used as a function P 100 3
Square
Called with variables
Make "R 100
Make "S 4
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
Used as a function P 100 4
Pentagon
Called with variables
Make "R 100
Make "S 5
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
Used as a function P 100 5
Decagon
Called with variables
Make "R 100
Make "S 10
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
Used as a function P 100 10
Circle
Called with variables
Make "R 100
Make "S 360
REPEAT:S[FD:R*2*sin(180/:S)RT 360/:S]
Used as a function P 100 360
Mathematica, 40 - 25% = 30
ListPolarPlot[r&~Array~n]/.PointPolygon
Java 8 : 533 322 - 25% = 241.5
Well, it's Java :/ Just draws lines, point to point. Should work for any arbitrarily sized polygon. Cut it down quite a bit from original size. Huge credit to Vulcan (in comments) for the golf lesson.
import java.awt.*;class D{public static void main(String[]v){new Frame(){public void paint(Graphics g){int i=0,r=Short.valueOf(v[0]),s=Short.valueOf(v[1]),o=r+30,x[]=new int[s],y[]=x.clone();for(setSize(o*2,o*2);i<s;x[i]=(int)(Math.cos(6.28*i/s)*r+o),y[i]=(int)(Math.sin(6.28*i++/s)*r+o));g.drawPolygon(x,y,s);}}.show();}}
Line Breaks:
import java.awt.*;
class D{
public static void main(String[]v){
new Frame(){
public void paint(Graphics g){
int i=0,r=Short.valueOf(v[0]),s=Short.valueOf(v[1]),o=r+30,x[]=new int[s],y[]=x.clone();
for(setSize(o*2,o*2);i<s;x[i]=(int)(Math.cos(6.28*i/s)*r+o),y[i]=(int)(Math.sin(6.28*i++/s)*r+o));
g.drawPolygon(x,y,s);
}
}.show();
}
}
Input is arguments [radius] [sides]:
java D 300 7
Output: