Skip to content

Commit 0b76bb1

Browse files
authored
Add files via upload
Initial Upload
1 parent b7183fa commit 0b76bb1

File tree

2 files changed

+325
-0
lines changed

2 files changed

+325
-0
lines changed

yellow_river_kingdom/kingdom.bas

+321
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,321 @@
1+
10 REM "********************************"
2+
20 REM "* YELLOW RIVER KINGDOM *"
3+
30 REM "* written in 1981 by *"
4+
40 REM "* Tom Hartley and *"
5+
50 REM "* Jerry Temple-Fry *"
6+
60 REM "* Ported to the Agon Light *"
7+
70 REM "* By Steve Lovejoy 2024 *"
8+
80 REM "********************************"
9+
90 REM " main "
10+
100 :
11+
110 MODE 7
12+
120 CLS
13+
130 PROCVARIABLE : PROCTITLEPAGE
14+
140 PROCINSTRUCTIONS
15+
150 F=5000+RND(2000)
16+
160 P=300+RND(100)
17+
170 J=0:S=0
18+
180 S=S+1:IF S=4 THEN S=1
19+
190 J=J+1:Y=(J-1) DIV 3 +1
20+
200 PROCNEWSEASON
21+
210 FOR V=1 TO 3:FL(V)=0:NEXT
22+
220 TD=0:TF=0:FD=0:FF=0:VF=0
23+
230 PROCMAP:PROCDBL(S$(S)+" Season Year "+STR$(Y),1,1)
24+
240 IF RND(2)=1 THEN 260
25+
250 PROCFLOOD:PROCATTACK:GOTO270
26+
260 PROCATTACK:PROCFLOOD
27+
270 PROCCALCULATE
28+
280 PROCENDSEASON
29+
290 IF P=0 OR F=0 THEN 330
30+
300 IF J MOD 12 =0 THEN PROCRITUAL : IF Y%=0 THEN 330
31+
310 IF P<200 AND RND(3)=1 THEN PROCADDTHIEVES
32+
320 P=INT(P*1.045) : GOTO 180
33+
330 VDU 26 : CLS : PRINTTAB(0,9)
34+
340 PRINT"Press the RETURN key to start again."'
35+
350 PRINT"Press the ESCAPE key to leave the"'"program."
36+
360 REPEAT UNTIL GET$=CHR$(13):GOTO150
37+
370 IF ERR<>17 THEN REPORT:PRINT" in line ";ERL:END
38+
380 VDU26:CLS
39+
390 PRINTTAB(5,9);
40+
400 PRINT"Do you want to go on to"
41+
410 PRINT" the next program (Y/N)? ";
42+
420 PROCYESORNO:IF Y%<0 THEN 390
43+
430 IF Y%=0 THEN CLEAR : GOTO 130
44+
440 PRINT '"BIORHYTHMS WOULD BE THE NEXT PROGRAM." : END
45+
450 DEFPROCMAP
46+
460 VDU 26 : CLS : PRINT''
47+
470 FOR I=3 TO 23
48+
480 PRINTY$;W$;CHR$(&96);"55";Y$;TAB(27);R$
49+
490 NEXT
50+
500 FOR I=3 TO 21 STEP 2
51+
510 PRINTTAB(28,I);" x ";TAB(28,I+1);"x";CHR$(255);"~x x"
52+
520 PRINTTAB(33,I+2);"x";CHR$(255);"~x";
53+
530 NEXT
54+
540 FOR I=13 TO 15 : PRINTTAB(30,I);" "
55+
550 NEXT
56+
560 PRINTTAB(30,14);"THIEVES";TAB(31,13);"TT";TAB(31,15);"T";TAB(32,16);"T";TAB(32,17);"T"
57+
570 PRINTTAB(0,23);" DYKE VILLAGES MOUNTAINS";
58+
580 FOR V=1 TO 3 : PROCVDRAW(V) : NEXT
59+
590 ENDPROC
60+
600 DEFPROCVDRAW(V)
61+
610 PRINTTAB(VX(V)-2,VY(V));V$;"^&";Y$TAB(VX(V)-2,VY(V)+1);V$;"&^";Y$
62+
620 ENDPROC
63+
630 DEFPROCINSTRUCTIONS
64+
640 PROCYELLOW:PRINT'''
65+
650 PRINT"The kingdom is three villages. It"'"is between the Yellow River and"'"the mountains."
66+
660 PRINT'"You have been chosen to take"'"all the important decisions. Your "'"poor predecessor was executed by"'"thieves who live in the nearby"'"mountains."
67+
670 PRINT'"These thieves live off the "'"villagers and often attack. The"'"rice stored in the villages must"'"be protected at all times."
68+
680 PROCSPACE
69+
690 CLS:PRINT''
70+
700 PRINT"The year consists of three long "'"seasons, Winter, Growing and"'"Harvest. Rice is planted every"'"Growing Season. You must decide"'"how much is planted."
71+
710 PRINT'"The river is likely to flood the"'"fields and the villages. The high"'"dyke between the river and the"'"fields must be kept up to prevent"'"a serious flood."
72+
720 PRINT'"The people live off the rice that"'"they have grown. It is a very poor"'"living. You must decide what the"'"people will work at each season"'"so that they prosper under your"'"leadership."
73+
730 PROCSPACE
74+
740 ENDPROC
75+
750 DEFPROCNEWSEASON
76+
760 PROCYELLOW:PRINTTAB(8,1);"Census Results"':IF J=1 THEN 800
77+
770 PRINT"At the start of the ";S$(S);" Season"
78+
780 PRINT"of year ";Y;" of your reign this is"
79+
790 PRINT"the situation.":GOTO830
80+
800 PRINT"You have inherited this situation"
81+
810 PRINT"from your unlucky predecessor. It"
82+
820 PRINT"is the start of the Winter Season."
83+
830 PRINT'"Allowing for births and deaths,"
84+
840 PRINT"the population is ";P;". "'
85+
850 PRINT"There are ";F;" baskets of rice"
86+
860 PRINT"in the village stores."
87+
870 PRINT'"How many people should:"
88+
880 PRINT" A) Defend the dyke......"
89+
890 PRINT" B) Work in the fields..."
90+
900 PRINT" C) Protect the villages."
91+
910 QU=14:A=0
92+
920 PRINTTAB(26,QU);:NI=FNNUMINP
93+
930 IF A+NI>P THEN PROCIMPOS:GOTO920
94+
940 QU=QU+1:IF QU=16 THEN B=NI:GOTO970
95+
950 A=NI:IF A<P THEN 920
96+
960 B=0:PRINTTAB(26,QU);B:QU=16
97+
970 C=P-(A+B):PRINTTAB(26,QU);C
98+
980 IF S<>2 THEN 1040
99+
990 PRINT'"How many baskets of rice will be"
100+
1000 PRINT"planted in the fields....."
101+
1010 PRINTTAB(26,19);:G=FNNUMINP
102+
1020 IF G>F THEN PROCIMPOS:GOTO1010
103+
1030 F=F-G
104+
1040 PROCSPACE
105+
1050 ENDPROC
106+
1060 DEFPROCENDSEASON
107+
1070 PROCWAIT(1)
108+
1080 IF F>0 THEN 1130
109+
1090 CLS:PRINTTAB(3,7);"There was no food left.All of the"
110+
1100 PRINT" people have run off and joined up"
111+
1110 PRINT" with the thieves after ";J;" seasons"
112+
1120 PRINT" of your misrule":PROCSPACE:ENDPROC
113+
1130 IF P>0 THEN 1180
114+
1140 CLS:PRINTTAB(2,8);"There is no-one left! They have all"
115+
1150 PRINT" been killed off by your decisions "
116+
1160 PRINT" after only ";Y;" year";:IF Y<>1 THEN PRINT"s";
117+
1170 PRINT".":PROCSPACE:ENDPROC
118+
1180 F1=P/(FD+TD+ST+1):F2=F/(TF+FF+1):IF F2<F1 THEN F1=F2
119+
1190 IF F2<2 THEN T$="Disastrous Losses!":GOTO1270
120+
1200 IF F1<4 THEN T$="Worrying losses!":GOTO1270
121+
1210 IF F1<8 THEN T$="You got off lightly!":GOTO1270
122+
1220 IF F/P<4 THEN T$="Food supply is low.":GOTO1270
123+
1230 IF F/P<2 THEN T$="Starvation Imminent!":GOTO1270
124+
1240 IF ZA+ZF+ST>0 THEN T$="Nothing to worry about.":GOTO1270
125+
1250 PROCDBL(" A quiet season ",1,11)
126+
1260 PROCWAIT(2):ENDPROC
127+
1270 PROCYELLOW:PRINTTAB(3,2);"Village Leader's Report"
128+
1280 PRINT'TAB(15-LEN(T$)/2);CHR$(&88);T$
129+
1290 PRINT'"In the ";S$(S);" Season of year ";Y
130+
1300 PRINT"of your reign, the kingdom has"
131+
1310 PRINT"suffered these losses:"'
132+
1320 PRINT"Deaths from floods..........";FD
133+
1330 PRINT"Deaths from the attacks.....";TD
134+
1340 PRINT"Deaths from starvation......";ST
135+
1350 PRINT"Baskets of rice"'"lost during the floods......";FF
136+
1360 PRINT"Baskets of rice"'"lost during the attacks.....";TF
137+
1370 PRINT'"The village census follows."
138+
1380 PROCSPACE
139+
1390 ENDPROC
140+
1400 DEFPROCADDTHIEVES
141+
1410 PROCYELLOW:PRINTTAB(0,8)
142+
1420 PRINT"Thieves have come out of the"
143+
1430 PRINT"mountain to join you. They"
144+
1440 PRINT"have decided that it will be"
145+
1450 PRINT"easier to grow the rice than"
146+
1460 PRINT"to steal it!":PROCSPACE
147+
1470 P=P+50+RND(100)
148+
1480 ENDPROC
149+
1490 DEFPROCRITUAL
150+
1500 PROCYELLOW:PRINT''
151+
1510 PRINT"We have survived for ";Y;" years"
152+
1520 PRINT"under your glorious control."
153+
1530 PRINT"By an ancient custom we must"
154+
1540 PRINT"offer you the chance to lay"
155+
1550 PRINT"down this terrible burden and"
156+
1560 PRINT"resume a normal life."
157+
1570 PRINT'"In the time honoured fashion"
158+
1580 PRINT"I will now ask the ritual"
159+
1590 PRINT"question:"':PROCWAIT(5)
160+
1600 PRINT"Are you prepared to accept"
161+
1610 PRINT"the burden of decision again?"'
162+
1620 PRINT"You need only answer Yes or No"
163+
1630 PRINT"for the people will understand"'"your reasons."
164+
1640 PRINTTAB(0,21);:PROCYESORNO:IF Y%<0 THEN 1640
165+
1650 ENDPROC
166+
1660 DEFPROCATTACK
167+
1670 LOCALX,Y,I
168+
1680 ZA=0:R=RND(1):ON S GOTO1690,1700,1710
169+
1690 IF R<.5 THEN ENDPROC ELSE 1720
170+
1700 IF R<.2 THEN ENDPROC ELSE 1720
171+
1710 IF R<.6 THEN ENDPROC ELSE 1720
172+
1720 ZA=1
173+
1730 IF VF=3 THEN ENDPROC
174+
1740 V=RND(3):IF FL(V)=1 THEN 1740
175+
1750 X=32:WX=VX(V):WY=VY(V)-1
176+
1760 IF WY<17 THEN Y=13:D=-1 ELSE Y=17:D=1
177+
1770 SY=Y
178+
1780 PRINTTAB(X,Y);" ":IF Y=WY THEN 1800
179+
1790 Y=Y+D:PRINTTAB(X,Y);"T":PROCWAIT(.05):GOTO1780
180+
1800 X=X-1:PRINTTAB(X-1,Y);R$;"T":PROCWAIT(1-(X-WX)/5)
181+
1810 PRINTTAB(X,Y);:IF X=29 THEN PRINT"x" ELSE PRINT" "
182+
1820 IF X>WX THEN 1800
183+
1830 FOR I=1 TO 99
184+
1840 PRINTTAB(X,Y+1);CHR$(RND(94)+32):NEXT
185+
1850 PROCVDRAW(V)
186+
1860 X=X+1:IF X<27 THEN PRINTTAB(X-2,Y);" "
187+
1870 IF X=31 THEN PRINTTAB(29,Y);"x"
188+
1880 PRINTTAB(X-1,Y);R$;"T":PROCWAIT(.04)
189+
1890 IF X<32 THEN 1860
190+
1900 IF Y=SY THEN 1920
191+
1910 PRINTTAB(X,Y);" ":Y=Y-D:PRINTTAB(X,Y);"T":PROCWAIT(.05):GOTO1900
192+
1920 ON S GOTO 1930,1940,1950
193+
1930 I=200+RND(70)-C:GOTO1960
194+
1940 I=30+RND(200)-C:GOTO1960
195+
1950 I=RND(400)-C
196+
1960 I=INT(I):IF I<0 THEN I=0
197+
1970 TD=INT(C*I/400):C=C-TD
198+
1980 TF=INT(I*F/729+RND(2000-C)/10):IF TF<0 THEN TF=0
199+
1990 IF TF>2000 THEN TF=1900+RND(200)
200+
2000 F=F-TF
201+
2010 ENDPROC
202+
2020 DEFPROCFLOOD
203+
2030 LOCALX,Y
204+
2040 ZF=0:ON S GOTO 2050,2060,2070
205+
2050 FS=RND(330)/(A+1):GOTO2080
206+
2060 FS=(RND(100)+60)/(A+1):GOTO2080
207+
2070 ENDPROC
208+
2080 IF FS<1 THEN ENDPROC
209+
2090 X=6:ZF=1:Y=RND(8)+10:IF FS<2 THEN FS=RND(2) ELSE FS=RND(4)
210+
2100 PRINTTAB(1,Y);W$;W$;W$;W$;W$;W$
211+
2110 FOR K=1 TO FS*100
212+
2120 ON RND(4) GOTO2130,2140,2150,2160
213+
2130 IF X=25 THEN 2120 ELSE X=X+1:GOTO2170
214+
2140 IF X=6 THEN 2120 ELSE X=X-1:GOTO2170
215+
2150 IF Y=22 THEN 2120 ELSE Y=Y+1:GOTO2170
216+
2160 IF Y=3 THEN 2120 ELSE Y=Y-1:GOTO2170
217+
2170 V=1
218+
2180 W1=VX(V)-X:W2=Y-VY(V)
219+
2190 IF W2<>1 AND W2<>0 THEN 2220
220+
2200 IF W1=0 OR W1=1 THEN FL(V)=1
221+
2210 IF W1=-1 THEN 2240
222+
2220 V=V+1:IF V<4 THEN 2180
223+
2230 PRINTTAB(X,Y);W$
224+
2240 NEXTK
225+
2250 VF=FL(1)+FL(2)+FL(3)
226+
2260 OP=A+B+C
227+
2270 A=INT((A/10)*(10-FS))
228+
2280 B=INT((B/10)*(10-FS))
229+
2290 C=INT((C/6)*(6-VF))
230+
2300 FF=INT(F*VF/6):F=F-FF
231+
2310 FD=OP-A-B-C
232+
2320 IF S=2 THEN G=G*(20-FS)/20
233+
2330 IF S=3 THEN G=G*(10-FS)/10
234+
2340 ENDPROC
235+
2350 DEFPROCCALCULATE
236+
2360 IF B=0 THEN G=0:GOTO2440
237+
2370 ON S GOTO 2440,2380,2400
238+
2380 IF G>1000 THEN G=1000
239+
2390 G=G*(B-10)/B:GOTO2440
240+
2400 IF G<0 THEN 2440
241+
2410 G=18*(11+RND(3))*(0.05-1/B)*G
242+
2420 IF G<0 THEN 2440
243+
2430 F=F+INT(G)
244+
2440 ST=0:P=A+B+C:IF P=0 THEN 2510
245+
2450 T=F/P:IF T>5 THEN T=4:GOTO2490
246+
2460 IF T<2 THEN P=0:GOTO2510
247+
2470 IF T>4 THEN T=3.5:GOTO2490
248+
2480 ST=INT(P*(7-T)/7):T=3
249+
2490 P=P-ST:F=INT(F-P*T-ST*T/2)
250+
2500 IF F<0 THEN F=0
251+
2510 ENDPROC
252+
2520 DEFPROCVARIABLE
253+
2530 DIM S$(3),VX(3),VY(3),FL(3)
254+
2540 S$(1)="Winter":S$(2)="Growing":S$(3)="Harvest"
255+
2550 W$=CHR$(255):Y$=CHR$(&93):R$=CHR$(&91):V$=CHR$(&92)
256+
2560 VX(1)=13:VY(1)=8
257+
2570 VX(2)=21:VY(2)=12
258+
2580 VX(3)=22:VY(3)=18
259+
2590 ENDPROC
260+
2600 DEFPROCIMPOS
261+
2610 PRINTTAB(4,20);CHR$(&88);CHR$(&82);"I M P O S S I B L E"
262+
2620 PROCWAIT(2)
263+
2630 PROCSPACE
264+
2640 PRINTTAB(5,20);SPC(20);TAB(0,22);SPC(40)
265+
2650 ENDPROC
266+
2660 DEFPROCYELLOW
267+
2670 LOCALI
268+
2680 CLS:FOR I=0 TO 24
269+
2690 PRINTTAB(0,I);CHR$(&83);:NEXT
270+
2700 PRINTTAB(0,0);
271+
2710 VDU 28,3,24,39,0
272+
2720 ENDPROC
273+
2730 DEFPROCDBL(X$,X,Y)
274+
2740 PRINTTAB(X-1,Y);CHR$(141);X$
275+
2750 PRINTTAB(X-1,Y+1);CHR$(141);X$
276+
2760 ENDPROC
277+
2770 DEFPROCWAIT(X)
278+
2780 LOCAL Z
279+
2790 Z=TIME
280+
2800 REPEAT UNTIL TIME-Z>X*100
281+
2810 ENDPROC
282+
2820 DEFPROCSPACE
283+
2830 PRINTTAB(0,22);"Press the SPACE BAR to continue";:PROCKCL
284+
2840 REPEAT UNTIL GET$=" "
285+
2850 ENDPROC
286+
2860 DEFPROCTITLEPAGE
287+
2870 PROCMAP:PROCOFF:PROCWAIT(2):PRINTTAB(0,11);SPC(200)
288+
2880 PROCDBL(Y$+"YELLOW RIVER",11,11):PROCDBL(Y$+"KINGDOM",13,14): PRINTTAB(12,21)"PRESS ENTER"
289+
2890 I%=INKEY(500)
290+
2900 ENDPROC
291+
2910 DEFPROCKCL
292+
2920 IF INKEY$(0)>"" THEN 2920
293+
2930 ENDPROC
294+
2940 DEFPROCOFF
295+
2950 VDU23;8202;0;0;0;:ENDPROC
296+
2960 DEFPROCON
297+
2970 VDU23;29194;0;0;0;:ENDPROC
298+
2980 DEFPROCGPI(F2,ML):REM General Purpose Input Routine
299+
2990 LOCALB,B$
300+
3000 A$=""
301+
3010 PRINTSTRING$(ML," ");STRING$(ML+1,CHR$(8));CHR$(&83);:PROCON:PROCKCL
302+
3020 B$=GET$:B=ASC(B$):IF B=13 THEN 3090
303+
3030 IF B=127 AND A$="" THEN 3020
304+
3040 IF B=127 THEN A$=LEFT$(A$,LEN(A$)-1):PRINTB$;:GOTO3020
305+
3050 IF LEN(A$)=ML OR B<32 OR B>126 THEN 3070
306+
3060 IF F2=0 OR B=32 OR (B>=48 AND B<=57) THEN 3080
307+
3070 VDU7:GOTO3020
308+
3080 PRINTB$;:A$=A$+B$:GOTO3020
309+
3090 PROCOFF
310+
3100 ENDPROC
311+
3110 DEFPROCYESORNO
312+
3120 LOCALB$
313+
3130 PROCGPI(0,3)
314+
3140 B$=LEFT$(A$,1)
315+
3150 Y%=-1
316+
3160 IF B$="Y" OR B$="y" THEN Y%=1
317+
3170 IF B$="N" OR B$="n" THEN Y%=0
318+
3180 ENDPROC
319+
3190 DEFFNNUMINP
320+
3200 PROCGPI(1,6)
321+
3210 =VAL(A$)

yellow_river_kingdom/readme.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
Yellow River Kingdom
2+
3+
Written in 1981 by Tom Hartley and Jerry Temple-Fry.
4+
Ported to the Agon Light By Steve Lovejoy 2024.

0 commit comments

Comments
 (0)