Computer Science Canada

Parametric (originally by catalyst in C++)

Author:  TheOneTrueGod [ 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

Author:  upthescale [ Sun May 14, 2006 12:07 am ]
Post subject: 

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

Author:  jamonathin [ Sun May 14, 2006 12:08 am ]
Post 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)

Author:  TheOneTrueGod [ Sun May 14, 2006 8:30 am ]
Post subject: 

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

Author:  AzureFire [ Sun May 14, 2006 8:47 am ]
Post subject: 

you use a comma like this;

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

etc.

And isn't offscreenonly set by default?

Author:  Cervantes [ Sun May 14, 2006 9:42 am ]
Post subject: 

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

No, offscreenonly is not set by default.

Author:  Delos [ Sun May 14, 2006 11:11 am ]
Post 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.


: