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

Username:   Password: 
 RegisterRegister   
 Parametric (originally by catalyst in C++)
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
TheOneTrueGod




PostPosted: Sun May 14, 2006 12:03 am   Post subject: Parametric (originally by catalyst in C++)

I saw this really cool program done by catalyst in C++, and I decided to bring it over into turing Very Happy

code:
const startValue := 30
const maxValue := 70
const incrementAmount := 0.1
const maxDist := 700

procedure DrawLine (x, y : real, angle : real, dist : real, inc : real)
    Draw.ThickLine (round (x), round (y), round (x + cosd (angle) * dist), round (y + sind (angle) * dist), 1, white)
    if dist > maxDist then
        return
    end if
    DrawLine (round (x + cosd (angle) * dist), round (y + sind (angle) * dist), angle + inc, dist + 1, inc)
end DrawLine

View.Set ('graphics:500,500')
View.Set ('offscreenonly')
View.Set ('nobuttonbar')
View.Set ('position:centre;centre')

Text.ColourBack (black)
cls
var a : real := startValue
loop
    a += incrementAmount
    if a > maxValue then
        a := startValue
    end if

    DrawLine (maxx div 2, maxy div 2, 0, 0, a)
    View.Update
    Time.DelaySinceLast (50)
    cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
upthescale




PostPosted: Sun May 14, 2006 12:07 am   Post subject: (No subject)

imporessive...i changed the coding around and messed it up lol
jamonathin




PostPosted: Sun May 14, 2006 12:08 am   Post subject: (No subject)

Ah yes, the catalyst programs. Very cool.
Go Recursion!
(the View.Set's can be in 1 line, but im shure u know that)
TheOneTrueGod




PostPosted: Sun May 14, 2006 8:30 am   Post subject: (No subject)

Yarr, I knew it, but I didn't know how to implement it Razz what character do you use to separate different commands?
AzureFire




PostPosted: Sun May 14, 2006 8:47 am   Post subject: (No subject)

you use a comma like this;

code:
View.Set("graphics:300;200, nobuttonbar, noecho")

etc.

And isn't offscreenonly set by default?
Cervantes




PostPosted: Sun May 14, 2006 9:42 am   Post subject: (No subject)

AzureFire wrote:
And isn't offscreenonly set by default?

No, offscreenonly is not set by default.
Delos




PostPosted: Sun May 14, 2006 11:11 am   Post subject: (No subject)

Heh, not bad at all. It's been a while since we've had anyone attempt this programme (yeah, we've had quite a few such submissions in the past). Good job though. Methinks zylum did this a while back too - see if you can track down his code and do a comparisson.
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  [ 7 Posts ]
Jump to:   


Style:  
Search: