15 – Ferrovia
Apparso da pagina 97 fino a pagina 104 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 **ferrovia**
20 g=1024:h=55296:s=54272:c=53280
30 s$(0)="ayr":s$(1)="burnley":s$(2)="cardiff"
40 s$(3)="derby":s$(4)="everton":s$(5)="falkirk":s$(6)="grimsby"
50 s$(7)="halifax":s$(8)="ipswich"
60 deffnr(x)=int(rnd(1)*(x-1))
70 pokec,6:poke53281,7:gosub3000
80 print"{clear}{blue}":input"quanti giocatori";p$
90 p=val(p$):ifp<2orp>4then40
100 dimd%(3,3),p%(3,10),s%(1,8):fork=0to3:forj=0to3:readd%(j,k):next:next
110 forj=0to8
120 s%(0,j)=82+int(j/3)*280+(j-int(j/3)*3)*13+fnr(9)+fnr(5)*40
130 next
140 forj=0top-1
150 p%(j,0)=fnr(8):ifs%(1,p%(j,0))=4then150
160 s%(1,p%(j,0))=s%(1,p%(j,0))+1
170 p%(j,1)=fnr(8):ifs%(1,p%(j,1))=4then170
180 ifp%(j,1)=p%(j,0)then170
190 s%(1,p%(j,1))=s%(1,p%(j,1))+2
200 p%(j,2)=fnr(8):ifs%(1,p%(j,2))=4then200
210 ifp%(j,2)=p%(j,1)orp%(j,2)=p%(j,0)then200
220 s%(1,p%(j,2))=s%(1,p%(j,2))+1
230 p%(j,3)=s%(0,p%(j,0))
240 p%(j,10)=160
250 next
260 print"{clear}percorsi:{down*2}"
270 forj=0top-1
280 print"{blue}";j+1;tab(8)"{red}da";tab(18)"{blue}via";tab(28)"{red}a{down}"
290 print"{red}";tab(8)s$(p%(j,0));"{blue}";tab(18)s$(p%(j,1));"{red}";
300 printtab(28)s$(p%(j,2));"{down*2}"
310 next
320 geta$:ifa$=""then320
330 print"{clear}":pokec,0:poke53281,15
340 forj=0to8:pokeh+s%(0,j),j+4::pokeg+s%(0,j),160:next
350 gosub2000:pn=-1
360 pn=pn+1
370 ifpn=pthenpn=0
380 pokec,pn*2:gosub3500
390 ifp%(pn,7)=1then1000
400 geta$:ifa$=""then400
410 ifa$="u"thend=0:goto470
420 ifa$="j"thend=1:goto470
430 ifa$="n"thend=2:goto470
440 ifa$="h"thend=3:goto470
450 ifa$="{arrow left}"then800
460 goto400
470 el=p%(pn,3):cd=p%(pn,4):ifpeek(g+el)=160thencd=d
480 np=d%(cd,d):ifnp=0then400
490 ifcd=0thennl=el-40
500 ifcd=1thennl=el+1
510 ifcd=2thennl=el+40
520 ifcd=3thennl=el-1
540 ifpeek(g+nl)=160then640
550 ifpeek(g+nl)=93andnp=64orpeek(g+nl)=64andnp=93thennp=91:goto570
560 ifpeek(g+nl)<>32then630
570 pokeh+nl,pn*2:pokeg+nl,np
580 ifnp=91thensc=-10:gosub2000
590 ifnp=93ornp=64thensc=1:gosub2000
600 ifel=s%(0,p%(pn,0))thenp%(pn,8)=d
610 ifel=s%(0,p%(pn,1))thenp%(pn,9)=d
620 p%(pn,3)=nl:p%(pn,4)=d
630 goto360
640 ifnl=s%(0,p%(pn,1))andp%(pn,6)=0thenp%(pn,6)=1:sc=10:gosub2000
650 ifnl=s%(0,p%(pn,2))andp%(pn,6)=1andp%(pn,7)=0then670
660 goto620
670 p%(pn,7)=1:p%(pn,3)=s%(0,p%(pn,0)):sc=20:gosub2000
680 goto360
800 el=p%(pn,3):ifpeek(g+el)=160then360
810 ifpeek(g+el)=91then930
820 forj=0to3
830 ifd%(j,p%(pn,4))=peek(g+el)thend=j
840 next
850 p%(pn,4)=d
860 pokeg+el,32:pokeh+el,1
870 ifd=0thenpl=el+40
880 ifd=1thenpl=el-1
890 ifd=2thenpl=el-40
900 ifd=3thenpl=el+1
910 p%(pn,3)=pl:sc=-10:gosub2000
920 goto360
930 d=p%(pn,4)
940 ifd=1ord=3thenpokeg+el,93:pokeh+el,peek(h+el-40)
950 ifd=0ord=2thenpokeg+el,64:pokeh+el,peek(h+el-1)
960 goto870
1000 rn=fnr(3)+1:sc=0:gosub2000
1010 forj=1torn
1020 d=p%(pn,8):el=p%(pn,3)
1030 ifel=s%(0,p%(pn,1))thend=p%(pn,9)
1040 ifd=0thennl=el-40
1050 ifd=1thennl=el+1
1060 ifd=2thennl=el+40
1070 ifd=3thennl=el-1
1080 np=peek(g+nl):ifnp=81then1200
1090 ifp%(pn,10)<>160thenpokeg+el,p%(pn,10)
1100 ifnp<>160thenpokeg+nl,81
1110 ifnl=s%(0,p%(pn,2))andp%(pn,6)=0then1300
1120 p%(pn,6)=0:fork=0to3
1130 ifd%(d,k)=npthenp%(pn,8)=k
1140 next
1150 p%(pn,3)=nl:p%(pn,10)=np
1160 gosub4000
1170 next
1180 goto360
1200 print"{home}{down*3}scontro di treni"
1210 goto1210
1300 print"{home}{down*3} il 1' treno e' arrivato!"
1310 sc=5:gosub2000
1320 goto1320
2000 p%(pn,5)=p%(pn,5)+sc
2010 print"{home}";spc(255);spc(255);spc(255);spc(195)
2020 printtab(2)"{black}";p%(0,5);tab(8);"{red}";p%(1,5);tab(14)"{purple}";p%(2,5);
2030 printtab(22)"{blue}";p%(3,5);tab(35)"";rn;
2040 return
3000 forz=0to24:pokes+z,0:next:return
3500 gosub3000
3510 pokes+5,46:pokes+6,0:pokes+24,15
3520 pokes,96:pokes+1,51:pokes+4,17
3530 pokes+12,41:pokes+13,39
3540 pokes+7,96:pokes+8,51:pokes+11,129
3550 forz=1to200:next
3560 pokes+4,16:pokes+11,128
3570 forz=1to200:next
3580 pokes+4,17:pokes+11,129
3590 forz=1to800:next
3600 gosub3000
3610 return
4000 gosub3000
4010 pokes+5,132:pokes+6,128:pokes+24,15
4020 pokes,114:pokes+1,11:pokes+4,129
4030 forz=1to100:next
4040 pokes+1,205
4050 forz=1to200:next
4060 gosub3000
4070 return
5000 data93,75,0,74,85,64,74,0,0,73,93,85,73,0,75,64
Il file .PRG del listato
Provalo direttamente sull’emulatore! Clicca sul pulsante per avviare!
Downloading…