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

Username:   Password: 
 RegisterRegister   
 Matrix Program
Index -> Programming, Turing -> Turing Submissions
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Catalyst




PostPosted: Thu Mar 27, 2003 6:52 am   Post subject: Matrix Program

here a matrix program i made a while ago (didnt know of RGB)

code:

%% Matrix Program by Catalyst

const maxChar := 100
const maxStreak := 250
randomize

var w : int := Window.Open ("position:300;300,graphics:640;640")
Window.Set (w, "nocursor,noecho")

var x, y, c : array 1 .. maxStreak of int


var ch : array 1 .. maxStreak of string
for i : 1 .. maxStreak
    y (i) := maxy
    ch (i) := " "
    c (i) := 1
end for

var z : int := 1
var font : int := Font.New ("courier:12:bold")
var yspd : int := 10
var rc : int := 0

proc fillback (c : int)
    drawfillbox (-10, -10, maxx + 10, maxy + 10, c)
end fillback

proc Streak (num : int,highlight:boolean)%% Turns a white sparkles effets on/off
    for n : 1 .. num
        randint (x (n), 0, maxx)
        randint (y (n), maxy, maxy * 2+140)
    end for
    loop
        for n : 1 .. num
            randint (z, 1, maxChar)

            ch (n) += chr (z)

            c (n) += 1
            y (n) -= yspd
            if y (n) < -140 then
                randint (y (n), maxy, maxy * 2+140)
                randint (x (n), 0, maxx)
                ch (n) := " "
                c (n) := 1
            end if


            if c (n) > 16 then
                if highlight = true then
                    Font.Draw (ch (n) (c (n) - 1), x (n), y (n), font, white)
                end if
                Font.Draw (ch (n) (c (n) - 2), x (n), y (n) + 10, font, 10)
                Font.Draw (ch (n) (c (n) - 3), x (n), y (n) + 20, font, 2)
                Font.Draw (ch (n) (c (n) - 7), x (n), y (n) + 60, font, 120)
                Font.Draw (ch (n) (c (n) - 11), x (n), y (n) + 100, font, 192)
                Font.Draw (ch (n) (c (n) - 15), x (n), y (n) + 140, font, black)
            end if
        end for

    end loop
end Streak

fillback (black)
Streak (100,false)


MOD Edit: MATRIX! best one I've seen yet, quite impressive as always. +15Bits - Tony
Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: Thu Mar 27, 2003 8:45 am   Post subject: Sweeet!!

That looks really cool Surprised mine looks a little like that but not as good Smile
Nice Good man!
sherb




PostPosted: Thu Mar 27, 2003 11:07 pm   Post subject: (No subject)

WOW beat mine by quite a bit but then again i have a feeling you have been programing a little longer than me. anyway thats pretty good.

tony said he posted one but i can find it did anyone see it by anychance??
Asok




PostPosted: Thu Mar 27, 2003 11:22 pm   Post subject: (No subject)

tony was talking about this thread I believe.
Catalyst




PostPosted: Thu Mar 27, 2003 11:51 pm   Post subject: (No subject)

when i wrote this i had been programming for 5 months
sherb




PostPosted: Fri Mar 28, 2003 7:48 am   Post subject: (No subject)

ya thats a bit better than me. i failed my lst class i took with programin.
in total ive been progeraming probably around 2 months.

i just couldnt get the binary math in gr 10 comp eng. now im gr 10 comp sci and where just begging graphics which i already know a bit of from comp eng.
Prince




PostPosted: Fri Mar 28, 2003 11:14 am   Post subject: (No subject)

thats pretty cool... is there any way to make the characters scroll faster or slower? or mayb to make them scroll in a different direction?
Dan




PostPosted: Fri Mar 28, 2003 12:21 pm   Post subject: (No subject)

i love the matricks best movie ever cant wate for the next ones. this whode make a good screan saverer.
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
Sponsor
Sponsor
Sponsor
sponsor
nis




PostPosted: Tue Apr 01, 2003 4:24 pm   Post subject: How to add a delay

To make it slow down at a delay(x) in the streak proc right before the last loop
Martin




PostPosted: Tue Apr 01, 2003 10:55 pm   Post subject: (No subject)

Just one thing about clearing the text. You should probably do a draw box instead of a Font.Draw (....,black) which is what I'm assuming you did. It'd get rid of the resedue.
ThunderChuncky




PostPosted: Thu May 01, 2003 2:35 pm   Post subject: (No subject)

I made a nother matrix program if anyone's interested.
code:

var counter :int :=0
var w1 :int

w1 :=Window.Open("title:Old School Matrix,screen:40;70,position:250;100")

