Compucolor.org – Virtual Media

Listing of file='TRADER.BAS;01' on disk='vmedia/trader-sector.ccvf'

100 REM Y ******************************************************
110 REM STAR TRADER 01/01/81, FOR 3650/9650 SERIES BY GAB
120 REM COPYRIGHT (C) 1981 BY INTELLIGENT SYSTEMS CORP.
130 POKE 32940,55
140 OUT 8,207:REM ENABLE KEYBOARD
150 TM= 256* PEEK (32941)+ PEEK (32940)
160 Z= TM+ 8:AD= 33283:GOSUB 210:TM= TM+ 1
170 X= 0:Y= 5:H= 14:W= 22:C= 1
180 Z= 28672+ 128* Y+ X+ X:AD= TM+ 126:GOSUB 210
190 Z= 128- W- W:AD= TM+ 149:GOSUB 210:POKE TM+ 129,H- 1
200 POKE TM+ 131,W* (C+ 1):POKE TM+ 143,35* (1- C):GOTO 290
210 ZZ= INT (Z/ 256):POKE AD,Z- 256* ZZ:POKE AD+ 1,ZZ:RETURN
220 L= L+ 1:IF L= 19THEN L= CALL (1):L= 18
230 GOSUB 240:PRINT SPC( 22)""
240 PLOT 3,0,L:RETURN
250 GOSUB 220:GOTO 220
260 Z$= MID$ (STR$ (Z),2+ (Z< 0))
270 PRINT MID$ ("      ",1,M- LEN (Z$));Z$;:RETURN
280 Z= 100* (Y- 100* INT (Y/ 100))+ INT ((X+ 6)/ 7):RETURN
290 DEF FN Z(X)= (FN Y(X)/ 2- (NOT FN Y(X))* X/ (2* ABS (A(I,S))))/ K
300 DEF FN Y(X)= - (X> = ABS (A(I,S)))
310 DEF FN C(X)= 4+ (B(X)> = 5)+ (B(X)> = 10)+ (B(X)> = 15)
320 DEF FN B(X)= X- P9* INT ((X- 1)/ P9)
330 DIM A(6,16),B(16),D(16),E(16),F(16),G(16),H(6,16)
340 DIM M(16),N(16),O(6),P(6),Q(6),R(6),S(6),T(6),U(6,3),V(6,3)
350 DIM A$(16),B$(4),H$(16),M$(12),C$(6),D$(6):MX= 16
360 DIM SX(13),SY(13),I(16),J(16),K(16),L(16)
370 READ R9,D9,Q,W,X9,G9:DATA .285614,12,.1,30,36,1.25
380 FOR I= 1TO 6:READ Q(I):NEXT I:DATA 50,35,40,45,30,30
390 FOR I= 1TO 12:READ M$(I):NEXT I
400 DATA JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC
410 FOR I= 1TO 16:READ A$(I):NEXT I
420 DATA "SOL ",YORK,BOYD,IVAN,REEF,HOOK,CYON,TASK
430 DATA PINK,WAND,QUIN,GOAL,DIRK,KRIS,FATE,ALPH
440 FOR I= 1TO 6:READ C$(I):D$(I)= CHR$ (16+ I):NEXT I
450 DATA URANIUM,METALS,HVYEQP,MEDICINE,SOFTWARE,STARGEMS
460 B$(1)= "":B$(2)= "":B$(3)= "":B$(4)= ""
470 FOR I= 1TO 6:FOR J= 1TO 3:READ U(I,J),V(I,J):NEXT J:NEXT I
480 DATA -.1,1,-.2,1.5,-.1,.5,0,.75,-.1,.75,-.1,.75
490 DATA 0,-.75,.1,-.75,.1,-.75,-.1,-.5,.1,-1.5,0,.5
500 DATA .1,-1,.2,-1.5,.1,-.5,.1,.5,-.1,1.5,0,-.5
510 PLOT 6,0,12,14,6,15,8
520 PRINT "S T A R   T R A D E R
530 PLOT 6,7,3,40,21:PRINT "DATE BANK SHPS MER  TOT"
540 PLOT 3,0,21:PRINT "SHP DEST  ETA CASH UR ME EQ RX CS GM WT "
550 PLOT 3,0,30:PRINT "STAR C DATE  UR MET EQP MED SOF GEM"
560 FOR I= 0TO 20STEP 10:PLOT 3,22,I:PRINT "+";
570 FOR J= 1TO 10:PRINT "ggg+";:NEXT :PRINT :NEXT
580 PLOT 27,10:FOR I= 22TO 62STEP 20:PLOT 3,I,0:PRINT "+";
590 FOR J= 1TO 10:PRINT "n+";:NEXT :PRINT :NEXT :PLOT 27,24
600 L= 5:GOSUB 220:PLOT 7:INPUT "START YR (<9000):";Y1
610 IF Y1> 9000THEN 600
620 Y1= INT (Y1):D1= 1:GOSUB 2320
630 FOR I= 1TO Y1- 100* INT (Y1/ 100):Z= RND (1):NEXT I
640 L= 5:GOSUB 220:PLOT 7:INPUT "# PLAYERS (2-4): ";P9
650 P9= INT (P9):IF P9< 2OR P9> 4THEN 640
660 U9= D9* D9:T9= 2* P9:S9= 3* P9:Y9= Y1+ 3
670 IF S9< 7THEN S9= 7
680 GOSUB 250:PRINT TAB( 4);"**WORKING!**":PLOT 28
690 F(1)= 0:G(1)= 0:B(1)= 15:S= 1:GOSUB 1850
700 H= 1:S= 2:GOSUB 1800:S= 3:GOSUB 1800:S= 4:GOSUB 1830
710 FOR S= 5TO S9:ON S- 3* INT ((S- 1)/ 3)GOSUB 1800,1830,1840
720 NEXT S:T= 1:PRINT "SHIP NAMES? (3 CHAR)"
730 FOR I= 1TO T9/ P9:FOR P= 1TO P9
740 H(1,T)= 0:H(2,T)= 0:H(3,T)= 15:H(4,T)= 10:H(5,T)= 10:H(6,T)= 0
750 I(T)= 25:J(T)= 1:K(T)= D1:L(T)= Y1:M(T)= 50:PLOT 6:PLOT P
760 GOSUB 250:PRINT "PLAYER"P;:PLOT 7:INPUT " SHIP NAME:";Z$
770 H$(T)= MID$ (Z$,1,3):GOSUB 2160:T= T+ 1:NEXT P,I
780 FOR B= 1TO P9:R(B)= 0:S(B)= D1:T(B)= Y1:GOSUB 2200:NEXT B
790 FOR S= 1TO S9:GOSUB 2280:GOSUB 1940:NEXT S
800 S= 1:T= 1:GOSUB 250:PRINT "STUDY MAP & PRICES":GOSUB 250
810 PRINT "CLASS 1&2 STARS MAKE":GOSUB 220
820 PRINT "GOOD PARTNERS WITH":GOSUB 220
830 PRINT "CLASS 3&4 STARS"
840 FOR T= 1TO T9:GOSUB 250:PRINT "DEST. OF "D$(FN B(T));H$(T);"";
850 GOSUB 1630:NEXT T
860 D= K(1):Y= L(1):T= 1:P= 1:FOR I= 2TO T9:IF L(I)< YTHEN 910
870 IF L(I)> YOR K(I)> DTHEN 920
880 IF K(I)< DTHEN 910
890 P= P+ 1:IF P* RND (1)> 1THEN T= I
900 GOTO 920
910 P= 1:T= I:D= K(I):Y= L(I)
920 NEXT I
930 IF Y1< Y9THEN 970
940 GOSUB 2150:GOSUB 220
950 PLOT 7:INPUT "ANOTHER GAME? ";A$:IF MID$ (A$,1,1)= "Y"THEN 190
960 LOAD "MENU":RUN
970 D1= D:Y1= Y:J= INT ((D- 1)/ 30):GOSUB 2320
980 S= J(T):GOSUB 250:PRINT "**** "M$(J+ 1);D1- 30* J","Y1
990 B= FN B(T):GOSUB 250
1000 PRINT D$(B);"";H$(T)" HAS LANDED ON "B$(FN C(S));A$(S)""
1010 IF ZZ= 0THEN ZZ= 1:GOTO 1030
1020 GOSUB 2390
1030 T2= S:A2$= A$(S):PLOT 31:GOSUB 2390:PLOT 15
1040 FL= 1:GOSUB 2160:GOSUB 2200
1050 GOSUB 220:ON N(T)+ 1GOTO 1090,1080,1070
1060 PRINT "3 WEEKS LATE...":GOSUB 220:PRINT "PIRATE ATTACK!":GOTO 1090
1070 PRINT "2 WEEKS LATE...":GOSUB 220:PRINT "WE GOT LOST!":GOTO 1090
1080 PRINT "1 WEEK LATE...":GOSUB 220:PRINT "COMPUTER MALFUNCTION!"
1090 GOSUB 1940
1100 FOR I= 1TO 6:IF A(I,S)> - 1OR H(I,T)= 0THEN 1290
1110 GOSUB 250:PRINT "WE ARE BUYING:"
1120 Z= INT (- A(I,S)):GOSUB 220:PRINT ""C$(I):GOSUB 250:PRINT "WE NEED"Z" UNIT(S)"
1130 GOSUB 220:PRINT "# YOU ARE SELLING ";
1140 GOSUB 2110:IF X= 0THEN 1290
1150 IF X> H(I,T)THEN GOSUB 220:PRINT "YOU ONLY HAVE"H(I,T)"":GOTO 1130
1160 IF X< = ZTHEN 1200
1170 XX= INT (Z+ RND (1)* (X- Z+ .5))
1180 IF XX> 2.5* ZTHEN XX= INT (2.5* Z)
1190 IF X> XXTHEN X= XX:GOSUB 220:PRINT "WE'LL BID ON"X
1200 K9= INT (2* RND (1)+ 2.5):AA= .1* RND (1)+ .75
1210 FOR K= 1TO K9:IF K= K9THEN GOSUB 220:PRINT "OUR FINAL OFFER";:GOTO 1230
1220 GOSUB 220:PRINT "  WE OFFER";
1230 PRINT INT (.9* P(I)* X+ .5):GOSUB 220:PLOT 7:INPUT "WHAT DO YOU BID? ";Y:GOSUB 2350:IF ETHEN 1220
1240 IF Y< = P(I)* XTHEN 1280
1250 IF Y> (1+ FN Z(X))* P(I)* XTHEN 1270
1260 P(I)= AA* P(I)+ (1- AA)* Y/ X:NEXT
1270 GOSUB 220:PRINT "WE'LL PASS THIS ONE":GOTO 1290
1280 GOSUB 220:PRINT "WE'LL BUY!":F= - 1:GOSUB 2370:GOSUB 2160:GOSUB 2200
1290 NEXT I
1300 FOR I= 1TO 6:IF O(I)< = 0OR A(I,S)< 1OR I< = 4AND I(T)> = WTHEN 1490
1310 GOSUB 250:PRINT "WE ARE SELLING:"
1320 GOSUB 220:PRINT ""C$(I)" UP TO"INT (A(I,S))""
1330 GOSUB 250:PRINT "# YOU ARE BUYING ";:GOSUB 2110
1340 IF X= 0THEN 1490
1350 IF I< = 4AND X+ I(T)> WTHEN GOSUB 220:PRINT "YOU ARE OVER"W" TONS":GOTO 1330
1360 IF X> A(I,S)THEN GOSUB 220:PRINT "WE HAVE ONLY"INT (A(I,S))" UNITS":GOTO 1330
1370 AA= .1* RND (1)+ .75
1380 FOR K= 1TO K9:IF K= K9THEN GOSUB 220:PRINT "OUR FINAL OFFER:";:GOTO 1400
1390 GOSUB 220:PRINT "WE WANT ABOUT";
1400 PRINT INT (1.1* P(I)* X+ .5):GOSUB 220:PLOT 7:INPUT "YOUR OFFER? ";Y:GOSUB 2350:IF ETHEN 1390
1410 IF Y> = P(I)* XTHEN 1450
1420 IF Y< (1- FN Z(X))* P(I)* XTHEN 1440
1430 P(I)= AA* P(I)+ (1- AA)* Y/ X:NEXT
1440 GOSUB 220:PRINT "THAT'S TOO LOW":GOTO 1490
1450 IF Y< M(T)THEN 1480
1460 GOSUB 220:PRINT "YOU HAVE ONLY"M(T)"":IF B(S)< 10OR M(T)+ R(B)< YTHEN 1440
1470 GOSUB 2010:IF Y> M(T)THEN 1440
1480 GOSUB 220:PRINT "SOLD!":F= 1:GOSUB 2370:GOSUB 2160:GOSUB 2200
1490 NEXT I
1500 IF B(S)> = 10AND M(T)+ R(B)> 0THEN GOSUB 2010
1510 GOSUB 250:PRINT "NEXT PORT? ";:GOSUB 1630
1520 GOSUB 2200:GOSUB 1940
1530 J= 0:FOR I= 1TO 6:IF A(I,S)> = 0THEN 1560
1540 IF A(I,S)< O(I)THEN 860
1550 J= J+ 1
1560 NEXT I:IF J> 1THEN 860
1570 X= FN C(S):B(S)= B(S)+ G9:Y= FN C(S):IF X= YTHEN 1590
1580 GOSUB 2150:GOSUB 250:PRINT B$(Y);A$(S)" IS NOW A CLASS"Y"SYSTEM"
1590 IF S9= MXTHEN 860
1600 J= 0:FOR I= 1TO S9:J= J+ B(I):NEXT I:IF J/ S9< 10THEN 860
1610 S9= S9+ 1:S= 1:GOSUB 1800:GOSUB 2280:GOSUB 2320
1620 GOSUB 2150:GOSUB 250:PRINT B$(FN C(S));A$(S):GOSUB 220:PRINT " HAS BEEN DISCOVERED":GOTO 860
1630 PLOT 7:INPUT ": ";A$:FOR I= 1TO S9:IF LEFT$ (A$,1)= LEFT$ (A$(I),1)THEN 1660
1640 NEXT I:GOSUB 220:PRINT A$" IS NOT A STAR"
1650 GOSUB 220:PRINT "NEXT STAR";:GOTO 1630
1660 IF I= STHEN GOSUB 220:PRINT "CHOOSE ANOTHER STAR":GOTO 1650
1670 J(T)= I:D2= INT (SQR ((F(S)- F(I))^ 2+ (G(S)- G(I))^ 2* I(T)/ W)/ R9)
1680 IF RND (1)> Q/ 2THEN 1740
1690 GOSUB 220:I= INT (3* RND (1)+ 1):ON IGOTO 1720,1710,1700
1700 PRINT "SHIP FAILS INSPECTION":GOTO 1730
1710 PRINT "CREW DEMANDS VACATION":GOTO 1730
1720 PRINT "LOCAL HOLIDAY SOON"
1730 GOSUB 220:PRINT TAB( 4);I" WEEK DELAY":D2= D2+ 7* I
1740 GOSUB 1780:M= INT ((K(T)- 1)/ 30):GOSUB 250:PRINT "THE ETA";
1750 FL= 0
1760 PRINT " IS "M$(M+ 1);K(T)- 30* M"":GOSUB 2160
1770 I= - (INT (RND (1)* 3+ 1)* (RND (1)> Q/ 2)):D2= 7* I:GOSUB 1780:N(T)= I:RETURN
1780 K(T)= K(T)+ D2:IF K(T)> 360THEN K(T)= K(T)- 360:L(T)= L(T)+ 1
1790 RETURN
1800 X= 66* (RND (1)- .5):Y= 32* RND (1):IF ABS (X)< 17AND Y< 17THEN 1800
1810 F= 1:GOSUB 1880:IF F= 0THEN 1800
1820 B(S)= 0:GOTO 1850
1830 E= 66:GOSUB 1860:B(S)= 5:GOTO 1850
1840 E= 33:GOSUB 1860:B(S)= 10
1850 FOR I= 1TO 6:A(I,S)= 0:NEXT I:D(S)= 270:E(S)= Y1- 1:RETURN
1860 X= E* (RND (1)- .5):Y= E* RND (1)/ 2:F= 1:GOSUB 1880:IF F= 0THEN 1860
1870 RETURN
1880 ON HGOTO 1920,1910,1900
1890 Z= X:X= - Y:Y= Z:GOTO 1920
1900 Y= - Y:GOTO 1920
1910 Z= X:X= Y:Y= Z
1920 FOR J= 1TO S- 1:IF (X- F(J))^ 2+ (Y- G(J))^ 2< U9THEN F= 0:RETURN
1930 NEXT :F(S)= INT (X):G(S)= INT (Y):H= 1- H* (H< 4):RETURN
1940 R1= 1- (B(S)> = 5)- (B(S)> = 10):D2= 12* (Y1- E(S))+ (D1- D(S))/ 30
1950 FOR I= 1TO 6:O(I)= (1+ B(S)/ 15)* (U(I,R1)* B(S)+ V(I,R1))
1960 IF ABS (O(I))< = .01THEN P(I)= 0:GOTO 2000
1970 X= ABS (O(I))* 12:Y= ABS (A(I,S)+ D2* O(I)):IF X> YTHEN X= Y
1980 A(I,S)= SGN (O(I))* X
1990 P(I)= INT (Q(I)* (1- SGN (A(I,S))* ABS (A(I,S)/ (O(I)* X9)))+ .5)
2000 NEXT I:D(S)= D1:E(S)= Y1:GOTO 2240
2010 GOSUB 250:PLOT 7:INPUT "VISIT LOCAL BANK? ";A$:IF MID$ (A$,1,1)= "N"THEN RETURN
2020 GOSUB 2100:GOSUB 2200
2030 GOSUB 250:PLOT 7:INPUT "WITHDRAW OR DEPOSIT: ";A$:IF MID$ (A$,1,1)= "D"THEN 2070
2040 IF MID$ (A$,1,1)< > "W"THEN 2030
2050 GOSUB 220:PRINT "WITHDRAW AMOUNT ";:GOSUB 2110:IF X> R(B)THEN 2050
2060 F= - 1:GOTO 2090
2070 GOSUB 220:PRINT "DEPOSIT AMOUNT ";:GOSUB 2110:IF X> M(T)THEN 2070
2080 F= 1
2090 M(T)= M(T)- F* X:R(B)= R(B)+ F* X:GOSUB 2160:GOSUB 2200:RETURN
2100 R(B)= INT (.5+ R(B)* (1+ .05* (Y1- T(B)+ (D1- S(B))/ 360))):S(B)= D1:T(B)= Y1:RETURN
2110 PLOT 7:INPUT "";X$:X= VAL (X$)
2120 IF INT (X)= XAND X> = 0THEN RETURN
2130 GOSUB 220:PRINT "TYPE ZERO TO PASS"
2140 GOSUB 220:PRINT "BUT NO NEGATIVES OR DECIMALS":GOTO 2110
2150 GOSUB 250:PRINT "GENERAL ANNOUNCEMENT":GOSUB 220:RETURN
2160 PLOT 3,0,21+ T,16+ FN B(T):PRINT H$(T);TAB( 4);
2170 PLOT 31* FL:PRINT B$(FN C(J(T)));A$(J(T));TAB( 8);:PLOT 15,23- FL
2180 M= 5:X= K(T):Y= L(T):GOSUB 280:GOSUB 260:Z= M(T):GOSUB 260
2190 M= 3:FOR N= 1TO 6:Z= H(N,T):GOSUB 260:NEXT :Z= I(T):GOSUB 260:PLOT 23:RETURN
2200 PLOT 3,39,21+ B,16+ B,23- FL
2210 M= 5:X= S(B):Y= T(B):GOSUB 280:GOSUB 260:M= 5:Z= R(B):GOSUB 260:X= Z
2220 Z= 0:Y= 0:FOR N= BTO T9STEP P9:Z= Z+ M(N):FOR O= 1TO 6:Y= Y+ H(O,N)* Q(O):NEXT O:NEXT N
2230 X= X+ Y+ Z::GOSUB 260:M= 5:Z= Y:GOSUB 260:M= 5:Z= X:GOSUB 260:PLOT 23:PRINT :RETURN
2240 PLOT 3,0,31:C= FN C(S):PRINT B$(C);A$(S):PLOT 3,5,31
2250 PLOT 48+ C,32,23- FL
2260 M= 4:X= D(S):Y= E(S):GOSUB 280:GOSUB 260
2270 FOR N= 1TO 6:Z= SGN (A(N,S))* P(N):GOSUB 260:NEXT N:PLOT 23:PRINT :RETURN
2280 X= 42+ INT (F(S)/ 2):Y= 10- INT (G(S)* .3):Z= LEN (A$(S))
2290 SX(S)= X:SY(S)= Y:IF X+ Z< 63THEN SX(S)= X+ 1
2300 IF X+ Z< 63THEN PLOT 3,X,Y:PRINT B$(FN C(S))"*"A$(S)"":RETURN
2310 PLOT 3,X- Z,Y:PRINT B$(FN C(S));A$(S)"*":RETURN
2320 N= INT ((D1- 1)/ 30):PLOT 3,0,3,6,3:PRINT M$(N+ 1);:M= 3:Z= D1- 30* N
2330 GOSUB 260:PRINT ",";:M= 5:Z= Y1:GOSUB 260
2340 M= 4:PRINT " (";:X= D1:Y= Y1:GOSUB 280:GOSUB 260:PRINT ")":RETURN
2350 IF Y> P(I)* X/ 10AND Y< P(I)* X* 10THEN E= 0:RETURN
2360 GOSUB 220:PRINT "WATCH YOUR TYPING":E= 1:RETURN
2370 H(I,T)= H(I,T)+ F* X
2380 I(T)= I(T)- F* X* (I< 5):M(T)= M(T)- F* Y:A(I,S)= A(I,S)- F* X:RETURN
2390 PLOT 3,SX(T2),SY(T2):PRINT B$(FN C(T2));A2$:RETURN