MATRIX1.BAS
קוד: בחירת הכל
10 DEFINT A-Z:RANDOMIZE TIMER:DEF SEG=&HB800
20 DIM MMI(80),MROW(80,3),MMODE(80,3)
30 DEF FNG(N)=N-(INT(20*RND)+5)
40 ' Initialize.
50 FOR I=0 TO 1999:POKE I*2+1,0:POKE I*2,INT(256*RND):NEXT
60 FOR COL=0 TO 79:R=0:MODE=-1
70 FOR I=1 TO 3:R=FNG(R):MROW(COL,I)=R:MODE=NOT MODE:MMODE(COL,I)=MODE:NEXT
80 MMI(COL)=3:NEXT
90 ' Main loop.
100 WHILE INKEY$="":FOR COL=0 TO 79
110 FOR I=1 TO 3:R=MROW(COL,I):R=R+1:MROW(COL,I)=R:IF R<0 THEN 140
120 A=(R*80+COL)*2+1:IF MMODE(COL,I) THEN POKE A,0:GOTO 130:ELSE POKE A,10:IF R THEN POKE A-160,2
130 IF R=24 THEN J=MMI(COL):MMODE(COL,I)=NOT MMODE(COL,J):MROW(COL,I)=FNG(MROW(COL,J)):MMI(COL)=I
140 NEXT:NEXT:WEND
150 CLS: COLOR 2
160 WHILE INKEY$ <> CHR$(27)
170 LOCATE 15, 30
180 PRINT " THE MATRIX HAS YOU"
190 WEND
200 END