color(green)
colorback(black)
loop
   put "100101111011001011101011011010110101010111111001011001101101010011110"
   delay(15)
   put "110101011101101110101011101101010101101010101110010010101000101010001"
   delay(15)
   put "010111110101101001010010101111001010111101101010101010101100101100101"
   delay(15)
   put "011101010101011010100111010110101101011011110110111101010101111101101"
   delay(15)
   put "110100101010110110101010101110110110110100110110101101010101111101010"
   delay(15)
   put "101101011101100110011101011010011110101101011001011101010111011101101"
   delay(15)
   put "001011010111010110010010101111110110100110110101100110010110100110110"
   delay(15)
   put "101010101011101011111011010101001011011010010110110110011101010100100"
   delay(15)
   put "011111101010010111011010101001010110100110100101010001011010101011010"
   delay(15)
   put "101110101010111011100100101010011101101001010110101010100101010110101"
   delay(15)
   put "101011011011110101100111101010101010010100110010101001010101010101101"
   delay(15)
   put "110101010101010101110010101011101111101101010101010101111010101010110"
   delay(15)
   counter := counter + 1
   exit when counter = 50
end loop

put "10100101111010010101010010              10100101010100101001010101001"
delay(1)
put "10010100101100101110101101 SYSTEM ERROR 10011100101100110110100010010"
delay(1)
put "11010101000110101010101110              10101110010010101000101010001"
delay(1)
put "010100110001101001010010101001001010111101001010100010101100101100101"
delay(1)
put "001010101010110101001110100101011010110100101001001010101011111010101"
delay(1)
put "110100101010110010101010100010110110110100110110100101010101001101010"
delay(1)
put "101101011100100110011101011010011110101101011001011001010111011101101"
delay(1)
put "001010010111010110010010101100000110100110110101100110010110100110110"
delay(1)
put "101010101010101011111010010101001011011010010010010110011101010100100"
delay(1)
put "010010101010010001001010101001010110100100100101010111011010101011010"
delay(1)
put "101010101010111011100100101010011100101001010110100010100101010110101"
delay(1)
put "101001001010010101100110010101010101001010011001010100101010101010101"
delay(1)
put "010101010101010101110010101010101101100101010101010101001010101010110"
delay(1)
put "100101001011001011101011011010110101010100111001011001101101010010010"
delay(1)
put "110101010111101010101011101101010101001010101110010010101000101010001"   
delay(1)
put "010100110101101001010010101001001010111101001010100010101100101100101"
delay(1)
put "001010101010110101001110100101011010110100101001001010101011111010101"
delay(1)
put "110100101010110010101010100010110110110100110110100101010101001101010"
delay(1)
put "101101011100100110011101011010011110101101011001011001010111011101101"
delay(1)
put "001010010111010110010010101101110110100110110101100110010110100110110"
delay(1)
put "101010101010101011111010010101001011011010010010010110011101010100100"
delay(1)
put "010010101010010111001010101001010110100100100101011101011010101011010"
delay(1)
put "101010111010111011100100101010011100101001010110100010100101010110101"
delay(1)
JayLo




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

i still like catalyst's better.
Prince




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

ill agree wit dat
Homer_simpson




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

here's my matrix
code:
var font : int := Font.New ("courier:15:bold")
const maxch := 30
const chspace := 30
type xyb :
    record
        x, y : int
        b : boolean
        c1 : string
    end record
var arr : array 1 .. maxch of xyb
for i : 1 .. maxch
    arr (i).b := false
    arr (i).c1 := ""
end for
procedure givevalue (var arr : xyb)
    var x, y, ch := 0
    if not arr.b then
        randint (x, 10, 640)
        randint (y, 300, 400)
        arr.x := x
        arr.y := y
        arr.b := true
        for i : 1 .. 10
            randint (ch, 65, 100)
            arr.c1 += chr (ch)
        end for

    end if
end givevalue
procedure move (var arr : xyb, co : int)
    var ch, i := 0
    var s := ""
    randint (ch, 65, 100)
    s += chr (ch)
    for ii : 1 .. 10
        s += arr.c1 (ii)
    end for
    arr.c1 := s
    randint (ch, 65, 100)
    arr.y := arr.y - 10
    if arr.y > -240 then
        Font.Draw (arr.c1 (1), arr.x, arr.y, font, co)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (2), arr.x, arr.y + i, font, 2)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (3), arr.x, arr.y + i, font, 2)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (4), arr.x, arr.y + i, font, 168)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (5), arr.x, arr.y + i, font, 144)
        i += chspace
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (6), arr.x, arr.y + i, font, 144)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (7), arr.x, arr.y + i, font, 120)

        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (8), arr.x, arr.y + i, font, 120)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
        Font.Draw (arr.c1 (9), arr.x, arr.y + i, font, 192)
        i += chspace
        drawfillbox (arr.x - 1, arr.y + i - 10, arr.x + 12, arr.y + i + 10, 16)
    else
        arr.b := false
    end if
end move
View.Set ("offscreenonly")
colorback (16)
cls


loop
    for i : 1 .. maxch
        givevalue (arr (i))

        move (arr (i), 10)
        View.Update
    end for
    exit when hasch
end loop

almost the same as catalyst but it's written in a differenct method
try changing values of maxch and chspace they change the output oh and also the co in procedure move ...
ZeroKelvin




PostPosted: Thu May 01, 2003 8:00 pm   Post subject: (No subject)

I like your first matrix better,
my matrix is alot like the one ThunderChuncky has. Embarassed

Homer_simpson, keep it up
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 2  [ 18 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: