home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
commodore-users-of-norman
/
CUON_13_(11-1984).d64
/
epidemic
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2019-04-13
|
4KB
|
178 lines
100 REM C64 MODS BY WIM 3/25/83
120 I=RND(-RND(0)):POKE53272,21:POKE53280,6:POKE53281,7:PRINT"[144]"
140 T$=""
150 QP=197:QA=73
160 IG=160:VI=215:CO=209:GI=170
170 GOTO1360
180 PRINTCHR$(147)"HOW MANY ISLANDERS (<=100)?";:GOSUB1720:NP=VAL(Z1$)
190 IFNP=0THEN180
200 IFNP>100THENPRINT"[145][145]";:GOTO180
210 PRINT"HOW MANY INFECTED AT START?";:GOSUB1720:NI=VAL(Z1$)
220 IFNI=0THEN210
230 IFNI>NPTHENPRINT"[145][145]";:GOTO210
240 PRINT"CONTAGION TIME (DAYS)?";:GOSUB1720:CT=VAL(Z1$)
250 IFCT=0THENPRINT"[145][145]";:GOTO240
260 RESTORE
270 PRINTCHR$(147):FORI=1TO18:READIL,IR
280 FORJ=ILTOIR:POKEJ,IG:NEXT:NEXT
290 PRINT"[215][146]=UNINFECTED [209][146]=CONTAGIOUS *[146]=IMMUNE"
300 PRINT"CONTAGION"
310 PRINT"TIME "CT;
320 IFCT>1THENPRINT" DAYS":GOTO340
330 PRINT" DAY"
340 REM
350 POKEQA+2,PEEK(QA):POKEQA+3,PEEK(QA+1):Z9=FRE(0)
360 DIMPP(NP),PG(NP),DC(NP),NI(50),IM(50)
370 FORI=1TONP:PG(I)=VI:NEXT
380 FORI=1TONI:PG(I)=CO:NEXT
390 FORI=1TONP:DC(I)=0:NEXT
400 FORI=1TONI:DC(I)=CT:NEXT
410 FORI=1TONP
420 PP(I)=INT(690*RND(1)+1157):IFPEEK(PP(I))<>IGTHEN420
430 POKEPP(I),PG(I):NEXT
440 ND=0
450 IM=0:PRINT""TAB(7)NP-NI-IM;TAB(20)NI;TAB(30)IM
460 PRINT"DAY";ND
470 ND=ND+1:NI=0:IM=0
480 FORI=1TONP
490 REM
500 IF(PEEK(PP(I))=CO)AND(PG(I)=VI)THENDC(I)=CT
510 PG(I)=PEEK(PP(I))
520 ONINT(9*RND(1)+1)GOSUB900,910,920,930,940,950,960,970,980
530 REM
540 IFPG(I)=COTHENGOSUB1060
550 REM
560 IFPG(I)=VITHENGOSUB1160
570 REM
580 IFPG(I)=COTHENDC(I)=DC(I)-1
590 REM
600 IFDC(I)<0THENPG(I)=GI:POKEPP(I),GI
610 IFPEEK(PP(I))=COTHENNI=NI+1
620 IFPEEK(PP(I))=GITHENIM=IM+1
630 NEXT
640 IFND<=50THENNI(ND)=NI:IM(ND)=IM
650 PRINT""TAB(7)NP-NI-IM"[157] ";TAB(20)NI"[157] ";TAB(30)IM"[157] "
660 IFNI>0THEN460
670 PRINTT$;:GOSUB1250
680 PRINTCHR$(147)"DAY"TAB(5)"INFECTION":PRINT
690 FORND=1TO50
700 FORWT=1TO150:NEXT
710 PRINTND;TAB(4);
720 PRINTNP-NI(ND)-IM(ND);NI(ND);IM(ND):PRINT
730 IFNP-NI(ND)-IM(ND)=0THEN750
740 FORI=1TONP-NI(ND)-IM(ND):PRINT"[215]";:NEXT
750 IFNI(ND)=0THEN770
760 FORI=1TONI(ND):PRINT"[209]";:NEXT
770 IFIM(ND)=0THEN790
780 FORI=1TOIM(ND):PRINT"*";:NEXT
790 PRINT
800 IFNI(ND)=0THEN820
810 PRINT:NEXTND
820 PRINT"LIKE TO SEE THE CHART AGAIN (Y/N)?";:GOSUB1720:Q$=Z1$
830 IFQ$=""THENPRINT"[145][145]";:GOSUB820
840 IFLEFT$(Q$,1)="Y"THEN680
850 PRINTCHR$(147)LEFT$(T$,10)"WANT ANOTHER TRY (Y/N)?";:GOSUB1720:Q$=Z1$
860 IFQ$=""THEN850
870 IFLEFT$(Q$,1)="Y"THENRUN
880 END
890 REM
900 MV=39:GOSUB1000:RETURN
910 MV=40:GOSUB1000:RETURN
920 MV=41:GOSUB1000:RETURN
930 MV=-1:GOSUB1000:RETURN
940 MV=0:GOSUB1000:RETURN
950 MV=1:GOSUB1000:RETURN
960 MV=-41:GOSUB1000:RETURN
970 MV=-40:GOSUB1000:RETURN
980 MV=-39:GOSUB1000:RETURN
990 REM
1000 IFPEEK(PP(I)+MV)<>IGTHENRETURN
1010 PG(I)=PEEK(PP(I))
1020 POKEPP(I),IG
1030 PP(I)=PP(I)+MV
1040 POKEPP(I),PG(I):RETURN
1050 REM
1060 IFPEEK(PP(I)-41)=VITHENPOKEPP(I)-41,CO
1070 IFPEEK(PP(I)-40)=VI THEN POKEPP(I)-40,CO
1080 IFPEEK(PP(I)-39)=VI THEN POKEPP(I)-39,CO
1090 IFPEEK(PP(I)- 1)=VI THEN POKEPP(I)- 1,CO
1100 IFPEEK(PP(I)+ 1)=VI THEN POKEPP(I)+ 1,CO
1110 IFPEEK(PP(I)+39)=VI THEN POKEPP(I)+39,CO
1120 IFPEEK(PP(I)+40)=VITHEN POKEPP(I)+40,CO
1130 IFPEEK(PP(I)+41)=VITHEN POKEPP(I)+41,CO
1140 RETURN
1150 REM
1160 IFPEEK(PP(I)-41)=COTHENPOKEPP(I),CO
1170 IFPEEK(PP(I)-40)=COTHEN POKEPP(I),CO
1180 IFPEEK(PP(I)-39)=COTHENPOKEPP(I),CO
1190 IFPEEK(PP(I)- 1)=COTHENPOKEPP(I),CO
1200 IFPEEK(PP(I)+ 1)=COTHENPOKEPP(I),CO
1210 IFPEEK(PP(I)+39)=COTHENPOKEPP(I),CO
1220 IFPEEK(PP(I)+40)=COTHENPOKEPP(I),CO
1230 IFPEEK(PP(I)+41)=COTHENPOKEPP(I),CO
1240 RETURN
1250 PRINT" PRESS ANY KEY TO CONTINUE"
1260 GETQ$:IFQ$=""THEN1260
1270 RETURN
1280 REM
1290 REM
1300 REM
1310 REM
1320 REM
1330 REM
1340 REM
1350 REM
1360 PRINT"[147]":FORI=1024TO1063:POKEI,224:POKEI+960,224:NEXT
1370 FORI=1064TO1944STEP40:POKEI,224:POKEI+39,224:NEXT
1380 PRINT""
1390 PRINTTAB(9)" [207][163] [164][167] [204]
1400 [153][163]9)" (null)TOSQRSQRSQRSQRSQRSQR(null)(null)(null)(null)(null)(null)(null)(null)
1410 PRINT""TAB(14)"EPIDEMIC"
1420 PRINT""TAB(25)"ANDY GAMBLE"
1430 PRINTLEFT$(T$,20)TAB(5);"DO YOU NEED INSTRUCTIONS (Y/N)?";
1431 GOSUB1720:Q$=Z1$
1440 IFQ$=""THEN1430
1450 IFLEFT$(Q$,1)<>"Y"THEN180
1460 REM
1470 PRINTCHR$(147)"AN EPIDEMIC HAS BROKEN OUT ON A SMALL "
1480 PRINT"ISLAND. THE DISEASE IS NOT FATAL, AND"
1490 PRINT"ONCE CONTRACTED PROVIDES IMMUNITY FOR LIFE."
1500 PRINT:PRINT"YOU ARE ALLOWED TO CHOOSE CERTAIN "
1510 PRINT"INITIAL CONDITIONS:":PRINT:PRINT:PRINTTAB(5)"THE ISLAND POPULATION"
1520 PRINT:PRINTTAB(5)"THE NUMBER ORIGINALLT INFECTED"
1530 PRINT:PRINTTAB(5)"THE NUMBER OF DAYS FOR WHICH THE"
1540 PRINTTAB(5)"DISEASE IS CONTAGIOUS - THIS IS"
1550 PRINTTAB(5)"ALSO THE DURATION OF THE DISEASE."
1560 PRINT:PRINT:PRINT"THE ISLANDERS WILL MOVE ABOUT RANDOMLY,"
1570 PRINT"INFECTING OTHERS IF CONTAGIOUS.";
1580 PRINT"THOSE WHO ARE IMMUNE WILL NOT BE INFECTED. "
1590 PRINT: GOSUB1250
1600 PRINTCHR$(147)"THIS WILL CONTINUE UNTIL THE DISEASE HAS RUN ITS COURSE ";
1610 PRINT"(UNTIL THEY ARE NO MORE INFECTED PERSONS)."
1620 PRINT:PRINT"YOU WILL THEN BE GIVEN A DAY-BY-DAY BAR CHART OF THE";
1630 PRINT"HISTORY OF THE EPIDEMIC, "
1640 PRINT"UP TO A MAXIMUM OF 50 DAYS."
1650 PRINT:GOSUB1250
1660 GOTO180
1670 DATA1158,1167,1196,1211
1680 DATA1234,1222,1271,1296,1306,1339,1346,1379,1386,1418
1690 DATA1427,1459,1469,1500,1510,1541,1553,1581
1700 DATA1593,1618,1632,1654,1673,1693,1715,1731,1757,1771
1710 DATA1800,1812,1841,1848
1720 Z$="":Z1$=""
1730 PRINT"[166][157]";:FORI=1TO50:NEXTI
1740 PRINT" [157]";:FORI=1TO50:NEXTI
1750 GETZ$:IFZ$=""THEN1730
1760 IFZ$<>CHR$(20)THEN1810
1770 IFZ$=""THEN1730
1780 ZZ=LEN(Z1$):IFZZ<1THEN1730
1790 Z1$=LEFT$(Z1$,ZZ-1):PRINT"[157]";
1800 GOTO1730
1810 IFZ$=CHR$(13)ORZ$=CHR$(141)THEN1850
1820 PRINTZ$;
1830 Z1$=Z1$+Z$
1840 GOTO1730
1850 FORI=1TO10:GETZ$:NEXTI
1860 PRINT
1870 RETURN