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

Username:   Password: 
 RegisterRegister   
 An unusual bouncing circle program
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
DanielG




PostPosted: Fri Feb 08, 2008 8:41 pm   Post subject: An unusual bouncing circle program

I was bored trying some programming problem and decided to make this, this is like the normal bouncing circle programs that bounce off the walls, only this moves "randomly".

code:

setscreen ("graphics, offscreenonly")

var x, y : int := 40
var r := 5
var vx, vy := 6
var vr := 1

loop
    vx += Rand.Int (-3, 3)
    vy += Rand.Int (-3, 3)
    vr += Rand.Int (-1, 1)
    if vx > 10 then
        vx := 10
    end if
    if vy > 10 then
        vy := 10
    end if
    if vr > 3 then
        vr := 3
    end if
    x += vx
    y += vy
    r += vr

    if x <= abs (r) then
        x := abs (r)
        vx := abs (vx)
    end if
    if x >= maxx - abs (r) then
        x := maxx - abs (r)
        vx := -abs (vx)
    end if
    if y <= abs (r) then
        y := abs (r)
        vy := abs (vy)
    end if
    if y >= maxy - abs (r) then
        y := maxy - abs (r)
        vy := -abs (vy)
    end if
    if r >= 50 then
        vr := -abs (vr)
    end if
    if r <= -50 then
        vr := abs (vr)
    end if
    drawfilloval (x, y, r, r, black)
    View.Update
    delay (30)
    cls
end loop
Sponsor
Sponsor
Sponsor
sponsor
BigBear




PostPosted: Fri Feb 08, 2008 9:11 pm   Post subject: Re: An unusual bouncing circle program

Nice little program with clean code well done. Very Happy
Jestar




PostPosted: Fri Feb 08, 2008 10:14 pm   Post subject: RE:An unusual bouncing circle program

haha very cool.
DanielG




PostPosted: Fri Feb 08, 2008 10:32 pm   Post subject: RE:An unusual bouncing circle program

Thanks
apomb




PostPosted: Sat Feb 09, 2008 7:55 am   Post subject: RE:An unusual bouncing circle program

no, this is not "unusual", this is not "cool"
it is overdone and frankly not worth posting.
why waste space on the servers for terrible "cool" programs, ... make something worthwile for pete's peppers.
Euphoracle




PostPosted: Sat Feb 09, 2008 12:13 pm   Post subject: RE:An unusual bouncing circle program

People with a highschool credit in turing post here CompWiz333, you can't expect the next great CAD compilation or web design suite to appear here in turing.
Nyrd




PostPosted: Sun Feb 10, 2008 10:08 pm   Post subject: RE:An unusual bouncing circle program

Trippy . . .
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: