03 – Puzzle
Apparso da pagina 17 fino a pagina 23 de “Il libro dei giochi del Commodore 64”
Il listato pubblicato
Il programma
Il nostro listato digitato
Qui di seguito trovate il codice da copiare sul programma CBM prg Studio Il codice originale é stato modificato affinchè possa essere letto da CBM prg Studio. I caratteri speciali PETSCII (Screen Codes) presenti nel listato originale, sono stati singolarmente sostituiti da quelli standard utilizzati da CBM prg Studio. Attenzione – Grazie alla segnalazione di più utenti, i caratteri “<” e “>” potrebbero venir sostituiti dai rispettivi encoding html “<” e “>” . Qualora li trovaste, sostituite manualmente questi valori direttamente su CBM prg Studio, altrimenti il programma non funzionerà. Scusate per l’inconveniente tecnico.
10 rem** puzzle **
20 print"{clear}":g=1024:h=55296:s=54272:poke53280,6:poke53281,10
30 forj=0to25:pokes+j,0:next:pokes+24,15:pokes+6,240:poke649,1
40 forp=1to9
50 n=int(rnd(1)*9)+1:f=0
60 forj=1to9
70 iff(j,0)=nthenf=1
80 next
90 iff=1then50
100 f(p,0)=n
110 gosub900
120 q=int(rnd(1)*2)+1:f(p,1)=q
130 ifn=1then150
140 forj=1to48*(n-1):readx:next
150 onqgosub1000,2000
160 restore
170 next
180 forj=0to2
190 fork=0to2
200 pokeg+287+9*k+320*j,49+k+3*j:pokeh+287+9*k+320*j,1
210 next:next
220 ff=1:forn=1to9
230 iff(n,0)<>norf(n,1)<>1thenff=0
240 next
250 ifff=1then460
260 restore:gosub3000
270 geta$:ifa$=""then270
280 p=val(a$):ifp<1orp>9then220
290 restore:gosub3000
300 gosub3010
310 restore
320 geta$:ifa$=""then320
330 r=val(a$):restore
340 ifr=0then400
350 pt=f(p,0):qt=f(p,1)
360 f(p,0)=f(r,0):f(p,1)=f(r,1)
370 f(r,0)=pt:f(r,1)=qt
380 gosub3500
390 p=r:gosub3500:goto220
400 iff(p,0)=1then420
410 fork=1to(f(p,0)-1)*48:readx:next
420 iff(p,1)=1thenf(p,1)=2:goto440
430 f(p,1)=1:gosub900
440 onf(p,1)gosub1000,2000
450 goto220
460 print"{clear}":restore
470 forn=1to9
480 d=128+240*(int((n+2)/3-1))+8*(n-int((n-1)/3)*3-1)
490 gosub1000
500 next
510 forj=1to38:gosub4000:next
520 geta$:ifa$=""then520
530 restore:forj=1to432:readx:next
540 goto510
900 d=47+320*(int((p+2)/3-1))+9*(p-int((p-1)/3)*3-1)
910 return
1000 forl=dto200+dstep40
1010 form=0to7
1020 readx
1030 pokeg+l+m,160
1040 pokeh+l+m,x
1050 next:next
1060 return
2000 forl=200+dtodstep-40
2010 form=7to0step-1
2020 readx
2030 pokeg+l+m,160
2040 pokeh+l+m,x
2050 next:next
2060 return
3000 forj=1to432:readx:next
3010 forj=1to2
3020 gosub4000
3030 next
3040 return
3500 iff(p,0)=1then3540
3510 forj=1to(f(p,0)-1)*48
3520 readx
3530 next
3540 gosub900
3550 onf(p,1)gosub1000,2000
3560 restore
3570 return
4000 readlf,hf
4010 pokes,lf:pokes+1,hf
4020 readx
4030 pokes+4,17
4040 fork=1to100*x:next
4050 pokes+4,16
4060 return
5000 data6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6
5010 data6,6,6,6,6,7,7,7,6,6,6,6,7,7,7,7,6,7,6,7,7,0,7,7
5020 data6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,6,6,6,6,6,6,6,1
5030 data7,6,6,6,6,6,6,1,7,7,6,6,6,6,6,6,0,7,7,6,6,6,6,6
5040 data6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,1,1,6,6,6,6,6
5050 data1,1,1,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,1,6,6,6,6,6
5060 data6,3,6,7,7,1,7,7,6,3,6,7,7,7,7,7,6,6,3,7,7,7,7,7
5070 data6,6,6,4,4,4,4,4,6,6,6,6,3,3,3,3,2,2,2,2,2,3,2,2
5080 data1,7,7,6,6,6,6,6,7,7,7,6,6,6,6,6,7,7,7,6,6,6,6,6
5090 data4,4,4,3,3,6,6,6,3,3,6,6,6,3,6,6,3,2,2,2,2,7,2,2
5100 data6,6,1,1,1,1,6,6,6,6,1,1,1,1,6,6,6,6,6,6,6,6,6,6
5110 data6,6,6,6,8,6,6,6,6,6,6,8,7,8,6,6,2,2,2,2,8,2,2,2
5120 data2,2,2,2,2,3,2,2,2,2,2,2,2,3,2,2,2,2,2,2,9,9,2,2
5130 data5,2,2,2,2,2,2,2,5,5,2,5,2,2,5,2,5,5,5,5,5,5,5,5
5140 data3,2,2,2,2,2,2,2,3,2,2,2,2,2,2,2,9,9,2,2,2,2,2,2
5150 data2,2,2,2,2,2,5,2,2,2,2,5,5,2,5,2,5,5,5,5,5,5,5,5
5160 data2,2,2,2,5,2,8,2,2,2,8,2,5,8,7,8,2,8,7,8,5,2,8,2
5170 data2,2,8,2,5,2,2,2,5,2,2,2,5,2,5,2,5,5,5,5,5,5,5,5
6000 data195,16,4,31,21,2,209,18,4,96,22,2,31,21,2,30,25,2,165,31,2,135,33,6
6010 data31,21,4,30,25,2,96,22,4,49,28,2,30,25,2,31,21,2,195,16,2,209,18,6
6020 data31,21,2,96,22,2,30,25,2,96,22,2,30,25,2,49,28,2,30,25,2,49,28,2
6030 data165,31,2,135,33,4,135,33,1,162,37,1,62,42,2,135,33,2,135,33,2
6040 data193,44,2,193,44,2,62,42,2,162,37,2,135,33,2,165,31,2,135,33,6
Il file .PRG del listato
Provalo direttamente sull’emulatore! Clicca sul pulsante per avviare!
Downloading…