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

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




PostPosted: Wed Dec 03, 2003 1:39 pm   Post subject: Something wierd...

code:
setscreen ("nocursor")
setscreen ("graphics:vga")
var x, y, c : int
randomize
for i : 1 .. 10000
    randint (x, 0, maxx - 20)
    randint (y, 0, maxy - 70)
    randint (c, 0, 1)
    drawbox (x, y, x + 20, y + 20, c)
end for
var dx1 := 3
var dy1 := 4
var dx2 := 5
var dy2 := 6
var x1, y1, x2, y2 := 25

proc flipIfOutOfBounds (var delta : int, z, bound : int)
    if z < 0 or z > bound then
        delta := - delta
    end if
end flipIfOutOfBounds

for i : 1 .. 2500
    randint (c, 8, 10)
    flipIfOutOfBounds (dx1, x1, maxx)
    flipIfOutOfBounds (dy1, y1, maxy)
    flipIfOutOfBounds (dx2, x2, maxx)
    flipIfOutOfBounds (dy2, y2, maxy)

    x1 += dx1
    y1 += dy1
    x2 += dx2
    y2 += dy2

    const Color := (x1 div 30) mod maxcolour + 1
    drawline (x1, y1, x2, y2, c)
    drawline (maxx - x1, y1, maxx - x2, y2, c)
    drawline (x1, maxy - y1, x2, maxy - y2, c)
    drawline (maxx - x1, maxy - y1, maxx - x2, maxy - y2, c)
end for
var midx := 111
var midy := 333
var theta := 0.
const deltaTheta := .1
const ballsizea := maxy div 15
const ballsizeb := maxy div 50

for k : 1 .. 2525
    const ra := (midy div 2) * cosd (5 * theta)
    const rb := (midy - ballsizea) * cosd (30 * theta)

    const xa := ra * cosd (theta)
    const ya := ra * sind (theta)

    const xb := rb * cosd (theta)
    const yb := rb * sind (theta)

    const mc := maxcolour

    var a := round (midx + xa)
    var b := round (midy + ya)

    randint (c, 0, 1)

    drawoval (x, y, ballsizea, ballsizea, c)

    x := round (midx + xb)
    y := round (midy + yb)
    drawoval (x, y, ballsizeb, ballsizeb, blue)
    theta += deltaTheta
end for

var j := 67
var k := 43
var dx := 9
var dy := 13
var r := 1
const margin := 20

for n :1..23456
    drawoval (j, k, r, r, c)
    if j >= maxx - margin or j < margin then
        dx := - dx
        r += 1
    end if
    if k >= maxy - margin or k < margin then
        dy := - dy
    end if
    j += dx
    k += dy
    randint (c, 1, 2)
   
end for
for i : 1 .. 2500
    randint (c, 0,1)
    flipIfOutOfBounds (dx1, x1, maxx)
    flipIfOutOfBounds (dy1, y1, maxy)
    flipIfOutOfBounds (dx2, x2, maxx)
    flipIfOutOfBounds (dy2, y2, maxy)

    x1 += dx1
    y1 += dy1
    x2 += dx2
    y2 += dy2

    const Color := (x1 div 30) mod maxcolour + 1
    drawline (x1, y1, x2, y2, c)
    drawline (maxx - x1, y1, maxx - x2, y2, c)
    drawline (x1, maxy - y1, x2, maxy - y2, c)
    drawline (maxx - x1, maxy - y1, maxx - x2, maxy - y2, c)
    delay (50)
end for




Ok, this is just something I did when I was bored during lunch.....[/code]
Sponsor
Sponsor
Sponsor
sponsor
Dan




PostPosted: Wed Dec 03, 2003 2:57 pm   Post subject: (No subject)

Wierd
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Tony




PostPosted: Wed Dec 03, 2003 8:25 pm   Post subject: (No subject)

dan - its weird... and indeed it is Laughing
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
santabruzer




PostPosted: Wed Dec 03, 2003 8:49 pm   Post subject: (No subject)

THat's Freaking amazing Very Happy
Entz




PostPosted: Wed Dec 03, 2003 9:31 pm   Post subject: (No subject)

Hmm.. thats pretty cool. Usually though i just make a small program like that and see what shape it can make after going for 20 minutes (the line flip out of bounds one)
kalin




PostPosted: Sun Dec 07, 2003 9:51 pm   Post subject: ...

Yeah, I was bored one day in school and started fooling around with the pixel graphics.....Can't you tell I was bored???
DanShadow




PostPosted: Sun Dec 07, 2003 11:30 pm   Post subject: (No subject)

hmm....I can see you got VERY bored....lol. *Agrees*, yes, it's pretty weird
shorthair




PostPosted: Thu Dec 18, 2003 9:08 am   Post subject: Thahts Pretty Awsome

i like it
Sponsor
Sponsor
Sponsor
sponsor
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  [ 8 Posts ]
Jump to:   


Style:  
Search: