00001 option base 0 00002 declare all integer*2 00003 margin 0 00004 declare real*8 TOTALVALUE,TEMPVAL,MX,BS 00010 dim TMP$*2000,C$*256,UC$*256,FP$*6000,SLN$*2000,MOREC$*256 00011 dim M%(1 .. 9,1 .. 12)*1,MV(1 .. 5,1 .. 2) 00020 def SMV(R1,C1) 00021 let TMV=100 00022 if R1>1 then if M%(R1-1,C1)="*" then let TMV=TMV+500 00023 if R1<9 then if M%(R1+1,C1)="*" then let TMV=TMV+500 00024 if C1>1 then if M%(R1,C1-1)="*" then let TMV=TMV+500 00025 if C1<12 then if M%(R1,C1+1)="*" then let TMV=TMV+500 00026 let SMV=TMV 00027 end def 00030 def LEFT$(A$,LFT)=A$(1:LFT) 00031 def RIGHT$(A$,RGT)=A$(len(A$)-RGT+1:len(A$)) 00035 let SSN$="VJQNITGABELUFKW" 00036 let SLN$="Vaporware Soft-Products Jovan Motors Quest-Star Bank " 00037 let SLN$=SLN$&"Night Crawlers Inc. Integrated Meta Physics Twenty-Third Century Fox " 00038 let SLN$=SLN$&"Galagonautics LTD Andorian Teleport & Telepath Byte Dynamics " 00039 let SLN$=SLN$&"Electronic Courier Laser Shack Ultra-Blitz Computer Corp. " 00040 let SLN$=SLN$&"Fantastic Fusion Krypton Strip & Mine Warp-In Fast Foods, Inc. " 00045 def LOC$(R,C)=str$(R)&chr$(C+64) 00046 let MU$="" 00047 let MUPET,MUPID=0 00050 enable handler RESM, resume at 00060 00052 characteristics "ON","8BT","OFF","ST" 00056 linput wait 1, bytes 5, noecho, prompt chr$(30)&chr$(27)&chr$(0):MU$ 00060 if MU$(1:1)<>chr$(6) or MU$(5:5)<>chr$(6) then 00100 00070 let MUPET=ord(MU$(2:2)) 00075 let MUPID=ord(MU$(3:3))*256+ord(MU$(4:4)) 00076 if MUPET>0 then print chr$(140);chr$(2);chr$(30);chr$(128);chr$(7);"* Thank You For Using Mupet! Membership Has Its Privileges *";chr$(129);chr$(140);chr$(0);chr$(0) 00080 if MUPET>0 and MUPET<2 then print chr$(128)&chr$(141);"You are using an old version of Mupet! Upgrade to Version 2.0";chr$(129) 00100 if MUPET=0 then characteristics "OFF","8BT","ON","ST" 00101 if MUPET>=2 then print chr$(150);chr$(12); 00105 print "Traders Copyright (c) 1989 Wizard Workshop and Company" 00110 print "v1.6 All Rights Reserved";chr$(10) 00115 if MUPET>=2 then print chr$(151); 00120 handler RESM 00121 resume 00122 end handler 00150 enable handler RESM, resume at 00160 00152 type ":SDD:UDD:150A.Monroe:Traders.Welcome" 00155 linput prompt ">Press A Key<", bytes 1, wait 60, noecho:C$ 00156 print chr$(13);chr$(11) 00160 disable handler 00200 let TU$=":SDD:UDD:150A.Monroe:Traders.Users" ! User File 00210 let TG$=":SDD:UDD:150A.Monroe:Traders.Game" ! Game File 00220 let TA$="Per.Stoney,Oware 280.Stoney,Oware +,WR" 00250 enable handler RESM, resume at 00268 00260 open #1:TU$ outin, direct, internal, shared,fixed 24 00261 map US%*15; integer*2 UPID,UCON,UGAME 00265 goto 00300 00268 enable handler RESM, resume at 00276 00270 create TU$ replace 00271 print "%TRADERS-Information, Creating User File" 00272 acl TU$,TA$ 00275 goto 00260 00276 print "%TRADERS-Fatal, Unable to create User file" 00277 goto 09999 00300 enable handler RESM, resume at 00310 00302 open #2:TG$ outin, direct, internal, shared,fixed 640 00305 map STN%(1 .. 5)*1;GRID%(1 .. 9,1 .. 12)*1; real*8 STV(1 .. 5),UCASH(1 .. 4); integer*2 STS(1 .. 5),PREC(1 .. 4),PPID(1 .. 4),TURN,STAT,PLAY; integer*4 USTOCK(1 .. 4,1 .. 5) 00307 goto 00350 00310 enable handler RESM, resume at 00320 00312 create TG$ replace 00313 acl TG$,TA$ 00314 print "%TRADERS-Information, Creating Game File" 00315 goto 00302 00320 print "%TRADERS-Fatal, Unable to create Game file" 00321 goto 09999 00330 print "%TRADERS-Fatal, Unable to obtain user information for game play." 00332 goto 09999 00350 enable handler RESM, resume at 00330 00360 who into TMP$ 00361 let TM=pos(TMP$,":") 00362 let TMP=pos(TMP$," ",8) 00363 let PID=val(TMP$(TM+1:TMP-1)) 00370 let TMP=pos(TMP$," ",8) 00371 let TMP$=TMP$(TMP+1:len(TMP$)) 00375 let TMP=pos(TMP$,":") 00380 let USR$=TMP$(1:TMP-1) 00381 tree PID into TMP$ 00382 let TM=pos(TMP$,"FATHER: ") 00383 let TMP=pos(TMP$,",",TM) 00384 let PID=TMP$(TM+8:TMP-1) 00385 who PID into TMP$ 00386 if pos(TMP$,USR$&":CON"&str$(console))=0 then 00381 00387 goto 00400 00390 handler NOTLOGGEDON 00391 input #1 record USR data 00261 00392 let UGAME=0 00393 let US%="" 00394 output #1 record USR data 00261 00395 resume 00396 end handler 00400 let TUSR,USR=0 ! Determine which Terminal this is 00401 enable handler NOTLOGGEDON, resume at 00418 00402 characteristics "ON","FKT","WRP","OFF","NRM" 00405 let USR=USR+1 00406 randomize 00410 input #1 eof 00421, record USR data 00261 00411 if rtrm$(US%)=USR$ and UPID=PID and UCON=console then 00430 00412 if US%(1:1)<>" " then 00413 who UPID into TMP$ 00414 if pos(TMP$,rtrm$(US%)&":CON"&str$(UCON))=0 then 00415 let US%(1:1)=" " 00416 output #1 record USR data 00261 00417 end if 00418 end if 00419 if US%(1:1)=" " and TUSR=0 then let TUSR=USR 00420 goto 00405 00421 if TUSR>0 then let USR=TUSR 00430 let US%=USR$ 00432 let UPID=PID 00433 let UCON=console 00434 let UGAME=0 00440 output #1 record USR data 00261 00441 handler NOTONSYS 00442 input #1 eof 00445, record I data 00261 00443 let US%="" 00444 output #1 record I data 00261 00445 resume 00446 end handler 00447 input #1 record USR data 00261 00448 if rtrm$(US%)<>USR$ then 00400 00550 if MUPET>=2 then print chr$(150); 00560 print chr$(12);"* S T A R T R A D E R S *";chr$(10) 00570 if MUPET>=2 then print chr$(151); 00600 let I,PL=0 00601 if MUPET>=2 then print chr$(150); 00602 print chr$(20);"Current List of Players";chr$(21);chr$(10) 00603 enable handler NOTONSYS, resume at 00604 00604 let I=I+1 00605 input #1 eof 00633, record I data 00261 00606 who UPID into TMP$ 00607 if pos(TMP$,rtrm$(US%)&":CON"&str$(UCON))=0 then 00608 let US%="" 00609 let UGAME=0 00610 output #1 record I data 00261 00611 end if 00612 if US%(1:1)<>" " then 00613 print US%;" CON";str$(UCON);" "; 00614 if UGAME>0 then print "Playing Game #";UGAME; else if UGAME<-1 then print "Waiting for Game Notification" else if UGAME<0 then print "Waiting for Game in Forum" else print "Not Playing a Game Yet" 00615 if UGAME>0 then 00616 input #2 record UGAME data 00305 00617 if STAT=-1 then print " Turn #";TURN else if STAT=1 and PLAY<4 then print " **";4-PLAY;" More Allowed **" else print 00618 end if 00630 let PL=PL+1 00631 end if 00632 goto 00604 00633 input #1 record USR data 00261 00634 if PL=1 then print chr$(10);" 1 player active";chr$(10) else print chr$(10);PL;"players active";chr$(10) 00635 if MUPET>=2 then print chr$(151); 00637 if UGAME=-1 then 01146 01000 enable handler RESM, resume at 09000 01010 if MUPET>0 then print chr$(128);chr$(3); 01011 linput prompt "TRADERS> ", wait 60*10:C$; 01015 if MUPET>0 then print chr$(129); 01021 let C$=uprc$(ltrm$(rtrm$(C$))) 01022 let C=pos(C$," ") 01023 if C=0 then let C=len(C$)+1 01024 let MOREC$=ltrm$(rtrm$(C$(C:len(C$)))) 01025 print 01026 let C$=rtrm$(C$(1:C)) 01027 let C=len(C$) 01029 if C>0 and LEFT$("STOP",C)=C$ and C<5 and USR$="PER.STONEY" then stop 01030 if C>0 and LEFT$("BYE",C)=C$ and C<4 then 09010 01031 if C>0 and LEFT$("QUIT",C)=C$ and C<5 then 09010 01032 if C>0 and LEFT$("EXIT",C)=C$ and C<5 then 09010 01033 if C>0 and LEFT$("HELP",C)=C$ and C<5 then 01105 01034 if C$="?" then 01105 01035 if C>0 and LEFT$("STATUS",C)=C$ and C<7 then 00600 01036 if C>0 and LEFT$("MONITOR",C)=C$ and C<87 then 00600 01037 if C>0 and LEFT$("WHO",C)=C$ and C<4 then 00600 01040 if C>0 and LEFT$("TIME",C)=C$ and C<5 then 01041 print time$ 01042 goto 01000 01043 end if 01045 if C>0 and LEFT$("DATE",C)=C$ and C<5 then 01046 print date$ 01047 goto 01000 01048 end if 01050 if C>0 and LEFT$("FORUM",C)=C$ and C<6 then 01140 01060 if C>0 and LEFT$("NOTIFY",C)=C$ and C<7 then 09050 01070 if C>0 and LEFT$("PLAY",C)=C$ and C<5 then 01300 01100 print "Unknown command. Enter HELP for assistance." 01101 goto 01010 01105 if MUPET>=2 then print chr$(150); 01106 print chr$(12);chr$(20);"** STAR TRADERS COMMAND LIST **";chr$(21);chr$(10) 01107 print "BYE -- Leave Star Traders DATE -- Display the Date" 01108 print "HELP -- Show Valid Commands TIME -- Display the Time" 01109 print chr$(10);"STATUS -- Show status of players" 01110 print "FORUM -- Communication Area" 01111 print chr$(10);"NOTIFY -- Leave Traders, but Notify about Games" 01120 print "PLAY -- Start / Join a Game" 01129 if MUPET>=2 then print chr$(151);chr$(10);chr$(10) else print chr$(10);chr$(10) 01130 goto 01000 01131 handler FORUM 01132 if excode=71160 then print "Line length was too long." 01133 if excode=70736 then print "Console Interrupt Detected." 01138 resume 01139 end handler 01140 print chr$(12);chr$(20);"** STAR TRADERS FORUM ** Enter /HELP for Assistance /BYE to return";chr$(21);chr$(10) 01141 input #1 record USR data 00261 01142 let UGAME,ENTERFORUM=-1 01143 output #1 record USR data 00261 01144 let C$=" has just entered the forum." 01145 goto 01160 01146 enable handler FORUM, resume at 01147 01147 input #1 record USR data 00261 01148 if UGAME=0 then 01000 01149 linput eof 09010, prompt "":C$; 01150 let ENTERFORUM=0 01151 print 01152 let UC$=uprc$(ltrm$(rtrm$(C$))) 01153 if fkey=2 then let UC$="/"&UC$ 01154 if UC$="/BYE" or UC$="/EXIT" or UC$="/QUIT" or UC$="/DONE" or fkey=8 or fkey=42 or fkey=58 then 01190 01155 if fkey=4 or UC$="/HELP" or UC$="/?" then 01198 01156 if UC$="/WHO" or UC$="/W" or UC$="/WH" then 00600 01157 if UC$(1:1)="/" then print "Unknown command. Enter /HELP for assistance or /BYE to leave." 01159 if UC$(1:1)="/" then 01146 01160 let I=0 01161 let I=I+1 01162 input #1 eof 01146, record I data 00261 01163 if ENTERFORUM=-1 then if UGAME=-2 then 01165 01164 if UGAME<>-1 then 01161 01165 enable handler XMIT, resume at 01161 01166 who UPID into TMP$ 01167 if pos(TMP$,rtrm$(US%)&":CON"&str$(UCON))=0 then 01168 let US%="" 01169 let UGAME=0 01170 output #1 record I data 00261 01174 goto 01161 01175 end if 01180 if UGAME=-2 then send UPID,chr$(14)&chr$(13)&"**STAR TRADERS**"&chr$(15)&chr$(11)&chr$(10)&"<"&rtrm$(USR$)&"> "&C$&chr$(11) else send UPID,chr$(13)&"<"&rtrm$(USR$)&"> "&C$&chr$(11) 01181 goto 01161 01182 handler XMIT 01183 if excode<>100 and excode<>71 then print excode,excode$ 01185 resume 01186 end handler 01190 input #1 record USR data 00261 01191 let UGAME=0 01192 output #1 record USR data 00261 01194 let ENTERFORUM=-1 01195 let C$=" has just left the forum." 01197 goto 01160 01198 print "To enter a command, type / followed by the command.";chr$(10);chr$(10);"/HELP -- This list /BYE -- Leave the Forum /WHO -- Star Trader Users" 01199 goto 01149 01220 print "You may either specify a game number, or just enter PLAY to enter a fresh game." 01230 goto 01000 01240 print "Invalid game number. Use STATUS to determine an available game." 01250 goto 01000 01260 print "No such game exists." 01265 goto 01240 01300 if MOREC$="" then 02000 01310 enable handler RESM, resume at 01220 01320 let G=val(MOREC$) 01330 if G<1 or G<>int(G) then 01240 01340 input #2 eof 01260, record G data 00305 01350 goto 03000 02000 let G2,G,I=0 ! Find and select a game 02001 disable handler 02010 let I=I+1 02020 input #2 eof 02032, record I data 00305 02021 if STAT=1 and G=0 then let G=I 02022 if G>0 then 03000 02023 if STAT=0 and G2=0 then let G2=I 02030 goto 02010 02032 if G2>0 then let G=G2 else let G=I 02040 for I=1 to 5 02041 let STN%(I)=" " 02042 let STV(I)=0 02043 let STS(I)=0 02044 next I 02050 for I=1 to 4 02051 let PREC(I)=0 02052 let PPID(I)=0 02053 for J=1 to 5 02054 let USTOCK(I,J)=0 02055 next J 02056 let UCASH(I)=6000 02058 next I 02059 let TURN,STAT,PLAY=0 02060 for R=1 to 9 02062 for C=1 to 12 02065 let GRID%(R,C)="." 02067 next C 02068 randomize 02069 next R 02070 for I=1 to int(rnd*3)+5 02071 let R=int(rnd*9)+1 02072 let C=int(rnd*12)+1 02073 if GRID%(R,C)="*" then 02071 else let GRID%(R,C)="*" 02074 next I 02080 output #2 record G data 00305 02081 let I=0 02082 enable handler NOTONSYS, resume at 02085 02085 let I=I+1 02086 input #1 eof 03000, record I data 00261 02087 if UGAME<1 then 02088 who UPID into TMP$ 02089 if pos(TMP$,rtrm$(US%)&":CON"&str$(UCON))=0 then 02090 let US%="" 02091 let UGAME=0 02092 output #1 record I data 00261 02094 end if 02095 if UGAME<1 and len(rtrm$(US%))<>0 then send UPID,chr$(13)&chr$(11)&chr$(14)&"** STAR TRADERS GAME "&str$(G)&" IS STARTING **"&chr$(15) ! STAR TRADERS STARTING! 02096 end if 02097 goto 02085 03000 print "** Star Traders ** GAME #";G 03001 input #2 record G data 00305 03002 if TURN=0 then let STAT=1 else if TURN>PLAY then let STAT=-1 03003 output #2 record G data 00305 03004 for I=1 to 4 03005 if PREC(I)=0 then 03010 03006 next I 03007 print "There are already enough players in this game." 03008 goto 01000 03010 input #2 record G data 00305 03011 if PREC(I)<>0 or PLAY>=4 then 03004 03012 let PREC(I)=USR 03013 let PPID(I)=PID 03014 let PLAY=PLAY+1 03015 output #2 record G data 00305 03016 input #2 record G data 00305 03017 if PREC(I)<>USR and PPID(I)<>PID then 03001 03018 if I=4 then 03019 input #2 record G data 00305 03020 let STAT=-1 03021 output #2 record G data 00305 03022 input #2 record G data 00305 03023 if STAT<>-1 then 03020 03024 end if 03025 print "You are player #";I;" H = Help" 03027 let PLAYER=I 03028 if PLAYER=1 and TURN=0 then print "Waiting for more players before game can start..." 03030 input #1 record USR data 00261 03032 let UGAME=G 03035 output #1 record USR data 00261 03040 for I=1 to 5 03041 let MV(I,1),MV(I,2)=0 03043 next I 03050 let C$=USR$&" has entered the game as player #"&str$(PLAYER) 03055 gosub 08410 03100 input #2 record G data 00305 ! PROCESS MOVE 03110 if TURN=49 then 03111 print "The game is over on turn #49";chr$(10) 03112 gosub 04008 03115 goto 08500 03120 end if 03150 if STAT=0 then print "The game is over on turn #";TURN 03152 if TURN>0 and PLAY<2 then print "Not enough players to continue." 03154 if TURN>0 and PLAY<2 then 08500 03155 if STAT=0 then 08500 03156 if TURN=0 and PLAY>1 then 03158 let TURN=TURN+1 03160 output #2 record G data 00305 03162 end if 03164 let PUSHPLAYER=0 03166 if TURN>0 and mod(TURN-1,4)+1=PLAYER then 04200 03167 if TURN>0 then 03168 if PREC(mod(TURN-1,4)+1)=0 then 03170 for I=1 to 4 03172 if PREC(I)<>0 then 03179 03176 next I 03178 goto 03500 03179 if I<>PLAYER then 03500 03180 let PUSHPLAYER=PLAYER 03182 let PUSHUSR$=USR$ 03184 let PLAYER=mod(TURN-1,4)+1 03186 let USR$="Computer #"&str$(PLAYER) 03188 goto 04200 03190 else 03200 input #1 record PREC(mod(TURN-1,4)+1) data 00261 03210 if rtrm$(US%)="" or UGAME<>G then 03220 let UGAME,UPID,UCON=0 03222 let US%="" 03225 output #1 record PREC(mod(TURN-1,4)+1) data 00261 03230 input #2 record G data 00305 03232 let PREC(mod(TURN-1,4)+1)=0 03234 output #2 record G data 00305 03240 goto 03100 03250 end if 03255 end if 03256 end if 03500 enable handler RESM, resume at 03100 03510 linput prompt "", bytes 1, wait 1:C$ 03519 let C$=uprc$(C$) 03520 if C$="*" or C$="Q" then 08500 03521 let CMD$=C$ 03522 gosub 07100 03523 if CMD=-1 then 03100 03524 if USR$="PER.STONEY" and C$="@" then stop 03529 if MUPET>=2 then print chr$(150);chr$(128);chr$(7); 03530 print chr$(10);"Illegal Command. Press H for help." 03539 if MUPET>=2 then print chr$(129);chr$(151); 03540 goto 03100 03541 gosub 05000 03542 goto 03100 03543 gosub 08400 03544 goto 03100 03545 gosub 04500 03546 goto 03100 03547 gosub 04600 03548 goto 03100 03550 if MUPET>=2 then print chr$(150);chr$(10);chr$(10) else print chr$(10);chr$(10) 03551 if MUPET>0 then print chr$(128);chr$(7); 03552 print "M - Show the current map" 03553 print "S - Shows your stock portfolio" 03554 print "P - Show currect stock prices" 03555 print "C - Shows your current cash";chr$(10) 03556 print "? - Shows all players and their worth";chr$(10) 03557 print ". - Display current turn" 03558 print "> - Talk to other players in the game" 03559 print "Q - Quits the game" 03560 rem STONEY if USR$="PER.STONEY" then print "@ - Force a turn (DEBUGGING)" 03561 if MUPET>0 then print chr$(129); 03562 if MUPET>=2 then print chr$(151); 03569 return 03570 input #2 record G data 00305 03575 print chr$(10);chr$(10);"Turn #";str$(TURN);" ";date$;" ";time$ 03576 if TURN<1 then print "Waiting for more players..." 03577 if TURN<1 then return 03578 if PREC(mod(TURN-1,4)+1)>0 then input #1 record PREC(mod(TURN-1,4)+1) data 00261 else let US%="Computer #"&str$(mod(TURN-1,4)+1) 03579 print rtrm$(US%);"'s Move";chr$(10) 03580 return 04000 input #2 record G data 00305 04002 print chr$(10);chr$(10);"You have $";ltrm$(format$(int(UCASH(PLAYER)+.5),"###########")) 04005 return 04008 input #2 record G data 00305 04011 print chr$(10);chr$(10);"Turn #";str$(TURN) 04012 print "Player Worth:" 04015 for I=1 to 4 04016 if TURN<1 or TURN>48 then print " "; else if mod(TURN-1,4)+1<>I then print " "; else if MUPET>0 then print chr$(128);chr$(15);"-->";chr$(129); else print "-->"; 04017 if PREC(I)>0 then input #1 record PREC(I) data 00261 else let US%="Computer #"&str$(I) 04018 let TOTALVALUE=0 04019 for J=1 to 5 04020 let TOTALVALUE=TOTALVALUE+USTOCK(I,J)*STV(J) 04021 next J 04025 print US%;" $ ";format$(int(UCASH(I)+TOTALVALUE+.5),"###########") 04030 next I 04035 return 04040 input #2 record G data 00305 ! Compute Valid Moves 04041 let TC=0 04042 for I=1 to 5 04043 if STN%(I)<>" " then let TC=TC+1 04044 next I 04045 mat M%=GRID% 04046 for I=1 to 5 04047 let R=int(rnd*9)+1 04048 let C=int(rnd*12)+1 04049 if M%(R,C)<>"." then 04047 04050 if TC>=5 then 04051 let ADJ$="" 04052 if R>1 and pos("o.",M%(R-1,C))=0 then let ADJ$=ADJ$&M%(R-1,C) 04053 if R<9 and pos("o.",M%(R+1,C))=0 then let ADJ$=ADJ$&M%(R+1,C) 04054 if C>1 and pos("o.",M%(R,C-1))=0 then let ADJ$=ADJ$&M%(R,C-1) 04055 if C<12 and pos("o.",M%(R,C+1))=0 then let ADJ$=ADJ$&M%(R,C+1) 04060 for J=1 to len(ADJ$) 04061 if pos(SSN$,ADJ$(J:J))>0 then 04150 04062 next J 04065 if ADJ$<>"" then 04047 04070 end if 04080 if TC>=5 and ADJ$="" and rnd>.6 then 04047 04150 let MV(I,1)=R 04151 let MV(I,2)=C 04152 let M%(R,C)="o" 04153 next I 04154 return 04200 input #2 record G data 00305 04201 if PUSHPLAYER>0 or mod(TURN-1,4)+1=PLAYER then 04209 04202 if PREC(PLAYER)<>USR or PPID(PLAYER)<>PID then 04203 let PREC(PLAYER)=USR 04204 let PPID(PLAYER)=PID 04205 output #2 record G data 00305 04206 end if 04209 gosub 04040 ! Handle Move 04210 if PREC(PLAYER)>0 then 04211 gosub 05000 04212 else 04213 let R=MV(1,1) 04214 let C=MV(1,2) 04215 goto 04360 04216 end if 04217 let P$="Move #"&str$(TURN)&" (" 04218 for I=1 to 5 04219 let P$=P$&LOC$(MV(I,1),MV(I,2)) 04220 if I<5 then let P$=P$&"," else let P$=P$&") " 04221 next I 04222 print P$; 04223 linput prompt "", bytes 1:R$ 04224 if R$="#" then 04225 input #2 record G data 00305 04226 let PLAY=4 04227 let STAT=-1 04229 output #2 record G data 00305 04230 print " GAME LOCK-OUT IN PROGRESS -- NO MORE PLAYERS ALLOWED #";chr$(10) 04231 goto 04222 04232 end if 04233 if R$="Q" or R$="*" then 04234 input #2 record G data 00305 04235 let TURN=TURN+1 04236 output #2 record G data 00305 04237 goto 08500 04238 end if 04251 let R$=uprc$(R$) 04255 if pos("123456789",R$)>0 then 04270 04260 let CMD$=R$ 04261 gosub 07100 04265 print chr$(13);chr$(11); 04266 goto 04222 04270 linput prompt "", bytes 1, noecho:C$ 04271 let C$=uprc$(C$) 04273 if pos("ABCDEFGHIJKL",C$)>0 then 04280 04274 print chr$(25);" ";chr$(25); 04275 goto 04223 04280 print C$; 04300 linput prompt "", bytes 1, noecho:DUM$ 04301 if DUM$=chr$(10) or DUM$=chr$(13) then 04309 04302 print chr$(25);" ";chr$(25); 04304 goto 04270 04309 let R=ord(R$)-48 04310 let C=ord(C$)-64 04320 print 04350 for I=1 to 5 04352 if MV(I,1)=R and MV(I,2)=C then 04360 04353 next I 04354 print "Invalid Move. Select from available positions. (Marked with 'o'.)" 04355 goto 04222 04360 for I=1 to 5 04361 let MV(I,1),MV(I,2)=0 04362 next I 04380 goto 05200 04500 input #2 record G data 00305 ! Show Stocks 04501 if MUPET>=2 then print chr$(150); 04502 let TMP$=chr$(10)&chr$(10)&"Stock Prices"&chr$(10) 04504 let SC=0 04505 if MUPET>0 then print chr$(128);chr$(14); 04506 for I=1 to 5 04508 if STN%(I)=" " then 04522 ! End of next loop 04510 let NC=pos(SSN$,STN%(I)) 04512 if NC=0 then 04522 ! end of next loop 04514 let TMP$=TMP$&" "&SLN$((NC-1)*40+1:(NC-1)*40+39)&" " 04516 let TMP$=TMP$&"$"&RIGHT$(" "&str$(int(STV(I)+.5)),4)&" ( " 04518 let TMP$=TMP$&"$"&RIGHT$(" "&str$(int(STV(I)*.75+.5)),4)&" )"&chr$(10) 04520 let SC=SC+1 04522 next I 04524 print 04526 if SC=0 then let TMP$=TMP$&" No companies have been formed." else let TMP$=TMP$&"Selling price is in parentheses."&chr$(10) 04527 print TMP$ 04528 if MUPET>0 then print chr$(129); 04529 if MUPET>=2 then print chr$(151); 04530 return 04600 input #2 record G data 00305 ! Stock Portfolio 04602 print chr$(10);chr$(10);"***** Stock Portfolio *****";chr$(10) 04604 let SC,TOTALVALUE=0 04606 for I=1 to 5 04608 if USTOCK(PLAYER,I)=0 then 04630 04610 let NC=pos(SSN$,STN%(I)) 04615 print SLN$((NC-1)*40+1:(NC-1)*40+39) 04617 print " Price per share:";STV(I) 04618 print " Shares held:";USTOCK(PLAYER,I) 04620 print " Value of shares: $";format$(int(USTOCK(PLAYER,I)*STV(I)+.5),"###########") 04622 print 04625 let TOTALVALUE=TOTALVALUE+USTOCK(PLAYER,I)*STV(I) 04630 next I 04632 print "Total worth: $";format$(int(TOTALVALUE+.5),"###########");chr$(10) 04635 return 05000 input #2 record G data 00305 ! Display Map 05006 disable handler 05010 mat M%=GRID% 05011 for I=1 to 5 05012 if MV(I,1)=0 or MV(I,2)=0 then 05100 05020 let M%(MV(I,1),MV(I,2))="o" 05030 next I 05040 if MUPET>0 then let FP$=chr$(128)&chr$(9) else let FP$="" 05100 let FP$=chr$(10)&chr$(10)&"*** Map of the Galaxy ***"&chr$(10) 05110 for R=1 to 9 05111 if MUPET>0 then let FP$=FP$&chr$(128)&chr$(14)&str$(R)&" " else let FP$=FP$&str$(R)&" " 05112 for C=1 to 12 05120 if MUPET=0 then let FP$=FP$&M%(R,C)&" " else if pos(".*+",M%(R,C))>0 then let FP$=FP$&chr$(128)&chr$(15)&M%(R,C)&" " else let FP$=FP$&chr$(128)&chr$(mod(pos(SSN$,M%(R,C)),14)+1)&M%(R,C)&" " 05130 next C 05140 let FP$=rtrm$(FP$)&chr$(10) 05150 next R 05151 if MUPET>0 then let FP$=FP$&chr$(128)&chr$(14) 05160 let FP$=FP$&chr$(10)&" A B C D E F G H I J K L"&chr$(10)&chr$(10) 05162 if MUPET>=2 then print chr$(150); 05170 print FP$ 05171 if MUPET>0 then print chr$(129); 05172 if MUPET>=2 then print chr$(151); 05180 return 05200 rem PROCESS MOVE 05210 let OUTPOSTS,STARS=0 05211 let ADJC$,OLST$="" ! adjoining companies 05220 if R<9 then ! check R+1,C 05221 if GRID%(R+1,C)="+" then let OUTPOSTS=OUTPOSTS+1 05222 if GRID%(R+1,C)="*" then let STARS=STARS+1 05223 if pos(".*+",GRID%(R+1,C))=0 then if pos(ADJC$,GRID%(R+1,C))=0 then let ADJC$=ADJC$&GRID%(R+1,C) 05224 if GRID%(R+1,C)="+" then let OLST$=OLST$&chr$(R+1)&chr$(C) 05226 end if 05230 if R>1 then ! check r+1, c 05231 if GRID%(R-1,C)="+" then let OUTPOSTS=OUTPOSTS+1 05232 if GRID%(R-1,C)="*" then let STARS=STARS+1 05233 if pos(".*+",GRID%(R-1,C))=0 then if pos(ADJC$,GRID%(R-1,C))=0 then let ADJC$=ADJC$&GRID%(R-1,C) 05234 if GRID%(R-1,C)="+" then let OLST$=OLST$&chr$(R-1)&chr$(C) 05236 end if 05240 if C>1 then ! check r,c-1 05241 if GRID%(R,C-1)="+" then let OUTPOSTS=OUTPOSTS+1 05242 if GRID%(R,C-1)="*" then let STARS=STARS+1 05243 if pos(".+*",GRID%(R,C-1))=0 then if pos(ADJC$,GRID%(R,C-1))=0 then let ADJC$=ADJC$&GRID%(R,C-1) 05244 if GRID%(R,C-1)="+" then let OLST$=OLST$&chr$(R)&chr$(C-1) 05246 end if 05250 if C<12 then ! check r,c+1 05251 if GRID%(R,C+1)="+" then let OUTPOSTS=OUTPOSTS+1 05252 if GRID%(R,C+1)="*" then let STARS=STARS+1 05253 if pos(".+*",GRID%(R,C+1))=0 then if pos(ADJC$,GRID%(R,C+1))=0 then let ADJC$=ADJC$&GRID%(R,C+1) 05254 if GRID%(R,C+1)="+" then let OLST$=OLST$&chr$(R)&chr$(C+1) 05256 end if 05300 rem print "Adjacent Stars: ";STARS 05301 rem print "Value of space: ";SMV(R,C) 05310 rem print "Adjacent Outposts: ";OUTPOSTS 05320 rem print "Adjacent Companies: ";ADJC$ 05330 input #2 record G data 00305 05400 if len(ADJC$)=1 then 05402 let NC=pos(SSN$,ADJC$) 05410 for I=1 to 5 05412 if STN%(I)=ADJC$ then 05420 05413 next I 05415 input #2 record G data 00305 05420 let NP=I 05421 let GRID%(R,C)=ADJC$ 05422 let STV(NP)=STV(NP)+SMV(R,C) 05423 let STS(NP)=STS(NP)+1 05430 output #2 record G data 00305 05440 goto 05850 05450 end if 05500 if len(ADJC$)>1 then ! Stock Merger 05502 let ADJI$,TBS$="" 05504 let TOTALVALUE=0 05505 let WR=R 05506 let WC=C 05510 for I=1 to len(ADJC$) 05512 for J=1 to 5 05514 if ADJC$(I:I)=STN%(J) then 05520 05516 next J 05520 let NP=J 05522 let ADJI$=ADJI$&chr$(NP) 05523 let TEMPVAL=STS(NP)*STV(NP) 05525 if TEMPVAL=TOTALVALUE then 05527 let TBS$=TBS$&ADJC$(I:I) 05530 else 05532 if TEMPVAL>TOTALVALUE then 05534 let TBS$=ADJC$(I:I) 05535 let TOTALVALUE=TEMPVAL 05540 end if 05541 end if 05545 next I 05550 if len(TBS$)>1 then 05551 if PREC(PLAYER)=0 then let BS$=chr$(10) 05552 if PREC(PLAYER)=0 then 05561 05553 print "Please decide which company will win the merger:" 05554 print "("; 05556 for I=1 to len(TBS$) 05557 print TBS$(I:I);", "; 05558 next I 05559 print "=Either) "; 05560 linput prompt "", bytes 1:BS$ 05561 if BS$=chr$(10) or BS$=chr$(13) then 05562 let I=int(rnd*len(BS$))+1 05563 let BS$=TBS$(I:I) 05564 end if 05565 print 05566 let BS$=uprc$(BS$) 05567 let CMD$=BS$ 05568 gosub 07100 05569 if CMD=-1 then 05553 05580 if pos(SSN$,BS$)=0 then print "That is not a stock you may chose from." 05581 if pos(SSN$,BS$)=0 then 05552 05582 else 05583 let BS$=TBS$(1:1) 05584 end if 05590 let I=pos(ADJC$,BS$) 05591 if I=0 then print "%TRADERS-Error, Unable to locate winning company in adjacent list" 05592 let BNP=ord(ADJI$(I:I)) 05593 let TMP$=ADJC$(I+1:len(ADJC$)) 05594 let ADJC$=ADJC$(0:I-1)&TMP$ 05596 let TMP$=ADJI$(I+1:len(ADJI$)) 05597 let ADJI$=ADJI$(0:I-1)&TMP$ 05600 rem STONEY if USR$="PER.STONEY" then print "Company ";BS$;" takes over compan(y/ies): ";ADJC$ 05604 let NC=pos(SSN$,BS$) 05605 let BSN$=SLN$((NC-1)*40+1:(NC-1)*40+39) 05610 for MC=1 to len(ADJC$) 05612 let NP=ord(ADJI$(MC:MC)) 05613 input #2 record G data 00305 05614 let STS(BNP)=STS(BNP)+STS(NP) 05615 let STS(NP)=0 05616 let STV(BNP)=STV(BNP)+STV(NP) 05618 let STV(NP)=0 05619 output #2 record G data 00305 05620 let NC=pos(SSN$,ADJC$(MC:MC)) 05624 let LSN$=rtrm$(SLN$((NC-1)*40+1:(NC-1)*40+39)) 05625 let C$=LSN$&" has just been merged"&chr$(10)&"into "&rtrm$(BSN$) 05626 gosub 08410 05627 enable handler RESM, resume at 05650 05630 for P=1 to 4 05632 input #2 record G data 00305 05635 if USTOCK(P,NP)<1 then 05650 05640 let C$=LSN$&chr$(10)&" Old holdings: "&str$(USTOCK(P,NP))&chr$(10)&chr$(10)&BSN$&chr$(10)&" Shares gained: "&str$(int(USTOCK(P,NP)/2)) 05645 let USTOCK(P,BNP)=USTOCK(P,BNP)+int(USTOCK(P,NP)/2) 05647 output #2 record G data 00305 05648 if PPID(P)>0 then send PPID(P),chr$(13)&chr$(11)&C$ 05650 next P 05651 input #2 record G data 00305 05652 let STN%(NP)=" " 05653 output #2 record G data 00305 05654 disable handler 05655 next MC 05660 for R=1 to 9 05661 for C=1 to 12 05662 if pos(ADJC$,GRID%(R,C))>0 then let GRID%(R,C)=BS$ 05663 next C 05664 next R 05665 output #2 record G data 00305 05666 for J=1 to len(ADJI$) 05667 let NP=ord(ADJI$(J:J)) 05670 for P=1 to 4 05671 if USTOCK(P,NP)=0 then 05754 05672 let C$=BSN$&chr$(10)&" Total Shares: "&str$(USTOCK(P,BNP)) 05673 if PPID(P)>0 then send PPID(P),chr$(13)&chr$(11)&C$ 05680 input #2 record G data 00305 05750 let USTOCK(P,NP)=0 05752 output #2 record G data 00305 05754 next P 05756 next J 05758 input #2 record G data 00305 05760 let GRID%(WR,WC)=BS$ 05762 let STS(BNP)=STS(BNP)+1 05764 let STV(BNP)=STV(BNP)+SMV(WR,WC) 05766 output #2 record G data 00305 05768 let NP=BNP 05770 let NC=pos(SSN$,BS$) 05772 goto 05900 05774 end if 05800 if OUTPOSTS=0 and STARS=0 then 05802 let GRID%(R,C)="+" 05803 output #2 record G data 00305 05804 let C$=USR$(1:1)&lwrc$(USR$(2:len(USR$)))&" creates an outpost at "&LOC$(R,C) 05808 gosub 08410 05810 goto 06000 05812 end if 05813 input #2 record G data 00305 05814 for I=1 to 5 ! Form a new corporation 05816 if STN%(I)=" " then 05824 05818 next I 05820 print "%TRADERS-Error, Unable to produce a corporation." 05822 goto 06000 05824 let NP=I 05826 let NC=int(rnd*len(SSN$))+1 05828 for I=1 to 5 05830 if STN%(I)=SSN$(NC:NC) then 05826 05832 next I 05834 input #2 record G data 00305 05835 let STN%(NP)=SSN$(NC:NC) 05836 let STV(NP)=SMV(R,C) 05837 let STS(NP)=1 05838 for I=1 to 4 05839 let USTOCK(I,NP)=0 05840 next I 05842 let USTOCK(PLAYER,NP)=5 05843 let GRID%(R,C)=SSN$(NC:NC) 05844 output #2 record G data 00305 05846 let C$="A budding corporate empire has been formed!"&chr$(10)&"Its name is: "&rtrm$(SLN$((NC-1)*40+1:(NC-1)*40+39)) 05848 gosub 08410 05850 let C$=USR$(1:1)&lwrc$(USR$(2:len(USR$)))&" adds to "&rtrm$(SLN$((NC-1)*40+1:(NC-1)*40+39))&" at "&LOC$(R,C) 05852 gosub 08410 05900 if OLST$="" then 06000 ! Spread over + 05904 let R=ord(OLST$(1:1)) 05906 let C=ord(OLST$(2:2)) 05908 let OLST$=OLST$(3:len(OLST$)) 05910 if R>1 then if M%(R-1,C)="+" then let OLST$=OLST$&chr$(R-1)&chr$(C) 05912 if R<9 then if M%(R+1,C)="+" then let OLST$=OLST$&chr$(R+1)&chr$(C) 05914 if C>1 then if M%(R,C-1)="+" then let OLST$=OLST$&chr$(R)&chr$(C-1) 05916 if C<12 then if M%(R,C+1)="+" then let OLST$=OLST$&chr$(R)&chr$(C+1) 05917 input #2 record G data 00305 05918 let GRID%(R,C)=SSN$(NC:NC) 05919 let STS(NP)=STS(NP)+1 05920 let STV(NP)=STV(NP)+SMV(R,C) 05921 output #2 record G data 00305 05922 goto 05900 06000 input #2 record G data 00305 ! Did any Stocks Split 06010 for NP=1 to 5 06020 if int(STV(NP)+.5)<3000 or pos(SSN$,STN%(NP))=0 then 06500 06030 let NC=pos(SSN$,STN%(NP)) 06040 let C$=rtrm$(SLN$((NC-1)*40+1:(NC-1)*40+39))&"'s stock has split." 06050 gosub 08410 06060 input #2 record G data 00305 06062 let STV(NP)=int((STV(NP)+.5)/2) 06070 for I=1 to 4 06072 let USTOCK(I,NP)=USTOCK(I,NP)*2 06074 next I 06080 output #2 record G data 00305 06090 goto 06020 06500 next NP 06700 input #2 record G data 00305 ! Compute Dividends 06701 let TOTALVALUE=0 06702 for I=1 to 5 06704 let TOTALVALUE=TOTALVALUE+USTOCK(PLAYER,I)*STV(I) 06706 next I 06708 let TOTALVALUE=int(TOTALVALUE/20+.5) 06710 if PREC(PLAYER)>0 then print "Your stocks pay dividends of $";ltrm$(format$(TOTALVALUE,"###########")) 06712 let UCASH(PLAYER)=UCASH(PLAYER)+TOTALVALUE 06714 output #2 record G data 00305 06716 let VS$,P$="" ! Sell stock routine 06718 for I=1 to 5 06720 if USTOCK(PLAYER,I)>0 then let P$=P$&STN%(I)&", " 06722 if USTOCK(PLAYER,I)>0 then let VS$=VS$&STN%(I) 06724 next I 06726 if VS$="" then 06796 06727 if PREC(PLAYER)=0 then 07000 06728 print "SELL (";P$;"=Done)? "; 06730 linput prompt "", bytes 1:C$ 06732 let C$=uprc$(C$) 06734 if pos(chr$(10)&chr$(13),C$)>0 then 06796 06736 print 06738 if pos(VS$,C$)>0 then 06748 06739 let CMD$=C$ 06740 gosub 07100 06741 if CMD=-1 then 06728 06744 if pos(SSN$,C$)>0 then print "You do not have stock in that company." 06745 if pos(SSN$,C$)>0 then 06728 06746 print "Unknown Stock." 06747 goto 06728 06748 let NC=pos(SSN$,C$) 06750 print SLN$((NC-1)*40+1:(NC-1)*40+39) 06752 for NP=1 to 5 06754 if STN%(NP)=C$ then 06764 06756 next NP 06758 print "%TRADERS-Error, Unable to locate stock to sell." 06760 goto 06796 06762 print "That's not a legal value!" 06764 print " Selling price per share: $";str$(int(STV(NP)*.75+.5)) 06766 print "You have $";ltrm$(format$(int(UCASH(PLAYER)+.5),"###########")) 06768 print "How many shares to sell (Max=";str$(USTOCK(PLAYER,NP));")? "; 06770 linput prompt "":C$ 06772 let C$=ltrm$(rtrm$(C$)) 06774 if C$="" then 06716 06776 enable handler RESM, resume at 06762 06778 let NS=val(C$) 06780 if NS=0 then 06716 06782 if NS<0 or NS<>int(NS) then 06762 06784 if NS>USTOCK(PLAYER,NP) then print "That is more stock that you own." 06786 if NS>USTOCK(PLAYER,NP) then 06716 06788 let UCASH(PLAYER)=UCASH(PLAYER)+NS*STV(NP)*.75 06790 let USTOCK(PLAYER,NP)=USTOCK(PLAYER,NP)-NS 06792 output #2 record G data 00305 06794 goto 06716 06796 let KS$,VS$,P$="" ! BUY STOCK 06798 for I=1 to 5 06800 if STN%(I)<>" " and int(UCASH(PLAYER)+.5)>=int(STV(I)+.5) then let VS$=VS$&STN%(I) 06802 if STN%(I)<>" " and int(UCASH(PLAYER)+.5)>=int(STV(I)+.5) then let P$=P$&STN%(I)&", " 06804 if STN%(I)<>" " then let KS$=KS$&STN%(I) 06806 next I 06808 if VS$="" then 07000 06809 if PREC(PLAYER)=0 then if len(P$)>1 then 06815 else 07000 06810 print "BUY (";P$;"=Done)? "; 06812 linput prompt "", bytes 1:C$ 06814 print 06815 if PREC(PLAYER)=0 then let I=int(rnd*len(P$))+1 06816 if PREC(PLAYER)=0 and pos(SSN$,P$(I:I))=0 then 06815 06817 if PREC(PLAYER)=0 then let C$=P$(I:I) 06819 let C$=uprc$(C$) 06820 if pos(chr$(10)&chr$(13),C$)>0 then 07000 06821 if pos(VS$,C$)>0 then 06834 06822 if pos(KS$,C$)>0 then print "You do not have enough cash to purchase that stock." 06823 if pos(KS$,C$)>0 then 06810 06824 let CMD$=C$ 06825 gosub 07100 06826 if CMD=-1 then 06810 06827 if pos(SSN$,C$)>0 then print "That company does not exist." 06828 if pos(SSN$,C$)>0 then 06810 06830 print "Unknown company." 06832 goto 06810 06834 for I=1 to 5 06836 if STN%(I)=C$ then 06844 06838 next I 06840 print "%TRADERS-Error, Unable to locate stock to buy" 06842 goto 07000 06844 let NP=I 06846 let NC=pos(SSN$,C$) 06847 if PREC(PLAYER)=0 then 06854 06848 print SLN$((NC-1)*40+1:(NC-1)*40+39) 06850 print " Buying price per share: $";str$(int(STV(NP)+.5)) 06852 print "You have $";ltrm$(format$(int(UCASH(PLAYER)+.5),"###########")) 06854 let MX=div(int(UCASH(PLAYER)+.5),int(STV(NP)+.5)) 06855 if PREC(PLAYER)=0 then 06869 06856 print "How many shares to buy (Max=";str$(MX);")? "; 06858 enable handler RESM, resume at 06884 06860 linput prompt "":C$ 06862 let C$=ltrm$(rtrm$(C$)) 06864 if C$="" then 06796 06866 let BS=val(C$) 06868 if BS=0 then 06810 06869 if PREC(PLAYER)=0 then let BS=MX 06870 if BS<0 or BS<>int(BS) then 06884 06872 if BS>MX then print "You do not have enough cash." 06874 if BS>MX then 06810 06876 let UCASH(PLAYER)=int(UCASH(PLAYER)+.5)-int(STV(NP)*BS+.5) 06878 let USTOCK(PLAYER,NP)=USTOCK(PLAYER,NP)+BS 06880 output #2 record G data 00305 06882 goto 06796 06884 print "Illegal number." 06886 goto 06810 07000 let C$=USR$&" has played." 07001 input #2 record G data 00305 07002 let TURN=TURN+1 07003 if TURN>PLAY then let STAT=-1 07004 output #2 record G data 00305 07005 if PUSHPLAYER>0 then let PLAYER=PUSHPLAYER 07006 if PUSHPLAYER>0 then let USR$=PUSHUSR$ 07010 gosub 08410 07012 rem HANDLE A COMPUTER MOVE 07020 goto 03100 07100 let CMD$=uprc$(CMD$) 07101 let CMD=-1 07102 if CMD$=">" then gosub 08400 07104 if CMD$="C" or CMD$="$" then gosub 04000 07106 if CMD$="?" then gosub 04008 07108 if CMD$="." then gosub 03570 07110 if CMD$="M" then gosub 05000 07112 if CMD$="P" then gosub 04500 07114 if CMD$="H" then gosub 03550 07116 if CMD$="S" then gosub 04600 07117 if pos(">C?$.MPHS",CMD$)=0 then let CMD=0 07118 return 08400 linput prompt "":TC$ ! Get text to send 08402 let C$="<"&USR$&"> " 08403 let C$=C$&TC$ 08410 let I=0 ! Send C$ to all players 08415 enable handler NOTONSYS, resume at 08420 08420 let I=I+1 08430 input #1 eof 08490, record I data 00261 08440 if UGAME<>G then 08420 08450 who UPID into TMP$ 08460 if pos(TMP$,rtrm$(US%)&":CON"&str$(UCON))=0 then 08462 let US%="" 08463 let UGAME=0 08465 output #1 record I data 00261 08466 end if 08467 enable handler XMIT, resume at 08420 08470 if UGAME=G then send UPID,chr$(13)&C$&chr$(11) 08480 goto 08420 08490 disable handler 08491 return 08500 print 08501 input #2 record G data 00305 ! Leave the game 08502 if TURN<49 then let PREC(PLAYER)=0 08503 if TURN<49 then let PPID(PLAYER)=0 08505 let PLAY=PLAY-1 08506 if PLAY<4 and TURN<4 then let STAT=1 08508 if PLAY<2 then let STAT=0 08510 output #2 record G data 00305 08520 input #1 record USR data 00261 08522 let UGAME=0 08523 output #1 record USR data 00261 08530 goto 01000 09000 print 09010 input #1 eof 09999, record USR data 00261 09012 let US%="" 09013 let UGAME=0 09014 output #1 record USR data 00261 09020 goto 09999 09050 input #1 record USR data 00261 09052 let UGAME=-2 09055 output #1 record USR data 00261 09060 print "You will be notified about Star Trader activity concerning the start of a";chr$(10);"new game." 09999 close 10000 if MUPET>0 then print chr$(129);chr$(140);chr$(0);chr$(0) 20000 end