Vous vous savez du fabuleux jeux soviétique «Tetris», succès incroyable des années 1980, où il faut placer des cubes
afin de faire disparaitre des lignes. Voici la première version que j'ai fait lorsque j'étais adolescent au secondaire.
A l'aide du code source GWBASIC, vous trouvez la réponse que vous souhaitez:
- 0 'ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
- 1 ' ³ ³
- 2 ' ³ BASIC TETRISII Versions 1.00A ³
- 3 ' ³ ³
- 4 ' ³ Jeux de Collection ³
- 5 ' ³ ³
- 6 ' ³ Copyright (C) 1990-91 par ³
- 7 ' ³ Les Chevaliers de Malte/Développeur (Sylvain Maltais) ³
- 8 ' ³ ³
- 9 ' ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
- 10 DIM TSM%(45,25),TA%(33),TB%(33),TC%(33),TY%(25),TZ%(9),TX%(8001),TX2%(8001):KEY 1,"1":KEY 2,"2":KEY 3,"3"
- 20 A$="":A=0:B=0:C=0:CO=0:CO1=1:SC=0:TE=80:TVACHE=0:X=1:Y=1
- 30 KEY OFF:SCREEN 0,1:WIDTH 80:COLOR 7,0:CLS:LOCATE 12,15:PRINT"Avez vous ou Moniteur (M)onocrome/(C)ouleur ?";:COLOR 23:PRINT"_"
- 40 A$=INKEY$:IF A$=""THEN 40
- 50 IF A$="C"OR A$="c"THEN M=1:GOTO 60 ELSE IF A$="M"OR A$="m"THEN M=0:GOTO 60 ELSE 40
- 60 SCREEN 1,M:CLS:RANDOMIZE TIMER
- 70 DRAW"C2BM0,0R31D7L31U7":LINE(1,1)-(30,6),1,BF:GET(0,0)-(31,7),TA%:CLS
- 80 DRAW"C2BM0,0R7D31L7U31":LINE(1,1)-(6,30),1,BF:GET(0,0)-(7,31),TB%:CLS
- 90 DRAW"C3BM0,0R15D15L15U15":LINE(1,1)-(14,14),2,BF:GET(0,0)-(15,15),TC%:CLS
- 110 GET(0,0)-(319,7),TX%:PUT(0,192),TX%,PSET:PUT(0,184),TX%,PSET:GET(0,0)-(319,199),TX2%
- 120 LINE(8,60)-(311,191),0,BF:LINE(8,60)-(311,191),2,B
- 130 LOCATE 10,18:PRINT"MENU"
- 140 LOCATE 15,5:PRINT"F(1)-Pour obtenir les instructions":LOCATE 17,5:PRINT"F(2)-Pour Jouer une partie":LOCATE 19,5:PRINT"F(3)-Pour Quiter"
- 4000 A$=INKEY$:IF A$=""THEN 4000
- 4010 ON VAL(A$) GOTO 4510,4990,4500
- 4500 SCREEN 0:WIDTH 80:CLS:END
- 4510 VIEW PRINT 9 TO 23:LINE(-1,60)-(320,191),0,BF:LINE(-1,60)-(320,191),2,B:RESTORE 60020
- 4520 READ B$:IF B$="-1"THEN 100 ELSE FOR A=1 TO LEN(B$):FOR B=0 TO 300:NEXT:PRINT MID$(B$,A,1);:NEXT:PRINT:GOTO 4520
- 4990 CLS:VIEW PRINT 1 TO 25:RESTORE 60000
- 5000 FOR CO=0 TO 9:READ TZ%(CO):NEXT:FOR CO1=0 TO 152 STEP 8:FOR CO=0 TO 312 STEP 8:PUT(CO,CO1),TZ%,PSET:NEXT CO,CO1
- 5010 LOCATE 21:PRINT STRING$(40,178);:DRAW"C2BM220,180R8L4D8BE8NR8D4NR4D4R8BE8NL4NR4D8BE8ND8R8D4L8M+8,+4BE8L4R8L4D8L4R8BR4R8U4L8U4R8BR8R8L2D8R2L6NU8L2BM5,192C1L5D3R5D3L5BM9,198U6F4E4D6BM22,192D3R5D3L5R5U6L5BM30,192D6R5U6L5"
- 5020 IF CO1=1 THEN X=10:CO1=0 ELSE X=30:CO1=1
- 5030 CO=INT(RND*3):ON CO GOTO 8000,7000,6000
- 6000 IF TSM%(X,Y+1)=1 THEN 50130 ELSE Y=Y+1:PUT(X*8-8,Y*8-8),TA%,PSET:TSM%(X,Y)=1:TSM%(X+1,Y)=1:TSM%(X+2,Y)=1:TSM%(X+3,Y)=1:SC=SC+2:LOCATE 23,2:PRINT"Le Pointage est"SC:LOCATE 24,2:PRINT"Le nombre de ligne est"TVACHE;
- 6010 A$=INKEY$:FOR CO=0 TO TE:IF A$=""THEN NEXT ELSE 6050
- 6020 IF Y>19 THEN TY%(Y)=TY%(Y)+4:Y=1:GOTO 50030 ELSE IF TSM%(X,Y+1)=1 OR TSM%(X+1,Y+1)=1 OR TSM%(X+2,Y+1)=1 OR TSM%(X+3,Y+1)=1 THEN TY%(Y)=TY%(Y)+4:Y=1:GOTO 50030
- 6030 FOR CO=1 TO 4:PUT((X+CO)*8-16,Y*8-8),TZ%,PSET:NEXT:TSM%(X,Y)=0:TSM%(X+1,Y)=0:TSM%(X+2,Y)=0:TSM%(X+3,Y)=0
- 6040 GOTO 6000
- 6050 IF A$="6"OR A$="4"OR A$="5"OR A$=CHR$(27) OR A$="P"OR A$="p"THEN 6060 ELSE 6010
- 6060 IF A$="6"AND Y<19 AND X<37 AND TSM%(X+1,Y+1)=0 AND TSM%(X+2,Y+1)=0 AND TSM%(X+3,Y+1)=0 AND TSM%(X+4,Y+1)=0 THEN GOSUB 50000:X=X+1:GOTO 6000
- 6070 IF A$="4"AND X>1 AND Y<19 AND TSM%(X-1,Y+1)=0 AND TSM%(X,Y+1)=0 AND TSM%(X+1,Y+1)=0 AND TSM%(X+2,Y+1)=0 THEN GOSUB 50000:X=X-1:GOTO 6000
- 6080 GOSUB 50080
- 6090 IF A$="5"AND TSM%(X,Y+2)=0 AND TSM%(X,Y+3)=0 AND TSM%(X,Y+4)=0 AND Y<17 THEN GOSUB 50000:GOTO 7000
- 6100 GOTO 6020
- 7000 IF TSM%(X,Y+1)=1 THEN 50130 ELSE Y=Y+1:PUT(X*8-8,Y*8-8),TB%,PSET:TSM%(X,Y)=1:TSM%(X,Y+1)=1:TSM%(X,Y+2)=1:TSM%(X,Y+3)=1:SC=SC+2:LOCATE 23,2:PRINT"Le Pointage est"SC:LOCATE 24,2:PRINT"Le nombre de ligne est"TVACHE;
- 7010 A$=INKEY$:FOR CO=0 TO TE:IF A$=""THEN NEXT ELSE 7050
- 7020 IF Y>16 THEN FOR CO=0 TO 3:TY%(Y+CO)=TY%(Y+CO)+1:NEXT:Y=1:GOTO 50030 ELSE IF TSM%(X,Y+4)=1 THEN FOR CO=0 TO 3:TY%(Y+CO)=TY%(Y+CO)+1:NEXT:Y=1:GOTO 50030
- 7030 FOR CO=1 TO 4:PUT(X*8-8,(Y+CO)*8-16),TZ%,PSET:NEXT:TSM%(X,Y)=0:TSM%(X,Y+1)=0:TSM%(X,Y+1)=0:TSM%(X,Y+3)=0
- 7040 GOTO 7000
- 7050 IF A$="6"OR A$="4"OR A$="5"OR A$=CHR$(27)OR A$="P"OR A$="p"THEN 7060 ELSE 7010
- 7060 IF A$="6"AND Y<16 AND X<40 AND TSM%(X+1,Y+1)=0 AND TSM%(X+1,Y+2)=0 AND TSM%(X+1,Y+3)=0 AND TSM%(X+1,Y+4)=0 THEN GOSUB 50010:X=X+1:GOTO 7000
- 7070 IF A$="4"AND X>1 AND Y<16 AND TSM%(X-1,Y+1)=0 AND TSM%(X-1,Y+2)=0 AND TSM%(X-1,Y+3)=0 AND TSM%(X-1,Y+4)=0 THEN GOSUB 50010:X=X-1:GOTO 7000
- 7080 GOSUB 50080
- 7090 IF A$="5"AND TSM%(X+1,Y+1)=0 AND TSM%(X+2,Y+1)=0 AND TSM%(X+3,Y+1)=0 AND Y<19 THEN GOSUB 50010:GOTO 6000
- 7100 GOTO 7020
- 8000 IF TSM%(X,Y+2)=1 OR TSM%(X+1,Y+2)=1 THEN 50130 ELSE Y=Y+1:PUT(X*8-8,Y*8-8),TC%,PSET:TSM%(X,Y)=1:TSM%(X+1,Y)=1:TSM%(X+1,Y+1)=1:TSM%(X,Y+1)=1:SC=SC+2:LOCATE 23,2:PRINT"Le Pointage est"SC:LOCATE 24,2:PRINT"Le nombre de ligne est"TVACHE;
- 8010 A$=INKEY$:FOR CO=0 TO TE:IF A$=""THEN NEXT ELSE 8050
- 8020 IF Y>18 THEN TY%(Y)=TY%(Y)+2:TY%(Y+1)=TY%(Y+1)+2:Y=1:GOTO 50030 ELSE IF TSM%(X,Y+2)=1 OR TSM%(X+1,Y+2)=1 THEN TY%(Y)=TY%(Y)+2:TY%(Y+1)=TY%(Y+1)+2:Y=1:GOTO 50030
- 8030 FOR CO=1 TO 2:FOR C=1 TO 2:PUT((X+CO)*8-16,(Y+C)*8-16),TZ%,PSET:NEXT C,CO:TSM%(X,Y)=0:TSM%(X+1,Y)=0:TSM%(X+1,Y+1)=0:TSM%(X,Y+1)=0
- 8040 GOTO 8000
- 8050 IF A$="6"OR A$="4"OR A$=CHR$(27) OR A$="P"OR A$="p"THEN 8060 ELSE 8010
- 8060 IF A$="6"AND Y<18 AND X<39 AND TSM%(X+2,Y+2)=0 AND TSM%(X+1,Y+2)=0 THEN GOSUB 50020:X=X+1:GOTO 8000
- 8070 IF A$="4"AND X>1 AND Y<18 AND TSM%(X-1,Y+2)=0 AND TSM%(X,Y+2)=0 THEN GOSUB 50020:X=X-1:GOTO 8000
- 8080 GOSUB 50080
- 8090 GOTO 8020
- 50000 FOR CO=1 TO 4:PUT((X+CO)*8-16,Y*8-8),TZ%,PSET:NEXT:TSM%(X,Y)=0:TSM%(X+1,Y)=0:TSM%(X+2,Y)=0:TSM%(X+3,Y)=0:RETURN
- 50010 FOR CO=1 TO 4:PUT(X*8-8,(Y+CO)*8-16),TZ%,PSET:NEXT:TSM%(X,Y)=0:TSM%(X,Y+1)=0:TSM%(X,Y+2)=0:TSM%(X,Y+3)=0:RETURN
- 50020 FOR CO=1 TO 2:FOR C=1 TO 2:PUT((X+CO)*8-16,(Y+C)*8-16),TZ%,PSET:NEXT C,CO:TSM%(X,Y)=0:TSM%(X,Y+1)=0:TSM%(X+1,Y)=0:TSM%(X+1,Y+1)=0:RETURN
- 50030 C=1
- 50031 FOR CO=C TO 20:IF TY%(CO)=40 THEN C=CO:GOTO 50040 ELSE NEXT:GOTO 5020
- 50040 GET(0,C*8-8)-(319,C*8),TX%
- 50050 FOR A=0 TO 20:LINE(0,C*8-8)-(319,C*8),0,BF:FOR B=0 TO 12:NEXT:PUT(0,C*8-8),TX%,PSET:FOR B=0 TO 12:NEXT B,A:BEEP
- 50060 GET(0,0)-(319,C*8-9),TX%:PUT(0,8),TX%,PSET:GET(0,0)-(319,199),TX%:LINE(8,48)-(312,88),0,BF:LINE(8,48)-(312,88),3,B:LOCATE 8,16:PRINT"FELICITATION!":LOCATE 10,3:PRINT"Vous avez accomplis une ligne...":LINE(116,64)-(224,64),2
- 50070 FOR B=20 TO 1 STEP -1:TY%(B)=TY%(B-1):FOR A=1 TO 40:TSM%(A,B)=TSM%(A,B-1):NEXT A,B:SC=SC+100:TVACHE=TVACHE+1:PUT(0,0),TX%,PSET:IF C<20 THEN 50031 ELSE 5020
- 50080 IF A$="P"OR A$="p"THEN 50110
- 50090 IF A$=CHR$(27)THEN SCREEN 0:WIDTH 80:CLS:END ELSE IF TVACHE=5 THEN TE=60 ELSE IF TVACHE=10 THEN TE=40 ELSE IF TVACHE=15 THEN TE=20 ELSE IF TVACHE=20 THEN TE=0 ELSE IF TVACHE=25 THEN 50150
- 50100 RETURN
- 50110 GET(0,0)-(319,199),TX%:LINE(8,48)-(312,88),0,BF:LINE(8,48)-(312,88),3,B:LOCATE 8,17:PRINT"PAUSE :":LOCATE 10,3:PRINT"Presse une touche pour continuer...":LINE(124,64)-(184,64),2
- 50120 A$=INKEY$:IF A$=""THEN 50120 ELSE PUT(0,0),TX%,PSET:RETURN
- 50130 LINE(8,48)-(312,104),0,BF:LINE(8,48)-(312,104),3,B:LOCATE 8,17:PRINT"TA PERDU!":LOCATE 10,3:PRINT"Avec un pointage minable de"SC:LOCATE 11,3:PRINT"HA! HA! HA! Tu aurrais pu gagner":LOCATE 12,3:PRINT"pauvre fou!":LINE(124,64)-(200,64),2
- 50140 A$=INKEY$:IF A$=""THEN 50140 ELSE SCREEN 0:WIDTH 80:COLOR 7,0,0:CLS:END
- 50150 GET(0,0)-(319,199),TX%:RESTORE 60010
- 50160 IF D1=-1 THEN 50170 ELSE READ D1,D2,D3,D4:LINE(D1,D2)-(D3,D4),0,BF:LINE(D1,D2)-(D3,D4),2,B:GOTO 50160
- 50170 FOR A=0 TO 40:COLOR 4:FOR B=0 TO 100:NEXT:COLOR 16,1:FOR B=0 TO 100:NEXT B,A:LINE(48,112)-(231,167),0,BF:LINE(48,112)-(231,167),3,B:LOCATE 16,8:PRINT"TU AS GAGNER MISERABLE,JE":LOCATE 17,8:PRINT"ME REND TU EST PLUS"
- 50180 LOCATE 18,8:PRINT"FORT QUE MOI!":GET(49,113)-(230,166),TX%:LINE(49,113)-(230,166),2,BF:PUT(49,113),TX%,AND
- 50190 A$=INKEY$:IF A$=""THEN 50190
- 50200 SCREEN 0:WIDTH 80:CLS:END
- 60000 DATA 16,8,-26215,26214,-26215,26214,-26215,26214,-26215,26214
- 60010 DATA 48,40,55,103,56,48,63,63,64,64,71,71,72,72,79,87,80,88,87,95,88,40,95,103,128,40,135,47,120,48,127,55,112,56,119,63,104,64,111,79,112,80,119,87,120,88,127,95,128,96,135,103,136,88,143,95,144,80,151,87,152,64,159,79,144,56,151,63,-1,,,,,,
- 60020 DATA" TETRIS A ETE INVENTEE PAR UN ETUDIANT"
- 60025 DATA"DU CENTRE DE RECHERCHE SOVIETIQUE"
- 60030 DATA"IL SE NOMMAIT ALEXI PASZINOV, IL ETAIT"
- 60040 DATA"AGE DE 30 ANS ET IL FAISAIT LE TRAVAIL"
- 60060 DATA"COURANT AU CENTRE D'ORDINATEUR ACADEMY"
- 60066 DATA"SOFT DANS LE COMPLEXE DE L'ACADEMY DES"
- 60067 DATA"SIENTIFIQUE DE MOSCOU."
- 60068 DATA" "
- 60100 DATA"LE PROGRAMEUR ORIGINAL ETAIT AGE DE "
- 60105 DATA"18 ANS,IL SE NOMMAIT VAGIN MERASIMOV,"
- 60120 DATA"IL ETAIT ETUDIANT EN INFORMATIQUE A"
- 60125 DATA"L'UNIVERSITE DE MOSCOU."
- 60126 DATA" "
- 60160 DATA"MAINTENANT VOUS POUVEZ JOUER A"
- 60166 DATA"TETRIS PARCE-QUE LES EFFORTS"
- 60180 DATA"CONJOINTS DE L'ACADEMY SOFT , MOSCOU"
- 60185 DATA",ANDROMEDA SOFTWARE LTEE. LONDON ET",-1
Dernière mise à jour : Samedi, le 24 janvier 2015