RosettaCodeData/Task/Matrix-digital-rain/Yabasic/matrix-digital-rain.basic

56 lines
927 B
Plaintext

open window 640,512,"swiss12"
backcolor 0,0,0
clear window
mx=50
my=42
dim scr(mx,my)
for y=0 to my
for x=0 to mx
scr(x,y)=int(ran(96)+33)
next x
next y
ms=50
dim sx(ms)
dim sy(ms)
for a=1 to ms
sx(a)=int(ran(mx))
sy(a)=int(ran(my))
next a
do
for s=1 to ms
x=sx(s)
y=sy(s)
letter(0,255,0)
y=y-1
letter(0,200,0)
y=y-1
letter(0,150,0)
y=y-1
color 0,0,0
fill rect x*12.8-1,y*12.8+4 to x*12.8+12,y*12.8-10
letter(0,70,0)
y=y-24
color 0,0,0
fill rect x*12.8-1,y*12.8+4 to x*12.8+12,y*12.8-10
next s
for s=1 to ms
if int(ran(5)+1)=1 sy(s)=sy(s)+1
if sy(s)>my+25 then
sy(s)=0
sx(s)=int(ran(mx))
end if
next s
loop
sub letter(r,g,b)
if y<0 or y>my return
c=scr(x,y)
color r,g,b
text x*12.8,y*12.8,chr$(c)
end sub