This commit is contained in:
root
2026-10-01 22:16:48 +02:00
parent b6d1909d7f
commit 9dfdf79fa7
39 changed files with 4560 additions and 181 deletions
+4 -3
View File
@@ -24,11 +24,12 @@ var portValues = map[string]int{
"RELVX": sim.PortScanRelVX, "RELVY": sim.PortScanRelVY, "RELVZ": sim.PortScanRelVZ,
"DIST": sim.PortScanDist,
"ORE0": sim.PortScanOre, "ORE1": sim.PortScanOre + 1, "ORE2": sim.PortScanOre + 2, "ORE3": sim.PortScanOre + 3,
"MINE": sim.PortMine, "CARGO": sim.PortCargo, "CARGOCAP": sim.PortCargoCap,
"CARGO0": sim.PortCargoOre, "CARGO1": sim.PortCargoOre + 1, "CARGO2": sim.PortCargoOre + 2, "CARGO3": sim.PortCargoOre + 3,
"MINE": sim.PortMine, "CONTS": sim.PortConts, "CONTKG": sim.PortContKg, "CONTROOM": sim.PortContRoom, "CONTMASS": sim.PortContMass,
"ATTACH": sim.PortAttach, "DETACH": sim.PortDetach, "NEARBY": sim.PortNearby,
"CONTORE0": sim.PortContOre, "CONTORE1": sim.PortContOre + 1, "CONTORE2": sim.PortContOre + 2, "CONTORE3": sim.PortContOre + 3,
"STNX": sim.PortStnRelX, "STNY": sim.PortStnRelY, "STNZ": sim.PortStnRelZ,
"STNVX": sim.PortStnRelVX, "STNVY": sim.PortStnRelVY, "STNVZ": sim.PortStnRelVZ,
"SELL": sim.PortSell, "EARNED": sim.PortCredits,
"ORDER": sim.PortOrder, "EARNED": sim.PortCredits,
"UPNEW": sim.PortUplinkNew, "UPLEN": sim.PortUplinkLen,
"MATHX": sim.PortMathX, "MATHY": sim.PortMathY, "MATHZ": sim.PortMathZ,
"ATAN2": sim.PortMathAtan2, "HYPOT": sim.PortMathHypot, "NORM3": sim.PortMathNorm3,
+146 -56
View File
@@ -625,7 +625,7 @@ chosen by the throttle.
0x21 AZIMUTH output Thrust direction azimuth, milliradians.
0x22 PITCH output Thrust direction elevation, milliradians.
0x23 FUEL input Fuel remaining, kg.
0x24 MASS input Total ship mass (hull + fuel + cargo), kg.
0x24 MASS input Total ship mass (hull + fuel + containers in tow), kg.
```
THE ENGINE FIRES ALONG THE DIRECTION GIVEN, for the whole of the turn, at
@@ -644,7 +644,8 @@ Thrust and fuel. For a Prospector at standard turn length:
Full thrust ................ 6000 newtons
Exhaust velocity ........... 30,000 m/s
Fuel used at full throttle . 12 kg per turn (thrust x turn / exhaust vel.)
Acceleration ............... thrust / mass, 0.33 to 0.75 m/s^2
Acceleration ............... thrust / mass: 0.75 m/s^2 with an empty tank
and nothing in tow, less with containers
```
Fuel use is proportional to throttle. When fuel runs out the engine falls
@@ -659,16 +660,17 @@ shortened burn.
The scanner tracks one asteroid at a time, which you choose by number.
Asteroids are numbered from 1. The standard belt has 500. The scanner has
unlimited range: every asteroid in the belt is visible from anywhere in it.
a range of 500,000 km: an asteroid farther away than that cannot be seen.
```
0x30 SELECT output Asteroid number to track. Zero, or a number that
does not exist, clears the selection.
0x31 NEAREST input Number of the asteroid nearest to the ship.
0x31 NEAREST input Number of the asteroid nearest to the ship, or 0
if none is within 500,000 km.
```
The following ports describe the TRACKED asteroid and all read zero if none
is tracked.
is tracked, or if it is more than 500,000 km away.
```
0x32 RELX input Position of the target relative to the ship, X, km
@@ -690,43 +692,80 @@ the +X side of you. To fly towards the target, point the engine along
(RELX, RELY, RELZ). To match its velocity, apply a thrust along
(RELVX, RELVY, RELVZ).
NEAREST is decided among all asteroids by true three-dimensional distance;
if two are exactly equally near, the lower number wins.
NEAREST is decided among the asteroids within scanner range by true
three-dimensional distance, and reads zero if there are none; if two are
exactly equally near, the lower number wins.
> **Note:** Every asteroid in the belt moves at the same speed, 3 km/s (section
> 7.2). For a ship travelling at that speed, the velocity of a target relative
> to the ship is therefore decided by the difference in DIRECTION of travel, not
> by any difference in speed.
## 5.7 Mining Laser and Cargo Hold
## 5.7 Mining Laser and Containers
A ship has no hold. Ore travels in CONTAINERS, which the ship TOWS. A
container weighs 500 kg empty and holds 2000 kg of ore. Containers belong to
no one: any ship can tow any container. A container is always in one of two
conditions:
- IN TOW behind a ship: it moves exactly as the ship moves.
- ADRIFT: it moves on its own, pulled by the Star like anything else (section
7.2). A container let go with the speed of a ship in orbit stays in orbit
beside it. One that loses its speed falls inward, and is destroyed with its
ore if it comes within 200,000 km of the Star. A container that stays adrift
for TEN DAYS disappears, with whatever is in it, so containers that are lost
cannot pile up. While a container is in tow its days do not count.
```
0x50 MINE output Non-zero: mine the tracked asteroid. Zero: stop.
0x51 CARGO input Total mass in the hold, kg.
0x52 CARGOCAP input Capacity of the hold, kg (Prospector: 6000).
0x58 CARGO0 input Iron in the hold, kg
0x59 CARGO1 input Nickel in the hold, kg
0x5A CARGO2 input Ice in the hold, kg
0x5B CARGO3 input Platinum in the hold, kg
0x50 MINE output Non-zero: mine the tracked asteroid. Zero: stop.
0x51 CONTS input Number of containers in tow.
0x52 CONTKG input Ore in the containers in tow, kg.
0x53 CONTROOM input Room left in the containers in tow, kg.
0x54 CONTMASS input Mass of the containers in tow, ore included, kg.
0x55 ATTACH output Non-zero: take the containers near the ship in tow.
0x56 DETACH output Non-zero: let go of every container in tow.
0x57 NEARBY input How many drifting containers ATTACH would take.
0x58 CONTORE0 input Iron in the containers in tow, kg
0x59 CONTORE1 input Nickel in the containers in tow, kg
0x5A CONTORE2 input Ice in the containers in tow, kg
0x5B CONTORE3 input Platinum in the containers in tow, kg
(0x5C-0x5F exist for future ores and read zero.)
```
The laser stays on, once MINE has been set, until MINE is set to zero. In
each turn in which ALL of the following are true, it moves ore from the
asteroid into the hold:
MINING. The laser stays on, once MINE has been set, until MINE is set to zero.
In each turn in which ALL of the following are true, it moves ore from the
asteroid into the containers in tow:
- an asteroid is tracked and still has ore;
- the asteroid is within 5 km of the ship;
- the ship's velocity relative to the asteroid is at most 100 m/s;
- the hold is not full.
- at least one container in tow has room.
The Prospector mines 10 kg per turn. The ore taken is a mixture in the same
proportions as the asteroid's remaining ore. You cannot choose what to mine.
The conditions are tested at the END of the turn, after the ship has moved.
It goes into the containers in the order they were made, each filled before the
next. The conditions are tested at the END of the turn, after the ship has
moved. With nothing in tow, or every container full, the laser does nothing.
To fill an empty hold takes 600 turns, 10 hours of ship time.
One container takes 200 turns, a little over three hours of ship time, to fill.
Ore has to be brought to the Station before it is worth anything. An asteroid
ATTACH. Writing a non-zero value to ATTACH takes in tow every container that
is adrift and near the ship: within 10 km, and moving at most 100 m/s relative
to it. It makes no difference who ordered a container or whose ship last
towed it. A container that another ship is towing is left alone. Attached
containers move at once to the ship. Reading NEARBY beforehand says how many
ATTACH would take.
DETACH. Writing a non-zero value to DETACH lets go of every container in tow.
Each carries on drifting with the velocity the ship had at that moment, and
its ten days start from then.
MASS. Everything in tow counts towards the ship's mass, empty containers as
well as the ore in them, and the engine's thrust does not change. Acceleration
therefore falls as the tow grows: see section 7.1. MASS (section 5.5) reports
the total.
Ore is worth nothing until it reaches the Station (section 5.8). An asteroid
does not replenish.
> **Note:** The scanner reports whole kilometres (rounded down). The range to
@@ -746,21 +785,35 @@ ship is launched from it.
0x63 STNVX input Velocity of the Station relative to the ship, X, m/s
0x64 STNVY input ... Y, m/s
0x65 STNVZ input ... Z, m/s
0x66 SELL output Non-zero: sell the entire hold.
0x66 ORDER output 1 to 10: the Station delivers that many empty containers.
0x67 EARNED input Credits earned by this ship so far
```
As with the scanner, relative values are STATION MINUS SHIP.
Writing a non-zero value to SELL sells everything in the hold at once, if
ALL of the following are true, and otherwise does nothing (there is no error
signal):
SELLING IS AUTOMATIC. At the start of every turn the Station buys every
container that is ADRIFT within 20 km of it and has ore in it, and pays for the
ore at the day's prices. THE STATION TAKES THE CONTAINER WITH THE ORE: a sold
container disappears. Empty containers are not bought. Containers in tow are
never touched: to sell, detach near the Station.
- the ship is within 20 km of the Station;
- its velocity relative to the Station is at most 100 m/s;
- the hold is not empty.
The credits go to the player whose ship last let go of the container, and to
EARNED of that ship. Containers have no owner, so ore left adrift belongs to
whoever brings it to the Station first.
The hold is emptied, the credits go to your account, and EARNED goes up.
ORDERING CONTAINERS. When the ship is within 20 km of the Station, writing a
number from 1 to 10 to ORDER has the Station deliver that many EMPTY containers
to the ship: they appear at the ship's position, adrift with the ship's own
velocity, ready for ATTACH. Larger numbers act as 10; zero or less does
nothing. The Station will not deliver more once 50 containers that you ordered
still exist. A sale takes containers away, and so does the ten-day rule
(section 5.7), so containers you lose never leave you stuck.
Away from the Station ORDER does nothing, and there is no error signal.
Containers are free.
A round trip is therefore: order containers, attach them, fly to an asteroid,
mine until they are full, fly back, detach near the Station (which takes the
containers and pays for the ore), and order fresh ones for the next trip.
PRICES. Each ore has a standard price per kilogram. The price FALLS as ore
floods the market and recovers as it is used up. Prices are set once per day
@@ -849,13 +902,14 @@ Sample program 3 (Chapter 9) does exactly this.
## 6.1 Life Cycle of a Ship
A ship is always in one of four conditions.
A ship is always in one of five conditions.
```
INVENTORY Built and waiting on the dock. It can be launched.
LAUNCHING Cleared to launch. It will enter the belt on the next daily run.
Its program is sealed and can no longer be changed.
ACTIVE In the belt.
SCRAPPING Ordered to be scrapped. It is removed on the next daily run.
DESTROYED Lost. It cannot be recovered.
```
@@ -890,7 +944,9 @@ produce the same day, bit for bit. There is no luck in it.
Order of events within the run:
1. Ships waiting to launch are placed at the Station.
1. Ships waiting to launch are placed at the Station. Ships being scrapped
are removed; any containers they tow are left adrift, and each owner is
given a new ship, in INVENTORY, with no program.
2. Uplinks are delivered to their ships.
3. For each turn of the day, for each ship in order of ship number:
a. the computer runs until it yields or exhausts its budget;
@@ -947,9 +1003,18 @@ DELETE /slots/{n} Empty slot 4 to 16.
PUT /ships/{n}/uplink Body: up to 1024 raw bytes. Replaces any
message queued for the next run. Allowed while LAUNCHING or ACTIVE.
POST /ships/{n}/scrap Scrap a ship that is ACTIVE (409 otherwise).
On the next run the ship is removed from the belt and you receive a
new ship in INVENTORY. Its program and fuel are lost.
GET /ships/{n}/downlink The latest downlink, exactly 1024 raw
bytes. The header X-Downlink-Day tells you which day's run
produced it. A ship's first downlink appears after its first day.
With ?day=D you get the downlink of that earlier day instead (404
if there is none).
GET /ships/{n}/downlinks {"days":[0,1,2,...]}: the days that have a
stored downlink, oldest first. Every day's downlink is kept.
```
Typical use:
@@ -978,13 +1043,23 @@ request, 413 when your data is too large, 400 for malformed data.
```
Dry mass ............................. 8000 kg
Fuel tank ............................ 4000 kg
Hold ................................. 6000 kg
Total mass, full tank, empty hold .... 12,000 kg
Total mass, empty tank, full hold .... 14,000 kg
Cargo hold ........................... none: ore travels in containers
Container, empty ..................... 500 kg (holds 2000 kg of ore)
Container, full ...................... 2500 kg
Total mass, full tank, nothing in tow 12,000 kg
Total mass, empty tank, nothing in tow 8,000 kg
Engine ............................... 6000 N, exhaust velocity 30 km/s
Mining laser ......................... 10 kg per turn
```
Acceleration is thrust divided by the total mass, containers in tow included:
```
full tank, nothing in tow ............ 6000 / 12,000 = 0.50 m/s^2
full tank, 3 full containers ......... 6000 / 19,500 = 0.31 m/s^2
empty tank, nothing in tow ........... 6000 / 8,000 = 0.75 m/s^2
```
The ship is a point. It has no orientation of its own; the engine simply
pushes in whatever direction the two angles command. There are no
thrusters, no spin, no fuel used to rotate.
@@ -1043,7 +1118,7 @@ The total change of velocity available from one tank is given by
dv = exhaust velocity x ln( mass before / mass after )
```
For a Prospector with an empty hold and full tank:
For a Prospector with nothing in tow and a full tank:
```
30 km/s x ln( 12000 / 8000 ) = about 12.2 km/s
@@ -1051,7 +1126,8 @@ For a Prospector with an empty hold and full tank:
That is roughly four times the orbit speed. Nothing is ever free: every
metre per second gained going out must be paid again to slow down, and every
kilogram of ore carried home makes the ship harder to reverse. The
kilogram of ore towed home, and every empty container towed out for it,
makes the ship harder to reverse. The
engine at full power uses the whole tank in 333 turns, a little over five
hours of ship time, and yet the day is 24. Plan accordingly.
@@ -1318,14 +1394,19 @@ SCANNER
0x42 ORE2 in ice in target kg
0x43 ORE3 in platinum in target kg
MINING AND HOLD
0x50 MINE out non-zero = laser on, latched
0x51 CARGO in hold contents kg
0x52 CARGOCAP in hold capacity kg
0x58 CARGO0 in iron in hold kg
0x59 CARGO1 in nickel in hold kg
0x5A CARGO2 in ice in hold kg
0x5B CARGO3 in platinum in hold kg
MINING AND CONTAINERS
0x50 MINE out non-zero = laser on, latched
0x51 CONTS in containers in tow
0x52 CONTKG in ore in the containers in tow kg
0x53 CONTROOM in room left in the containers in tow kg
0x54 CONTMASS in mass of the containers in tow kg
0x55 ATTACH out non-zero = tow the containers nearby
0x56 DETACH out non-zero = let go of everything in tow
0x57 NEARBY in drifting containers ATTACH would take
0x58 CONTORE0 in iron in tow kg
0x59 CONTORE1 in nickel in tow kg
0x5A CONTORE2 in ice in tow kg
0x5B CONTORE3 in platinum in tow kg
STATION
0x60 STNX in station minus ship, X km
@@ -1334,7 +1415,7 @@ STATION
0x63 STNVX in station velocity minus ship, X m/s
0x64 STNVY in ... Y m/s
0x65 STNVZ in ... Z m/s
0x66 SELL out non-zero = sell hold (if docked)
0x66 ORDER out 1 to 10 = station delivers empty containers
0x67 EARNED in credits earned by this ship
WORMHOLE LINK
@@ -1392,19 +1473,24 @@ Paste this at the top of any program. Unused equates cost nothing.
.equ P_ORE2 0x42
.equ P_ORE3 0x43
.equ P_MINE 0x50
.equ P_CARGO 0x51
.equ P_CARGOCAP 0x52
.equ P_CARGO0 0x58
.equ P_CARGO1 0x59
.equ P_CARGO2 0x5A
.equ P_CARGO3 0x5B
.equ P_CONTS 0x51
.equ P_CONTKG 0x52
.equ P_CONTROOM 0x53
.equ P_CONTMASS 0x54
.equ P_ATTACH 0x55
.equ P_DETACH 0x56
.equ P_NEARBY 0x57
.equ P_CONTORE0 0x58
.equ P_CONTORE1 0x59
.equ P_CONTORE2 0x5A
.equ P_CONTORE3 0x5B
.equ P_STNX 0x60
.equ P_STNY 0x61
.equ P_STNZ 0x62
.equ P_STNVX 0x63
.equ P_STNVY 0x64
.equ P_STNVZ 0x65
.equ P_SELL 0x66
.equ P_ORDER 0x66
.equ P_EARNED 0x67
.equ P_UPNEW 0x70
.equ P_UPLEN 0x71
@@ -1463,13 +1549,17 @@ program (HALT), commanding a throttle greater than 1000 (clamped).
| 10-12 pos km 13-15 vel m/s |
| 20 throttle 0-1000 21 azimuth 22 pitch 23 fuel 24 mass |
| 30 select 31 nearest 32-34 rel pos 35-37 rel vel 38 dist 40-43 ore |
| 50 mine 51 cargo 52 cap 58-5B cargo by ore |
| 60-62 stn pos 63-65 stn vel 66 sell 67 earned |
| 50 mine 51 conts 52 ore 53 room 54 mass 55 attach 56 detach |
| 57 nearby 58-5B ore by type in tow |
| 60-62 stn pos 63-65 stn vel 66 order 67 earned |
| 70 uplink flag / ack 71 uplink length |
| 80 x 81 y 82 z 83 atan2 84 hypot 85 norm3 |
+------------------------------------------------------------------------------+
| MINE within 5 km, rel speed <= 100 m/s 10 kg/turn |
| SELL within 20 km, rel speed <= 100 m/s whole hold |
| ATTACH containers within 10 km, rel speed <= 100 m/s |
| SALE drifting containers with ore within 20 km: taken and paid |
| ORDER 1-10 empty containers, near the Station (max 50 ordered) |
| ADRIFT a container adrift for 10 days vanishes, ore and all |
| STAR a = v^2/r, v = 3 km/s. Inside 200,000 km = destroyed. |
+------------------------------------------------------------------------------+
```