| 1 |
program displaysystems; |
| 2 |
(******************************************************************** |
| 3 |
This file is part of Ironseed. |
| 4 |
|
| 5 |
Ironseed is free software: you can redistribute it and/or modify |
| 6 |
it under the terms of the GNU General Public License as published by |
| 7 |
the Free Software Foundation, either version 3 of the License, or |
| 8 |
(at your option) any later version. |
| 9 |
|
| 10 |
Ironseed is distributed in the hope that it will be useful, |
| 11 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
GNU General Public License for more details. |
| 14 |
|
| 15 |
You should have received a copy of the GNU General Public License |
| 16 |
along with Ironseed. If not, see <https://www.gnu.org/licenses/>. |
| 17 |
********************************************************************) |
| 18 |
|
| 19 |
{********************************************* |
| 20 |
Data Generator: Systems names / coordinates |
| 21 |
|
| 22 |
Copyright: |
| 23 |
1994 Channel 7, Destiny: Virtual |
| 24 |
2020 Matija Nalis <[email protected]> |
| 25 |
**********************************************} |
| 26 |
|
| 27 |
{$PACKRECORDS 1} |
| 28 |
|
| 29 |
uses crt; |
| 30 |
|
| 31 |
type |
| 32 |
nametype= string[12]; |
| 33 |
type |
| 34 |
oldsystype= record |
| 35 |
x,y,z,lastdate,visits,numplanets: integer; |
| 36 |
end; |
| 37 |
var |
| 38 |
a, j: integer; |
| 39 |
f: file of nametype; |
| 40 |
ft: text; |
| 41 |
t: array[1..250] of nametype; |
| 42 |
f2: file of oldsystype; |
| 43 |
s: array[1..250] of oldsystype; |
| 44 |
{f4: text;} |
| 45 |
{i, index: integer; |
| 46 |
tempt: nametype; |
| 47 |
temps: oldsystype;} |
| 48 |
|
| 49 |
{ generate informative-only sysdata.txt } |
| 50 |
procedure display; |
| 51 |
begin |
| 52 |
assign(f,'data/sysname.dta'); |
| 53 |
reset(f); |
| 54 |
assign(f2,'data/sysset.dta'); |
| 55 |
reset(f2); |
| 56 |
assign(ft,'Data_Generators/other/sysdata.txt'); |
| 57 |
rewrite(ft); |
| 58 |
{ assign(f4,'Data_Generators/makedata/sysset.txt'); |
| 59 |
rewrite(f4);} |
| 60 |
|
| 61 |
for a:=1 to 250 do |
| 62 |
begin |
| 63 |
read(f,t[a]); |
| 64 |
read(f2,s[a]); |
| 65 |
{writeln(f4, s[a].x, #9, s[a].y, #9, s[a].z, #9, s[a].numplanets);} |
| 66 |
end; |
| 67 |
{ |
| 68 |
for i:=1 to 250 do |
| 69 |
begin |
| 70 |
index:=i; |
| 71 |
for j:=i to 250 do if t[j]<t[index] then index:=j; |
| 72 |
|
| 73 |
tempt:=t[index]; |
| 74 |
t[index]:=t[i]; |
| 75 |
t[i]:=tempt; |
| 76 |
|
| 77 |
temps:=s[index]; |
| 78 |
s[index]:=s[i]; |
| 79 |
s[i]:=temps; |
| 80 |
|
| 81 |
end; |
| 82 |
} |
| 83 |
for a:=1 to 250 do |
| 84 |
writeln(ft,t[a],#9'(',(s[a].x/10):0:1,',',(s[a].y/10):0:1,',',(s[a].z/10):0:1,')'); |
| 85 |
|
| 86 |
close(ft); |
| 87 |
close(f); |
| 88 |
close(f2); |
| 89 |
{close(f4);} |
| 90 |
end; |
| 91 |
|
| 92 |
{ generate sysname.dta from names.txt } |
| 93 |
procedure make_sysname; |
| 94 |
begin |
| 95 |
assign(ft,'Data_Generators/makedata/names.txt'); |
| 96 |
reset(ft); |
| 97 |
assign(f,'data/sysname.dta'); |
| 98 |
rewrite(f); |
| 99 |
for a:=1 to 250 do |
| 100 |
begin |
| 101 |
readln(ft,t[1]); |
| 102 |
if length(t[1])<12 then |
| 103 |
for j:=length(t[1])+1 to 12 do t[1][j]:=' '; |
| 104 |
t[1][0]:=#12; |
| 105 |
write(f,t[1]); |
| 106 |
writeln(t[1]); |
| 107 |
end; |
| 108 |
close(ft); |
| 109 |
close(f); |
| 110 |
end; |
| 111 |
|
| 112 |
{ generate sysset.dta from sysset.txt } |
| 113 |
procedure make_sysset; |
| 114 |
var o: oldsystype; |
| 115 |
begin |
| 116 |
assign(ft,'Data_Generators/makedata/sysset.txt'); |
| 117 |
reset(ft); |
| 118 |
assign(f2,'data/sysset.dta'); |
| 119 |
rewrite(f2); |
| 120 |
|
| 121 |
for a:=1 to 250 do |
| 122 |
begin |
| 123 |
o.lastdate:=0; |
| 124 |
o.visits:=0; |
| 125 |
readln(ft, o.x, o.y, o.z, o.numplanets); |
| 126 |
write(f2,o); |
| 127 |
end; |
| 128 |
|
| 129 |
close(f2); |
| 130 |
close(ft); |
| 131 |
end; |
| 132 |
|
| 133 |
begin |
| 134 |
make_sysname; { generate sysname.dta from names.txt } |
| 135 |
make_sysset; { generate sysset.dta from sysset.txt } |
| 136 |
display; { generate informative-only sysdata.txt } |
| 137 |
end. |