Friday, November 12, 2010

Chaos Game

fastgraphics
rx=300:ry=150:x=150:y=0
for sides = 3 to 10
for m = 1 to 10
mult=m/10
for t = 0 to 200
refresh
gosub plotthepoints
next t
clg
next m
next sides
choosevertex:
angle = (360/sides)*int(rand*sides*360)
rad = -3.14159*(angle/180)
y=(sin (rad))*150
x=(cos (rad))*150
return
plotthepoints:
for cicle = 1 to 200
gosub choosevertex
midx= (x-rx)*mult+rx
midy= (y-ry)*mult+ry
plot 150+midx,150+midy
rx=midx
ry=midy
next cicle
return

No comments:

Post a Comment