Computer Science Canada

matrix

Author:  MihaiG [ Thu Nov 25, 2004 6:33 pm ]
Post subject:  matrix

this is a code i remade(permision to re-use code asked & granted)from:this_guy


it makes random lengths for the matrix lines.... the first hundred are the same then they get longer/shorter... this will make it speed up or slow down
code:

loop
    var TAIL : int
    randint (TAIL, 10, 20)
    const DENSITY := 50
    const LENGTH := TAIL
    const BGCOLOUR := black
    const DTIME := 0
    var randi : int
    var row : array 1 .. DENSITY of int
    var col : array 1 .. DENSITY of int
    var chara : array 1 .. DENSITY of char
    var shades : array - 1 .. LENGTH - 1 of int
    for i : 0 .. LENGTH
        shades (i - 1) := RGB.AddColour (0, i / LENGTH, 0)
    end for
    for i : 1 .. DENSITY
        row (i) := Rand.Int (-LENGTH * 2, maxrow)
        col (i) := Rand.Int (1, maxcol)
        chara (i) := chr (Rand.Int (0, 255 - LENGTH))
    end for
    colourback (BGCOLOUR)
    drawfillbox (0, 0, maxx, maxy, BGCOLOUR)
    loop
        for i : 1 .. DENSITY
            for j : 0 .. LENGTH - 1
                row (i) += 1
                if row (i) > 0 and row (i) <= maxrow then
                    locate (row (i), col (i))
                    color (shades (j))
                    put chara (i) ..
                end if
            end for
            row (i) -= LENGTH - 1
            if row (i) > maxrow + LENGTH then
                row (i) := -LENGTH
                col (i) := Rand.Int (1, maxcol)
                chara (i) := chr (Rand.Int (0, 255 - LENGTH))
            end if
            delay (DTIME)
        end for
        View.Update
    end loop
end loop



this is my own made matrix.... i hope you enjoy..

code:

var x, y : int
colourback (black)
cls
colour (green)
loop
    for a : 0 .. 255
        randint (x, 1, 80)
        randint (y, 1, 5)
        locate (y, x)
        put chr (a)
        randint (x, 1, 80)
        randint (y, 6, 11)
        locate (y, x)
        put chr (a)
        randint (x, 1, 80)
        randint (y, 12, 17)
        locate (y, x)
        put chr (a)
        randint (x, 1, 80)
        randint (y, 17, 22)
        locate (y, x)
        put chr (a)
        randint (x, 1, 80)
        randint (y, 22, 25)
        locate (y, x)
        put chr (a)
    end for
    delay (20)
end loop


%you can make like this
%loop
%    for a : 0 .. 255
%        randint (x, 1, 80)
%        randint (y, 1, 5)
%        locate (y, x)
%        put chr (a)
%        randint (x, 1, 80)
%        randint (y, 1, 25)
%        locate (y, x)
%        put chr (a)
%    end for
%    delay (20)
%end loop
% but it clumps to the left....


permission must be used for this code


©2004 NOVEMBER 25th ElCOMMANDANTE®
Please do not violate it just makes it harder for both of us Wink Twisted Evil Evil or Very Mad

Author:  Delos [ Thu Nov 25, 2004 6:38 pm ]
Post subject: 

Please resize your avtar. It is far too big.

Oh, your code's not bad.

Author:  MihaiG [ Thu Nov 25, 2004 8:49 pm ]
Post subject: 

my bad.... i changed always have probs... withthose avs....but give some credit to this_guy who made most of the first code... whihc i edited ...second was entirley me... Smile


: