Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Spirographs
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
jamez




PostPosted: Sun Nov 30, 2003 8:59 pm   Post subject: Spirographs

Very Happy

code:
View.Set ("nocursor,nobuttonbar,title:Spirograph")

var R : real := Rand.Int (20, 35)
var r : real := Rand.Int (20, 35)
var O : real := Rand.Int (5, 10)
var T : real := Rand.Int (100, 400)
var x, y, oldx, oldy : real := 0
var g : string (1)

loop
    put "1. Random\n2. Specify"
    getch (g)
    exit when g = '1' or g = '2'
end loop
if g = '2' then
    put "R [Fixed circle radius]: " ..
    get R
    put "r [Moving circle radius]: " ..
    get r
    put "O [Offset of the moving circle]: " ..
    get O
    put "T [# of circles]: " ..
    get T
end if
cls

put "\nR: ", R ..
put "\nr: ", r ..
put "\nO: ", O ..
put "\nT: ", T ..

for t : 1 .. round (T)
    oldx := x
    oldy := y
    x := (R + r) * cos (t) - (r + O) * cos (((R + r) / r) * t)
    y := (R + r) * sin (t) - (r + O) * sin (((R + r) / r) * t)

    if t > 1 then
        drawline (round (x) + maxx div 2, round (y) + maxy div 2, round (oldx) + maxx div 2, round (oldy) + maxy div 2, 255)
    end if
end for
Sponsor
Sponsor
Sponsor
sponsor
jamez




PostPosted: Sun Nov 30, 2003 9:00 pm   Post subject: (No subject)

P.S. long time no see peeps
Andy




PostPosted: Sun Nov 30, 2003 9:04 pm   Post subject: (No subject)

hmmm interesting... although you could've drawn it once and use Pic.Rotate
CITC




PostPosted: Sun Jan 11, 2004 6:55 pm   Post subject: (No subject)

awesome, looks really cool!
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 4 Posts ]
Jump to:   


Style:  
Search: