Google Groups Home
Help | Sign in
Spirograph help please. (Code incl.)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Geeza  
View profile
 More options Apr 4, 7:17 am
Newsgroups: alt.lang.basic.compiler
From: "Geeza" <a...@mouse.com>
Date: Fri, 4 Apr 2008 12:17:44 +0100
Local: Fri, Apr 4 2008 7:17 am
Subject: Spirograph help please. (Code incl.)
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/  =-


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google