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

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




PostPosted: Thu May 01, 2003 2:55 pm   Post subject: lightning

k, i made this a few days ago and posted it on the ooturing boards while this one was still down
Sponsor
Sponsor
Sponsor
sponsor
DarkHelmet




PostPosted: Thu May 01, 2003 3:04 pm   Post subject: (No subject)

that's pretty cool. good job
Tony




PostPosted: Thu May 01, 2003 5:15 pm   Post subject: (No subject)

looks cool.
+200Bits
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Homer_simpson




PostPosted: Thu May 01, 2003 10:26 pm   Post subject: (No subject)

code:
const maxdetectors := 20
const numberofbolts := 2
const detectiondistance := 100
function distance (x1, y1, x2, y2 : int) : int
    result round (((x1 - x2) ** 2 + (y1 - y2) ** 2) ** .5)
end distance
colorback (16)
cls
View.Set ("offscreenonly")
var mx, my, mb : int
var x, y, xx1, yy1, xx2, yy2 := 300
procedure calcline (x1, y1, x2, y2 : int, var xx1, yy1, xx2, yy2 : int)
    var slope : real
    var xx := (x2 - x1) / 3
    if x2 - x1 not= 0 then
        slope := (y2 - y1) / (x2 - x1)
    else
        slope := 999999999
    end if
    yy1 := round (y1 + (xx * slope))
    xx1 := round (x1 + xx)
    xx := (x2 - x1) / (3 / 2)
    yy2 := round (y1 + (xx * slope))
    xx2 := round (x1 + xx)
end calcline
function random (m, x : int) : int
    var rr : int
    randint (rr, m, x)
    result rr
end random
var ysh1 := 0
var ysh2 := 0
type detectors :
    record
        x, y : int
    end record
var arr : array 1 .. maxdetectors of detectors

for i : 1 .. maxdetectors
    arr (i).x := random (1, 640)
    arr (i).y := random (1, 400)
end for

loop
    mousewhere (mx, my, mb)
    for i : 1 .. maxdetectors
        if distance (mx, my, arr (i).x, arr (i).y) < detectiondistance then
            calcline (mx, my, arr (i).x, arr (i).y, xx1, yy1, xx2, yy2)
            for ii : 1 .. numberofbolts
                ysh1 := random (-10, 10)
                drawline (mx, my, xx1 + ysh1, yy1 + ysh1, 54)
                ysh2 := random (-10, 10)
                drawline (xx1 + ysh1, yy1 + ysh1, xx2 + ysh2, yy2 + ysh2, 52)
                drawline (xx2 + ysh2, yy2 + ysh2, arr (i).x, arr (i).y, white)
            end for
        end if
        drawfilloval (arr (i).x, arr (i).y, 10, 10, random (1, 255))
    end for
    drawfilloval (300, 300, 10, 10, 12)
    View.Update
    cls
    exit when hasch
end loop

this is my version of lightning i made it based on the same idea with a different method try changeing
const maxdetectors := 20
const numberofbolts := 2
const detectiondistance := 100
they will change the outpput
ZeroKelvin




PostPosted: Fri May 02, 2003 10:11 am   Post subject: (No subject)

i need turing 4 can someone share or tell me where to get it?
Homer_simpson




PostPosted: Fri May 02, 2003 12:35 pm   Post subject: (No subject)

Add these two lines
code:
    drawfillstar (mx - 15, my - 15, mx + 15, my + 15, 53)
    drawoval (mx, my, 15, 15, 53)

under
code:
     mousewhere (mx, my, mb)
[/code]
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  [ 6 Posts ]
Jump to:   


Style:  
Search: