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*&A*&A*&A*&A*&A*&A%-I0JJXXH%-8I4*XXH%-JI.*XXH%-I4JJXXH%-HI:H%-H@%-XP!##
5 REM ########################%-8**XXX*&A*&A*&A*&A*&A*&A*&A*&A%-I0JJXXH%-JI7*8*H%-8I.*XXH%-I4JJXXH%-HI:H%-H@PG
6 REM %-8IL*XX*&V*&V*&V*&V*&V*&V*&V*&V%-I8JJXX*&W*&W*&W*&W*&W*&W*&W*&W%-X%-QV**0D*0W**&Z*&Z*&Z*&ZX%-QV*****&Z*&Z*&Z*&Z%-EZXXXXX%-I4JJXXH%-I*XXXXH%-H@%-I(JJXXH%-JIR*XXH%-H@%-I0JJXXH%-8I9*8*H%-H@
7 REM D@JEBEDHJDAINJHDBEB@BBOLJBOOHF@INHJDAJKABHBIO@O@@FLHLDAKM@OENHHJHF@HJDAJIID@@BLHLDAKM@OHJEAIHEBEB@BBOLJEBHHEBJJEBIHEBKLFBEB@BBOLJDAJKABHBE@IHE@FAABJO@BOKABJKND@@BM@AJBIO@M@@GJI@AIID@@BM@NNKABJBI@OM@AGKABJDJDJDJDJIID@@B@F@FBJ@F@FBJ@FP
8 REM @FBJ@F@FBJIABJLHLDAKM@LBJEBEM@@BHE@ILIOOM@JIFHHEBEDLBBOL@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@JIEHHMBI@MHMFL@LHMDB@MHMEK@MHMEL@MHMEM@MHMEN@MHMEO@MF@0
9 CALL 2107
10 GOSUB 3000
20 LV = 1
50 GOSUB 3100
60 POKE KS,0

100 REM SUB MAIN LOOP
    105 ON M + 1 GOSUB 400,500,900,700,800
    110 COLOR= 0: PLOT CX,CY
    115 CALL 641: REM SCROLL
    120 IF PEEK(8) > 0 THEN GOSUB 300
    125 IF SCRN(CX,CY) = 0 THEN 140
    130 IF SCRN(CX,CY + 1) < > 0 THEN 2000
    135 CY = CY + 1
    140 GOSUB 200
    145 COLOR= 15: PLOT CX,CY
    150 GOTO 100

200 REM SUB KEYBOARD PROCESSING
    205 K = PEEK(KB)
    210 IF K < 200 THEN RETURN
    215 POKE KS,0
    220 ON K - 200 GOTO 240,250,260,260,270
    225 IF K = 222 THEN 3700: REM ^ TO SKIP LVL
    230 RETURN
    240 IF SCRN(CX,CY - 1) = 0 AND CY > 1 THEN CY = CY - 1
    245 RETURN
    250 IF SCRN(CX - 1,CY) = 0 THEN CX = CX - 1
    255 RETURN
    260 IF SCRN(CX + 1,CY) = 0 THEN CX = CX + 1
    265 RETURN
    270 IF SCRN(CX,CY + 1) = 0 THEN CY = CY + 1
    272 IF SCRN(CX,CY + 1) = 0 THEN CY = CY + 1
    275 RETURN

300 REM SUB ROW CLEARED
    310 RC = RC + 1: IF RC < 3 THEN RETURN
    320 RC = 0:HB = HB + 1
    330 RD = RD + 1
    340 GOSUB 370
    350 IF RD >= RG THEN GOSUB 3300
    360 RETURN

370 REM SUB PRINT NUM CLEARED
    380 VTAB 22: HTAB 13
    385 PRINT "CLEARED ";RD;"/";RG
    390 RETURN

400 REM SUB PICK X COORD
    405 IF X < 0 THEN X = INT((CX - OX) / 2) + 1
    410 IF X < 1 THEN X = - 9: RETURN
    415 IF X > W THEN X = - 9: RETURN
    420 GOTO 435
    425 X = X + 1: IF X > W THEN X = 1
    430 GOTO 445
    435 IF X > 1 AND H(X - 1) < H(X) THEN X = X - 1: GOTO 445
    440 IF X < W AND H(X + 1) < H(X) THEN X = X + 1
    445 IF H(X) - HB < MH THEN M = M + 1
    450 RETURN

500 REM SUB CALC SHAPE CONSTRAINTS
    510 H0 = H(X)
    520 HL = H(X - 1) - H0
    530 HR = H(X + 1) - H0
    540 IF HR > 3 THEN HR = 3
    550 IF HR < 0 THEN HR = 3
    560 IF HL > 3 THEN HL = 3
    570 IF HL < 0 THEN HL = 3
    580 M = M + 1: RETURN

700 REM SUB APPLY CHOSEN COORD
    705 H(X - 1) = H(X - 1) + BL
    710 H(X) = H(X) + B0
    715 H(X + 1) = H(X + 1) + BR
    720 REM SUB SHAPE PREP
    730 SX =(X - 1) * 2 + OX
    735 IF BL = 0 THEN SL = 0: GOTO 745
    740 BL = BL * 3:SL = HL * 3
    745 IF BR = 0 THEN 755
    750 BR = BR * 3:SR = HR * 3
    755 B0 = B0 * 3
    760 M = M + 1: RETURN

800 REM SUB PLOT A LINE
    805 COLOR= CC(CI)
    810 IF BL = 0 THEN 835
    815 IF SL > 0 THEN SL = SL - 1: GOTO 835
    820 BL = BL - 1
    825 HLIN SX - 2,SX - 1 AT 0
    830 IF SL < > 0 THEN STOP
    835 IF B0 = 0 THEN 850
    840 B0 = B0 - 1
    845 HLIN SX,SX + 1 AT 0
    850 IF BR = 0 THEN 870
    855 IF SR > 0 THEN SR = SR - 1: GOTO 870
    860 BR = BR - 1
    865 HLIN SX + 2,SX + 3 AT 0
    870 IF BL + B0 + BR = 0 THEN X = - 99:M = 0
    875 RETURN

900 REM SUB CHOOSE SHAPE
    910 M = M + 1
    920 ON HL * 4 + HR + 1 GOTO 1000,1010,1020,1030,1040,1050,1060,1070,1080,1090,1100,1110,1120,1130,1140,1150
    930 STOP : REM IMPOSSIBLE

    1000 REM 000
    1001 ON RND(1) * 4 + 1 GOTO 1200,1300,1530,1620
    1010 REM 001
    1011 GOTO 1440
    1020 REM 002
    1021 GOTO 1325
    1030 REM 003
    1031 ON RND(1) * 3 + 1 GOTO 1250,1375,1400
    1040 REM 100
    1041 GOTO 1485
    1050 REM 101
    1051 GOTO 1575
    1060 REM 102
    1061 ON RND(1) * 2 + 1 GOTO 1460,1595
    1070 REM 103
    1071 ON RND(1) * 2 + 1 GOTO 1460,1595
    1080 REM 200
    1081 GOTO 1225
    1090 REM 201
    1091 GOTO 1225
    1100 REM 202
    1101 ON RND(1) * 2 + 1 GOTO 1225,1325
    1110 REM 203
    1111 GOTO 1225
    1120 REM 300
    1121 ON RND(1) * 3 + 1 GOTO 1275,1350,1420
    1130 REM 301
    1131 ON RND(1) * 2 + 1 GOTO 1505,1550
    1140 REM 302
    1141 GOTO 1325
    1150 REM 303
    1151 GOTO 1635
    1200 REM ---
    1205 REM --X
    1210 REM XXX
    1215 CI = 1
    1220 BL = 1:B0 = 1:BR = 2: RETURN
    1225 REM XX-
    1230 REM -X-
    1235 REM -X-
    1240 CI = 1
    1245 BL = 1:B0 = 3:BR = 0: RETURN
    1250 REM X--
    1255 REM X--
    1260 REM XX-
    1265 CI = 1
    1270 BL = 3:B0 = 1:BR = 0: RETURN
    1275 REM -X-
    1280 REM -X-
    1285 REM -XX
    1290 CI = 1
    1295 BL = 0:B0 = 3:BR = 1: RETURN
    1300 REM ---
    1305 REM X--
    1310 REM XXX
    1315 CI = 2
    1320 BL = 2:B0 = 1:BR = 1: RETURN
    1325 REM -XX
    1330 REM -X-
    1335 REM -X-
    1340 CI = 2
    1345 BL = 0:B0 = 3:BR = 1: RETURN
    1350 REM --X
    1355 REM --X
    1360 REM -XX
    1365 CI = 2
    1370 BL = 0:B0 = 1:BR = 3: RETURN
    1375 REM -X-
    1380 REM -X-
    1385 REM XX-
    1390 CI = 2
    1395 BL = 1:B0 = 3:BR = 0: RETURN
    1400 REM XX-
    1405 REM XX-
    1410 CI = 3
    1415 BL = 2:B0 = 2:BR = 0: RETURN
    1420 REM -XX
    1425 REM -XX
    1430 CI = 3
    1435 BL = 0:B0 = 2:BR = 2: RETURN
    1440 REM -XX
    1445 REM XX-
    1450 CI = 4
    1455 BL = 1:B0 = 2:BR = 1: RETURN
    1460 REM X--
    1465 REM XX-
    1470 REM -X-
    1475 CI = 4
    1480 BL = 2:B0 = 2:BR = 0: RETURN
    1485 REM XX-
    1490 REM -XX
    1495 CI = 5
    1500 BL = 1:B0 = 2:BR = 1: RETURN
    1505 REM --X
    1510 REM -XX
    1515 REM -X-
    1520 CI = 5
    1525 BL = 0:B0 = 2:BR = 2: RETURN
    1530 REM -X-
    1535 REM XXX
    1540 CI = 6
    1545 BL = 1:B0 = 2:BR = 1: RETURN
    1550 REM -X-
    1555 REM -XX
    1560 REM -X-
    1565 CI = 6
    1570 BL = 0:B0 = 3:BR = 1: RETURN
    1575 REM XXX
    1580 REM -X-
    1585 CI = 6
    1590 BL = 1:B0 = 2:BR = 1: RETURN
    1595 REM -X-
    1600 REM XX-
    1605 REM -X-
    1610 CI = 6
    1615 BL = 1:B0 = 3:BR = 0: RETURN
    1620 REM HORZ XXX
    1625 CI = 7
    1630 BL = 1:B0 = 1:BR = 1: RETURN
    1635 REM VERT XXX
    1640 CI = 7
    1645 BL = 0:B0 = 3:BR = 0: RETURN

2000 REM SUB GOTCHA
    2002 HOME
    2005 VTAB 21: HTAB 17: PRINT "OOPS!"
    2010 FOR N = 1 TO 4
    2015 COLOR= 1: PLOT CX,CY
    2020 FOR I = 1 TO 500: NEXT
    2025 COLOR= 0: PLOT CX,CY
    2030 FOR I = 1 TO 500: NEXT
    2035 NEXT N
    2040 VTAB 23: HTAB 2: PRINT "R)ESTART LEVEL, N)EW GAME, OR Q)UIT";: INPUT A$
    2050 IF A$ = "R" THEN 3400
    2060 IF A$ = "N" THEN 20
    2070 IF A$ = "Q" THEN TEXT : HOME : PRINT "BYE NOW.": PRINT : END
    2080 GOTO 2040

3000 REM SUB FIRST TIME INIT
    3010 DIM H(22)
    3020 CC(1) = 1:CC(2) = 2:CC(3) = 3:CC(4) = 11:CC(5) = 9:CC(6) = 13:CC(7) = 12
    3025 KB = - 16384:KS = - 16368
    3030 RETURN

3100 REM SUB LEVEL INIT
    3105 W = 15 - LV:H = 20 - LV:MH = H - 1
    3110 OX =(40 - W * 2) / 2
    3115 POKE 25,H - 1: POKE 26,OX: POKE 27,40 - OX
    3120 IF LV = 1 THEN GOSUB 3200
    3125 M = 0:HB = 0
    3130 H(0) = - 9:H(W + 1) = - 9
    3135 FOR I = 1 TO W:H(I) = 0: NEXT
    3140 X = - 99
    3145 CX = OX + W:CY = H * 2 - 1
    3150 RG = 5 + LV * 2:RD = 0:RC = 0
    3155 HOME
    3160 VTAB 21: HTAB 16: PRINT "LEVEL ";LV
    3170 GOSUB 370
    3180 RETURN

3200 REM SUB DRAW FIRST LVL BORDERS
    3202 GR : HOME
    3205 COLOR= 5: VLIN 0,H * 2 + 1 AT OX - 1: VLIN 0,H * 2 + 1 AT 40 - OX
    3210 GOSUB 3250: RETURN

3250 REM SUB GENERAL LEVEL BORDERS
    3210 COLOR= 4: HLIN OX,39 - OX AT H * 2: HLIN OX,39 - OX AT H * 2 + 1
    3215 COLOR= 5: FOR I = OX TO 38 - OX STEP 2: PLOT I,H * 2: PLOT I + 1,H * 2 + 1: NEXT
    3220 RETURN

3300 REM SUB LEVEL UP!
    3310 RESTORE
    3320 FOR I = 1 TO LV: READ A$: NEXT
    3330 VTAB 24: HTAB 20 - LEN(A$) / 2: INVERSE : PRINT A$;: NORMAL
    3340 GOSUB 3600
    3350 LV = LV + 1: GOSUB 3100
    3352 IF LV = 11 THEN 3500
    3355 GOSUB 3250
    3360 COLOR= 5: VLIN 0,H * 2 + 2 AT OX - 1: VLIN 0,H * 2 + 2 AT 40 - OX
    3365 COLOR= 0: VLIN 0,H * 2 + 1 AT OX - 2: VLIN 0,H * 2 + 1 AT 41 - OX
    3370 RETURN
    3380 DATA "GREAT JOB!","AWESOME DUDE.","GOOD GOING...","STELLAR!"
    3385 DATA "TETRIS SCHMETRIS","INCREDIBLE!","MUCHO GONZO!"
    3390 DATA "ALL THE WAY TO THE TOP","ONE MORE LEFT...","WOW! YOU DID IT! YOU WON!"

3400 REM SUB RESTART LEVEL
    3410 FOR Y = 0 TO H * 2 - 1: HLIN OX,39 - OX AT Y: NEXT Y
    3420 GOTO 50

3500 REM SUB ULTIMATE WIN
    3510 TEXT : HOME
    3520 PRINT "CONGRATULATIONS!!!"
    3530 PRINT : PRINT "THANKS FOR PLAYING STRUCTRIS."
    3540 PRINT : END

3600 REM SUB COOLER CLEAR
    3602 T = 0
    3605 FOR I = 1 TO W: IF H(I) > T THEN T = H(I)
    3608 NEXT
    3609 COLOR= 15
    3610 FOR I = 1 TO H * 2
    3620 HLIN OX,39 - OX AT H * 2 - 1
    3630 CALL 641
    3640 NEXT I
    3650 RETURN

3700 REM SUB SKIP LEVEL
    3710 IF M > 2 THEN RETURN
    3720 RD = RG - 1:RC = 2: GOTO 300
    3730 RETURN
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.