Computer Science Canada

Matrix (sort of)

Author:  chipanpriest [ Wed Dec 21, 2011 12:40 pm ]
Post subject:  Matrix (sort of)

I've made 2 different "matrix" type things, here they are

Turing:
% Made by: Aaron Rader
% 21 December 2011

var letter : int := 100 %Number of letters
var size : int := 30 %Size of letters

var x : array 1 .. letter of int
var y : array 1 .. letter of int
var ch : array 1 .. letter of int
var font : array 1 .. letter of int
var chrsize : array 1 .. letter of int

View.Set ("offscreenonly")
colourback (7)
cls

for i : 1 .. letter
    randint (chrsize (i), size - 10, size)
    randint (x (i), 0, maxx)
    randint (y (i), 0, maxy)
    randint (ch (i), 65, 90)
end for

loop
    for i : 1 .. letter
        font (i) := Font.New ("Bauhaus 93:" + intstr (chrsize (i)))
        Font.Draw (chr (ch (i)), x (i), y (i), font (i), green)
    end for
    for i : 1 .. letter
        y (i) := y (i) - 1
    end for
    for i : 1 .. letter
        if y (i) <= 0 then
            chrsize (i) := Rand.Int (size - 10, size)
            ch (i) := Rand.Int (65, 90)
            x (i) := Rand.Int (0, maxx)
            y (i) := maxy
        end if
    end for
    View.Update
    cls
end loop


and
Turing:
var numb : int

setscreen ("graphics:max,max")

colourback (cyan)
cls
colour (brightmagenta)

loop
    randint (numb, 0, 9)
    put numb, " " ..
    delay (1)
end loop

Hope you like em Very Happy

Author:  Aange10 [ Wed Dec 21, 2011 1:39 pm ]
Post subject:  RE:Matrix (sort of)

Haha I saw that and it insipired me. Here's mine

Turing:
View.Set ("offscreenonly")
type Data :
    record
        x, y, font, yv : int
        name : string
    end record

var font : int := Font.New ("TimeNewRoman:10")
var font2 : int := Font.New ("TimesNewRoman:11")
var i_ : int := 0
var matrix : array 1 .. 200, 1 .. 200 of Data

for i : 1 .. 200
    i_ := Rand.Int (20, 25)
    for e : 1 .. 200
        matrix (i, e).x := 0 + (i * 20)
        matrix (i, e).y := maxy + ((e - 1) * 15)
        matrix (i, e).yv := i_
        if Rand.Int (1, 4) < 4 then
            matrix (i, e).name := chr (Rand.Int (95, 122))
        else
            matrix (i, e).name := chr (Rand.Int (48, 57))
        end if
    end for
end for


loop
    colorback (black)
    cls
    for i : 1 .. 200
        for e : 1 .. 200
            if matrix (i, e).y < -15 then
                matrix (i, e).y := maxy + (200 * 15)
                if Rand.Int (1, 4) < 4 then
                    matrix (i, e).name := chr (Rand.Int (95, 122))
                else
                    matrix (i, e).name := chr (Rand.Int (48, 57))
                end if
            end if
            % if we can see them
            if matrix (i, e).y < maxy and matrix (i, e).y > 0 then
                if strintok (matrix (i, e).name) = false then
                    Font.Draw (matrix (i, e).name, matrix (i, e).x, matrix (i, e).y, font2, white)
                end if
                Font.Draw (matrix (i, e).name, matrix (i, e).x, matrix (i, e).y, font, green)
            end if
            matrix (i, e).y -= matrix (i, e).yv
        end for
    end for
    View.Update
    Time.DelaySinceLast (17)
end loop


Author:  mirhagk [ Wed Dec 21, 2011 3:25 pm ]
Post subject:  RE:Matrix (sort of)

@Aagne, what's 20*200? Bigger than your screen. 20*100 is more than enough, and increases the speed that it can run at.

EDIT: In fact 32 is completely visible on a default sized turing run window.


: