Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Spirograph help please. (Code incl.)

1 view
Skip to first unread message

Geeza

unread,
Apr 4, 2008, 7:17:44 AM4/4/08
to
screen 20,8
Const PI = 3.14159265
dim a as string
dim x as integer
dim y as integer
dim t as integer
dim xx as integer
dim yy as integer
dim fixed as integer
dim moving as integer
dim offset as integer

start:
randomize timer
fixed=int(rnd*200)+1
moving=int(rnd*200)-200
offset=int(rnd*200)+1

for t=1 to 1800000

x = (fixed+moving)*cos(t*(pi/180)) - (moving+offset)*cos(((fixed+moving)/moving)*t*(pi/180))
y = (fixed+moving)*sin(t*(pi/180)) - (moving+offset)*sin(((fixed+moving)/moving)*t*(pi/180))

if t=1 then
line (x+500,y+400)-(x+500,y+400),6
endif

line -(x+500,y+400),6

locate 1,1
print t
a = inkey
if a = "q" then end 0

next t
sleep

Right, basically that just draws a single random generated Spirograph. You may have noticed i'm using a massive loop to make sure it completes the cycle. Thing is, I know the length to complete the cycle can be calculated, but I just don't know where to start.

Any help would be appreciated, thanks. :)


--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-

0 new messages