Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $regex = '/^(?<linenumber>[0-9]{3,4}) DIM (?<graphic>[A-Z]{2})\((?<width>[0-9]+),(?<height>[0-9]+)\)\n[0-9]{3,4} OPEN"(?<filename>[.a-z0-9]+)" FOR INPUT AS (?<filemode>[[0-9]+)\n[0-9]{3,4} FOR (?<outerloop>[A-Z]+)=(?<outerlow>[0-9]+) TO (?&height):FOR (?<innerloop>[A-Z]+)=(?<innerlow>[0-9]+) TO (?&width)\n[0-9]{3,4} INPUT #(?&filemode),(?<pixvar>[A-Z]+):PSET\((?&innerloop),(?&outerloop)\),(?&pixvar)\n[0-9]{3,4} NEXT (?&innerloop):NEXT (?&outerloop)\n[0-9]{3,4} CLOSE (?&filemode)\n[0-9]{3,4} GET\((?&innerlow),(?&outerlow)\)-\((?&width),(?&height)\),(?&graphic)\n[0-9]{3,4} CLS$(*SKIP)(*F)|.+\n/m';
- $subject = '10 KEY OFF:SCREEN 7,0,1,0:VIEW PRINT 1 TO 25:COLOR 15,0,0:CLS:MAP=2:X=8:Y=1
- 20 GOSUB 2000:CLS:PCOPY 1,2:DIM MAP(15,7)
- 100 C$=INKEY$:XM$="":YM$="":IF C$="" THEN C$=" "
- 105 IF C$=CHR$(27) THEN 10000
- 106 IF C$=CHR$(13) THEN 10000
- 108 XX=X:YY=Y
- 110 IF INSTR("123",C$)>0 THEN Y=Y+1
- 120 IF INSTR("789",C$)>0 THEN Y=Y-1
- 130 IF INSTR("369",C$)>0 THEN X=X+1
- 140 IF INSTR("147",C$)>0 THEN X=X-1
- 150 IF X<0 THEN X=0 ELSE IF X>319 THEN X=319
- 160 IF Y<0 THEN Y=0 ELSE IF Y>199 THEN Y=199
- 190 \'
- 195 \'IF TIMER-START>1 THEN START=TIMER:GS=1-GS:\'doors
- 196 IF TIMER-START2>.2 THEN START2=TIMER:GC=(GC MOD 4)+1:\'dereck
- 197 IF TIMER-START3>.5 THEN START3=TIMER:GY=1-GY:\'people
- 1000 \'
- 1010 PCOPY 2,1
- 1020 FOR TT=1 TO 7:FOR T=1 TO 15
- 1030 MAP(T,TT)=POINT(X+(T-8),Y+(TT-4))
- 1040 NEXT T:NEXT TT
- 1050 LINE(0,0)-(319,199),0,BF
- 1060 FOR TT=1 TO 7:FOR T=1 TO 15
- 1065 IF MAP(T,TT)=1 THEN PUT((T-1)*16,(TT-1)*16),GA
- 1070 IF MAP(T,TT)=2 AND (T=8 AND TT=3) THEN PUT((T-1)*16,(TT-1)*16),GB
- 1075 IF MAP(T,TT)=2 AND (T<>8 OR TT<>3) THEN PUT((T-1)*16,(TT-1)*16),GC
- 1080 IF MAP(T,TT)=3 THEN PUT((T-1)*16,(TT-1)*16),GD
- 1090 IF MAP(T,TT)=4 THEN PUT((T-1)*16,(TT-1)*16),GG
- 1096 IF MAP(T,TT)=5 THEN PUT((T-1)*16,(TT-1)*16),GH
- 1098 IF MAP(T,TT)=7 AND GY=0 THEN PUT((T-1)*16,(TT-1)*16),GE
- 1099 IF MAP(T,TT)=7 AND GY=1 THEN PUT((T-1)*16,(TT-1)*16),GF
- 1100 IF MAP(T,TT)=8 AND (GC=2 OR GC=4) THEN PUT((T-1)*16,(TT-1)*16),GI
- 1101 IF MAP(T,TT)=8 AND GC=1 THEN PUT((T-1)*16,(TT-1)*16),GJ
- 1102 IF MAP(T,TT)=8 AND GC=3 THEN PUT((T-1)*16,(TT-1)*16),GK
- 1109 NEXT T:NEXT TT
- 1110 GOSUB 5000
- 1111 PCOPY 1,0
- 1115 IF TIMER-DOORC=>2 AND DOORC<>0 THEN 10000
- 1120 GOTO 100
- 2000 \'
- 2010 DIM GA(16,16)
- 2015 OPEN"brick04.mem" FOR INPUT AS 1
- 2020 FOR TT=1 TO 16:FOR T=1 TO 16
- 2030 INPUT #1,R:PSET(T,TT),R
- 2040 NEXT T:NEXT TT
- 2045 CLOSE 1
- 2050 GET(1,1)-(16,16),GA
- 2051 CLS
- 2110 DIM GB(16,16)
- 2115 OPEN"door01.mem" FOR INPUT AS 1
- 2120 FOR TT=1 TO 16:FOR T=1 TO 16
- 2130 INPUT #1,R:PSET(T,TT),R
- 2140 NEXT T:NEXT TT
- 2145 CLOSE 1
- 2150 GET(1,1)-(16,16),GB
- 2151 CLS
- 2210 DIM GC(16,16)
- 2215 OPEN"door02.mem" FOR INPUT AS 1
- 2220 FOR TT=1 TO 16:FOR T=1 TO 16
- 2230 INPUT #1,R:PSET(T,TT),R
- 2240 NEXT T:NEXT TT
- 2245 CLOSE 1
- 2250 GET(1,1)-(16,16),GC
- 2251 CLS
- 2310 DIM GD(16,16)
- 2315 OPEN"tile01.mem" FOR INPUT AS 1
- 2320 FOR TT=1 TO 16:FOR T=1 TO 16
- 2330 INPUT #1,R:PSET(T,TT),R
- 2340 NEXT T:NEXT TT
- 2345 CLOSE 1
- 2350 GET(1,1)-(16,16),GD
- 2351 CLS
- 2410 DIM GE(16,16)
- 2415 OPEN"caveman1.mem" FOR INPUT AS 1
- 2420 FOR TT=1 TO 16:FOR T=1 TO 16
- 2430 INPUT #1,R:PSET(T,TT),R
- 2440 NEXT T:NEXT TT
- 2445 CLOSE 1
- 2450 GET(1,1)-(16,16),GE
- 2451 CLS
- 2510 DIM GR(16,16)
- 2515 OPEN"phillip1.mem" FOR INPUT AS 1
- 2520 FOR TT=1 TO 16:FOR T=1 TO 16
- 2530 INPUT #1,R:PSET(T,TT),R
- 2540 NEXT T:NEXT TT
- 2545 CLOSE 1
- 2550 GET(1,1)-(16,16),GR
- 2551 CLS
- 2610 DIM GS(16,16)
- 2615 OPEN"phillip2.mem" FOR INPUT AS 1
- 2620 FOR TT=1 TO 16:FOR T=1 TO 16
- 2630 INPUT #1,R:PSET(T,TT),R
- 2640 NEXT T:NEXT TT
- 2645 CLOSE 1
- 2650 GET(1,1)-(16,16),GS
- 2651 CLS
- 2710 DIM GT(16,16)
- 2715 OPEN"phillip3.mem" FOR INPUT AS 1
- 2720 FOR TT=1 TO 16:FOR T=1 TO 16
- 2730 INPUT #1,R:PSET(T,TT),R
- 2740 NEXT T:NEXT TT
- 2745 CLOSE 1
- 2750 GET(1,1)-(16,16),GT
- 2751 CLS
- 2810 DIM GF(16,16)
- 2815 OPEN"caveman2.mem" FOR INPUT AS 1
- 2820 FOR TT=1 TO 16:FOR T=1 TO 16
- 2830 INPUT #1,R:PSET(T,TT),R
- 2840 NEXT T:NEXT TT
- 2845 CLOSE 1
- 2850 GET(1,1)-(16,16),GF
- 2851 CLS
- 2910 DIM GG(16,16)
- 2915 OPEN"window01.mem" FOR INPUT AS 1
- 2920 FOR TT=1 TO 16:FOR T=1 TO 16
- 2930 INPUT #1,R:PSET(T,TT),R
- 2940 NEXT T:NEXT TT
- 2945 CLOSE 1
- 2950 GET(1,1)-(16,16),GG
- 2951 CLS
- 3010 DIM GH(16,16)
- 3015 OPEN"well01.mem" FOR INPUT AS 1
- 3020 FOR TT=1 TO 16:FOR T=1 TO 16
- 3030 INPUT #1,R:PSET(T,TT),R
- 3040 NEXT T:NEXT TT
- 3045 CLOSE 1
- 3050 GET(1,1)-(16,16),GH
- 3051 CLS
- 3110 DIM GI(16,16)
- 3115 OPEN"woman01.mem" FOR INPUT AS 1
- 3120 FOR TT=1 TO 16:FOR T=1 TO 16
- 3130 INPUT #1,R:PSET(T,TT),R
- 3140 NEXT T:NEXT TT
- 3145 CLOSE 1
- 3150 GET(1,1)-(16,16),GI
- 3151 CLS
- 3210 DIM GJ(16,16)
- 3215 OPEN"woman02.mem" FOR INPUT AS 1
- 3220 FOR TT=1 TO 16:FOR T=1 TO 16
- 3230 INPUT #1,R:PSET(T,TT),R
- 3240 NEXT T:NEXT TT
- 3245 CLOSE 1
- 3250 GET(1,1)-(16,16),GJ
- 3251 CLS
- 3310 DIM GK(16,16)
- 3315 OPEN"woman03.mem" FOR INPUT AS 1
- 3320 FOR TT=1 TO 16:FOR T=1 TO 16
- 3330 INPUT #1,R:PSET(T,TT),R
- 3340 NEXT T:NEXT TT
- 3345 CLOSE 1
- 3350 GET(1,1)-(16,16),GK
- 3351 CLS
- 3915 OPEN"map004.mem" FOR INPUT AS 1
- 3920 FOR TT=1 TO 32:FOR T=1 TO 64
- 3930 INPUT #1,R:PSET(T-1,TT-1),R
- 3940 NEXT T:NEXT TT
- 3945 CLOSE 1
- 3951 CLS
- 3999 RETURN
- 5000 \'
- 5001 IF (MAP(8,4)<>0) THEN X=XX:Y=YY:RETURN 1010
- 5010 \'LOCATE 20,1:PRINT X;",";Y;
- 5020 \'LINE((8-1)*16,(4-1)*16)-(8*16,4*16),15,B
- 5030 LINE((1-1)*16,(1-1)*16)-(15*16,7*16),15,B
- 5035 IF MAP(8,3)=2 AND DOORC=0 THEN DOORC=TIMER
- 5036 IF MAP(8,3)<>2 THEN DOORC=0
- 5040 IF GC=1 OR GC=3 THEN PUT((8-1)*16,(4-1)*16),GR,OR
- 5041 IF GC=2 THEN PUT((8-1)*16,(4-1)*16),GS,OR
- 5042 IF GC=4 THEN PUT((8-1)*16,(4-1)*16),GT,OR
- 5043 IF X=2 AND Y=7 THEN LOCATE 18,1:PRINT"Woman: This is the dart shop."
- 5044 IF X=7 AND Y=4 THEN LOCATE 18,1:PRINT"Man: Welcome to Mortstown."
- 5045 IF X=10 AND Y=6 THEN LOCATE 18,1:PRINT"Man: Water from these wells is free!"
- 5046 IF X=18 AND Y=8 THEN LOCATE 18,1:PRINT"Woman: The general store\'s owner is missing."
- 5047 IF X=9 AND Y=14 THEN LOCATE 18,1:PRINT"Man: The blacksmith lives on the other side of the river."
- 5048 IF X=4 AND Y=19 THEN LOCATE 18,1:PRINT"Man: Mort, the tavern keeper, enjoys meeting new faces."
- 5049 IF X=8 AND Y=8 THEN LOCATE 18,1:PRINT"The water is very refreshing!"
- 5050 IF X=12 AND Y=16 THEN LOCATE 18,1:PRINT"The water is very refreshing!"
- 5051 IF X=16 AND Y=9 THEN LOCATE 18,1:PRINT"Lady: Welcome to Mortstown."
- 5999 RETURN
- 10000 \'
- 10010 PCOPY 0,1
- 10012 \'START=TIMER:WHILE TIMER-START<.5:WEND
- 10015 ST=5
- 10020 FOR T=0 TO 120 STEP ST:TT=TT+(.38)*ST
- 10030 LINE(0,0)-(T,199),0,BF
- 10035 LINE(120+(120-T),0)-(240,199),0,BF
- 10040 LINE(0,0)-(319,TT),0,BF
- 10045 LINE(0,56+(56-TT))-(319,112),0,BF
- 10046 LINE(T,TT)-(120+(120-T),56+(56-TT)),15,B
- 10047 LINE(240,0)-(319,199),0,BF
- 10050 PCOPY 1,0
- 10060 NEXT T
- 10061 PSET(120,56),0
- 10062 PCOPY 1,0
- 10070 \'
- 10080 IF X=5 AND Y=5 THEN CHAIN"town.bas"
- 10098 IF C$=CHR$(13) THEN TT=0:C$=" ":GOTO 105
- 10099 SCREEN 0,0,0,0:WIDTH 80:COLOR 15,1,1:CLS:END
- ';
- $substitution = '{{omitted}}';
- $result = preg_replace($regex, $substitution, $subject);
- echo "The result of the substitution is ".$result;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement