home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
GAMES
/
STARSHIP.ARC
/
STARSHIP.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1989-09-27
|
6KB
|
192 lines
program starship;
{a turbo pascal source file by harry ingham}
const
maxcargo=36;{most allowable cargo types}
forsalenum=5;{cargoes avail. at each port}
forsaleplus=10;
holdnum=20; {number of partitions}
complement=20; {starting crew}
probestart=2;
boatstart=1;
hullstart=3;
speedstart=10;
laserstart=2;
creditstart=2E5;
spacestart=200;
moralestart=100;
chance=10;
danger=10;
starmax=10;{number of stars}
type
cargotype= record
cargoname: string[16];
rfactor,pfactor,ifactor,nifactor,afactor,nafactor: integer;
unitprice: real;
weight: byte;
end;
cargo= record
category: byte;
aunitnumber: byte;
acargoname: string[16];
aprice: real;
aweight: integer;
arfactor,apfactor,aifactor,anifactor,aafactor,anafactor: integer;
percent: real;
end;
startrade=record
starname: string[15];
r,p,i,ni,a,na: boolean;
end;
var
cargorange: array[1..maxcargo] of cargotype;
thiscargo: cargo;
availnow: array[1..forsaleplus] of cargo;
holdnow: array[1..holdnum] of cargo;
chnfile: file;
thiscargotype: cargotype;
filename: string[14]; {used for other jobs too}
index,jndex,kndex,mndex,cargonum,star,thistar,realstar,
triplength,gamelength: byte;{the 'indices' are used for all work}
speed,tspeed,cspeed,hull,thull,chull,probes,boats,laser,tlaser,claser,
crew: byte; {ship vars}
drivecrew, lasercrew, hullcrew, space,morale,moralebounce: integer;
num,trial,inp: integer;{input and calc}
yorn: char;
galaxytrade: array[1..starmax] of startrade;
distance: array[1..starmax] of byte; {arrays 1..10 are indexed to stars}
angle: array[1..starmax] of integer;
been: array[1..starmax] of boolean;
t,dt,credits,realvar,salary: real;{time& money. realvar is all-purpose}
name: string[25];
stringvar:string[16];
alienmatch: array[0..4] of byte;
probehere,boathere,navy,messageflag,autodoc,assignment,roll,
prize: boolean;
(*--------------------------------------------------*)
var
OrigEpower:byte;
Epower: integer;
action,battle,newship,nomessage,moraleflag:boolean;
traderflag,quitter:boolean;
cargofile: file of cargotype;{these two are unique to this program}
starfile: file of startrade;
procedure instructions;
begin
writeln;
writeln('Since you have an honest face, you are lent ',creditstart:6:0,' credits,');
writeln('plus one hundered thousand a year to lease the ',name,'.');
writeln('She has just been finished, and is in orbit around Sol. All holds are empty.');
writeln;
writeln('The good ship ',name,' will now embark on a ',t:3:3,'-year trading journey,');
writeln('hoping to avoid bandits, mines, and strange local customs long enough');
writeln('to make her merchant-captain (you) filthy rich. Space bandits are the');
writeln('worst hazzard. Most have a speed of about 10. Rumor says that bandits');
writeln('are often more willing to negotiate after a couple of laser hits.');
writeln('Your loyal crew will go on strike if they think your profits are');
writeln('high compared to their salaries.');
writeln('The merchantman ',name,' has 20 holds and can carry 200 tons of cargo');
writeln('Her fuel capacity is large enough to make any commercial trip.');
writeln;
writeln('When you ask for star data, there will be letters after each star name.');
writeln('They describe the star''s economic status--R for rich, P for poor,');
writeln('A for agricultural, NA for non-agricultural, I for industrial, and');
writeln('NI for non-industrial. Naturally these conditions effect prices.');
writeln('But the availability of each type of cargo is random.');
writeln('type <carriage return> to begin....');
readln;
end;{instructions}
procedure initiate;
begin
quitter:=false;
newship:=false;
traderflag:=false;
for index:=1 to starmax do been[index]:=false;
credits:=creditstart;
space:=spacestart;
morale:=moralestart;
moralebounce:=0;
tspeed:=speedstart;
speed:=tspeed;
cspeed:=speed;
thull:=hullstart;
hull:=thull;
chull:=hull;
probes:=probestart;
boats:=boatstart;
tlaser:=laserstart;
laser:=tlaser;
claser:=laser;
crew:=complement;
drivecrew:=8;
lasercrew:=6;
hullcrew:=6;
autodoc:=false;
assignment:=false;
battle:=false;
t:=4;{defalut}
for index:=1 to holdnum do holdnow[index].category:=0;{empty hold}
randomize;
salary:=5E4;
filename:='cargo.dat'; {default data files}
assign(cargofile,filename);
filename:='star.dat';
assign(starfile,filename);
writeln('what length game would you like? (2 is a short game, 15 takes all day)');
readln(t);
if (t<>int(t)) or (t>255) or (t<1) then
begin
writeln('Whole numbers between 1 and 255 only. Game length?');
readln(t);
end;
gamelength:=trunc(t);
writeln('what will you name your ship?');
readln(name);
writeln('do you have a special cargo file on disc that you want to use?');
readln(yorn);
if upcase(yorn)='Y' then begin
writeln('what is the name of the file?');
readln(filename);
assign(cargofile,filename);
end;
writeln('do you have a special star file you want to use?');
readln(yorn);
if upcase(yorn)='Y' then begin
writeln('what is the name of the file?');
readln(filename);
assign(starfile,filename);
end;{ifthen}
index:=0; {now read those data files}
reset(cargofile);
while (eof(cargofile)=false) and (index<maxcargo) do
begin
index:=index+1;
read(cargofile,thiscargotype);
cargorange[index]:=thiscargotype;
end;{whiledo}
writeln('Do you need instructions?');
readln(yorn);
if upcase(yorn)='Y' then instructions;
cargonum:=index;
close(cargofile);
reset(starfile);
for index:=1 to starmax do read(starfile,galaxytrade[index]);
close(starfile);
thistar:=5; {begins game at star#5}
star:=5;
distance[5]:=0;
boathere:=false;
probehere:=false;
end;{initiate}
begin
initiate;
assign(chnfile,'starchn.chn');
chain(chnfile);
end.