Cari Amici,
questo programma è scritto interamente in basic V2 per Commodore 64. Vi è un uso intensivo di sprites e routines di ridefinizione del set di caratteri...
Credo sia un buon esempio di programmazione che viene dal lontano 1990...
Buon divertimento!!
10 clr:print chr$(147):poke 646,1:poke53280,0:poke53281,0:poke53272,21
20 print”14 q in reverse 14 ] in reverse ATTENDERE....”
30 print “1 q in reverse 2 ] in reverse CARICAMENTO NUOVO SET DI CARATTERI”
40 poke56334,peek(56334)and254:poke1,peek(1)and251:for i=1 to 33: for j=0 to 7
50 poke12288+i*8+j,peek(12288+i*8+j):nextj:nexti
60 poke1,peek(1)or4:poke56334,peek(56334)or1
70 q1=0:q2=27:q3=28:q4=29:q5=32
80 forb=0to7 :readn :poke12288+(8*q1)+b,n :nextb
90 forb=0to7 :readn :poke12288+(8*q2)+b,n :nextb
100 forb=0to7 :readn :poke12288+(8*q3)+b,n :nextb
110 forb=0to7 :readn :poke12288+(8*q4)+b,n :nextb
120 forb=0to7 :readn :poke12288+(8*q5)+b,0 :nextb
130 data 24,28,30,31,24,255,126,60
140 data 0,56,56,24,24,255,126,60
150 data 129,66,36,24,24,36,66,129
160 data 255,129,129,129,129,129,129,255
170 fori=0to62:readd:poke320+i,d:next
180 fori=0to62:readd:poke832+i,d:next
190 fori=0to62:readd:poke896+i,d:next
200 fori=0to62:readd:poke960+i,d:next
210 fori=0to62:readd:poke15744+i,d:next
220 w1=64*247:fori=0to62:readd:pokew1+i,d:next
230 w2=64*248:fori=0to62:readd:pokew2+i,d:next
240 w3=64*249:fori=0to62:readd:pokew3+i,d:next
250 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,145,120,33,91,64
260 data 33,85,64,45,213,120,37,81,64,25,81,120,0,0,0,18,187,0,42,162,128,42
270 data 162,64,42,187,128,42,162,128,17,58,85,0,0,0,0,0,0
280 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,32,240,1,17,248,3,185,248,127
290 data 255,254,31,255,252,15,255,248,7,255,240,3,255,224,0,0,0,0,0,0,0,0,0
300 data 0,0,0,0,0,0,0,0,0,0,0,0
310 data 0,0,0,0,0,0,0,0,0,0,24,0,0,24,0,4,8,128,2,8,64,7,8,224
320 data 63,255,248,127,255,254,255,255,255,127,255,127,255,254,63,255,248
330 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
340 data 24,0,0,24,0,0,8,0,0,216,0,0,252,0,0,14,0,0,7,0,0,3,128,0
350 data 1,192,0,0,224,0,0,112,0,0,48,0,0,0,0,0,0,0,0,0,0,0,0,0
360 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
370 data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
380 data 0,0,0,0,0,0,0,0,0,0,0,24,0,0,60,0,0,126,0,0,126,0,0,60,0,0,24,0
390 data 0,0,0,0,0,0,0,16,0,0,16,0,2,24,64,3,25,192,1,223,128,0,255,128,0,255,0
400 data 0,127,240,0,255,192,3,254,0,15,255,0,0,255,128,1,237,192,1,204,96,3,12
410 data 0,2,4,0,0,4,0,0,0,0,0,0,0
420 data 0,120,0,0,120,12,48,124,24,28,126,120,31,127,240,15,255,240,15,255
430 data 224,7,255,224,7,255,248,31,255,254,127,255,255,255,255,248,255,255
440 data 224,63,255,240,7,255,248,3,255,252,7,255,254,7,255,63,15,255,15
450 data 15,222,3,31,30,0
460 data 0,0,0,0,112,0,0,56,0,0,54,64,14,0,96,15,0,224,6,28,0,0,14,0,0,128,0
470 data 97,195,12,112,193,142,224,1,199,0,24,0,0,58,0,1,24,96,7,0,112,7,128,48
480 data 0,28,16,0,28,0,0,24,0,0,0,0
490 print chr$(147):poke646,1:poke53272,21
500 print”2 q in reverse 12 ] in reverse BATTAGLIA NAVALE”
510 print”2 q in reverse 2 ] in reverse PROGRAMMA BY PASTORE CARLO © 1990”:print”2 q in reverse”
520 print”13 ] in reverse PREMI UN TASTO”:poke198,0:wait198,1:poke198,0
530 print chr$(147):poke53280,1:poke53281,1:poke646,0
540 print”2 q in reverse QUESTO E’ UN GIOCO PER 2 GIOCATORI:”
550 input”1 q in reverse MI DICI IL TUO NOME GIOCATORE 1”;a1$
560 input”1 q in reverse MI DICI IL TUO NOME GIOCATORE 1”;a2$
570 print chr$(147):poke646,1:poke53280,0:poke53281,0
580 aa=0:bb=0:pp=15:oo=15:e$=”abcdefghi”:b$=”123456789”
590 fori=1to3:z(i)=int(rnd(1)*9)+1:d(i)=int(rnd(1)*9)+1
600 d$=mid$(e$,z(i),1):q$=mid$(b$,d(I),1):s$=d$+q$:nexti
610 fori=1to3:x(i)=int(rnd(1)*9)+1:f(i)=int(rnd(1)*9)+1
620 x$=mid$(e$,x(i),1):r$=mid$(b$,f(i),1):j$(i)=x$+r$:nexti
625 if pp<=0 and pp<=0 then 8000
626 if aa=3 or pp<=0 then 3000
630 print”2 q in reverse 2 ] in reverse 1 cuore in reverse GIOCATORE 1: “;a1$
640 print”1 q in reverse POSSIBILITA’ “;pp
650 input”1 q in reverse COORDINATA NUMERICA (1-9)”;l$
655 if len(l$)>1 then print chr$(147):goto 630
660 input”1 q in reverse COORDINATA ALFABETICA (a-i)”;k$
665 if len(k$)>1 then print chr$(147):goto 630
670 c$=k$+l$
671 if cc=1 then goto 681
680 if c$=s$(1) then kk=0:aa=aa+1:cc=1:goto 2000
681 if cc=2 then goto 691
690 if c$=s$(2) then kk=0:aa=aa+1:cc=2:goto 2000
691 if cc=3 then goto 710
700 if c$=s$(3) then kk=27:aa=aa+1:cc=3:goto 2000
710 if c$<>s$(1) or c$<>s$(2) or c$<>s$(3) then kk=28:pp=pp-1:goto 2000
2000 print”s in reverse 11 q in reverse CONTROLLO.”:fort=1to1500:next:poke646,1
2010 poke53272,(peek(53272)and 240)+12:print”cuore in reverse 10 q in reverse 17 ] in reverse ]]]]]”
2020 print”17 ] in reverse ] ]”
2030 print”17 ] in reverse ] ]”
2040 print”17 ] in reverse ] ]”
2050 print”17 ] in reverse ]]]]]”:u=0
2060 u=u+1:poke1523,kk:poke55795,1
2070 fori=1to600:next:poke1523,32:fori=1to600:next:if u=5 then goto 2090
2080 goto 2060
2090 print chr$(147):poke53272,21
2091 if c$=s$(1) then i(1)=2:i(2)=3:h=1:goto 7000
2092 if c$=s$(2) then i(1)=2:i(2)=3:h=1:goto 7000
2093 if c$=s$(3) then i(1)=4:i(2)=5:h=1:goto 7000
2094 goto 3000
3000 if pp<=0 and oo<=0 then 8000
3005 if oo<=0 then 5000
3010 print chr$(147):print”2 q in reverse 2 ] in reverse GIOCATORE 2: “;a2$
3020 print “1 q in riverse POSSIBILITA’: “;oo
3030 input “1 q in riverse COORDINATA NUMERICA (1-9)”;aa$
3040 if len(aa$)>1 then print chr$(147):goto 3030
3050 input”1 q in reverse COORDINATA ALFABETICA (a-i)”;ab$
3060 if len(ab$)>1 then print chr$(147):goto 3050
3070 i$=ab$+aa$
3071 if gg=1 then goto 3081
3080 if i$=j$(1) then kk=0:bb=bb+1:gg=1:goto 6000
3081 if gg=2 then goto 3091
3090 if i$=j$(2) then kk=0:bb=bb+1:gg=2:goto 6000
3091 if gg=3 then goto 3110
3100 if i$=j$(3) then kk=27:bb=bb+1:gg=3:goto 6000
3110 if i$<>j$(1) or i$<>j$(2) or i$<>j$(3) then kk=28:oo=oo-1:goto 6000
5000 if pp<=0 and oo<=0 then 8000
6000 print”s in reverse 11 q in reverse CONTROLLO.”:fort=1to1500:next:poke646,1
6010 poke53272,(peek(53272)and 240)+12:print”cuore in reverse 10 q in reverse 17 ] in reverse ]]]]]”
6020 print”17 ] in reverse ] ]”
6030 print”17 ] in reverse ] ]”
6040 print”17 ] in reverse ] ]”
6050 print”17 ] in reverse ]]]]]”:u=0
6060 u=u+1:poke1523,kk:poke55795,1
6070 fori=1to600:next:poke1523,32:fori=1to600:next:if u=5 then goto 6090
6080 goto 6060
6090 print chr$(147):poke53272,21
6091 if i$=j$(1) then i(1)=2:i(2)=3:h=1:goto 7000
6092 if i$=j$(2) then i(1)=2:i(2)=3:h=1:goto 7000
6093 if i$=j$(3) then i(1)=4:i(2)=5:h=1:goto 7000
6094 goto 625
7000 v=53248:pokev+21,255:pokev+23,255:pokev+29,255:pokev+27,255
7005 poke2041,13:poke2042,14:poke2043,15:poke2044,246:poke2045,247
7006 poke2046,248:poke2047,249
7010 pokev+40,7:pokev+41,2:pokev+42,7:pokev+43,1:pokev+44,1:pokev+45,1
7020 pokev+46,1
7030 fori=1904to2023:pokei,160:nexti
7040 fori=56176to56295:pokei,246:nexti
7050 pokev+i(1),197:pokev+i(2),197
7060 fori=50to190:pokev+6,i:pokev+7,i:nexti
7070 pokev+8,190:pokev+9,190:fori=247to249:poke2041,i:fork=1to100:nextk
7080 nexti:pokev+9,0
7090 pokev+8,195:pokev+9,195:fori=247to249:poke2041,i:fork=1to100:nextk
7100 nexti:pokev+9,0
7110 pokev+8,192:pokev+9,192:fori=247to249:poke2041,i:fork=1to100:nextk
7120 nexti:pokev+8,0:pokev+9,0:pokev+6,0:pokev+7,0:pokev+i(1),0:pokev+i(2),0
7130 if h=1 then 3000
7140 if h=2 then 625
8000 if aa>bb then w1$=”3 ] in reverse GIOCATORE 1”
8010 if bb>aa then w1$=”3 ] in reverse GIOCATORE 2”
8020 if aa=bb then goto 8100
8030 dd=len(w1$):poke2040,5:poke53248,200:poke53249,200:poke53248+21,255
8040 poke53248+23,255:poke53248+29,255:print”cuore in reverse 2 q in reverse 2 ] in reverse IL VINCITORE E’ IL”:y=0
8050 print”s in riverse 3 q in riverse”;”18 spazi”
8060 y=y+1:for i=1 to dd:for j=1 to 50:nextj:print mid$(w1$,i,1);:next i
8070 if y=5 then 8080
8075 goto 8050
8080 goto 8200
8100 print” 3 q in reverse LA GARA E’ PARI: “:poke53248+21,255:poke53248+23,255
8116 poke53248+29,255:poke2040,5:print”3 q in reverse 3 ] in reverse SIETE ENTRAMBI BRAVI!!”:goto 8200
8200 poke53248,200:poke53249,200:print”GIOCHI ANCORA?”:poke198,0
8210 get a$:if a$=”” then 8210
8220 if a$=”s” or a$=”si” then run
8230 print chr$(147):poke 53248,0:poke 53249,0:clr