The Traveller Book, page 105, has the nice roulette-style table for generating speculative goods.
Each entry has a label, base price, quantity, up to three purchase DMs, and up to three resale DMs.
Label could fit into a 16 character string.
Base price ranges from 300 credits to millions of credits. That’s a long int.
Quantity is of the form nD x m. Up to 8 dice. Multiplier is 1, 5, or 10.
There are six possible trade remarks taken into consideration - ag, non ag, rich, poor, industrial, and non industrial. These DMs range from -8 to +8. Example: item 41, gems.
Quantity has a slight wrinkle, in that items 51-56 are priced by unit, without a tonnage given. That could be rationalized by guesstimating the tons per unit, and then updating the base price and quantity multiplier accordingly.
E.g. guesstimates:
Aircraft, 10 tons, so KCr100 per ton.
Air/raft, 5 tons (call it grav craft and 5 tons would work fine), so KCr 120 per ton.
Computers, 5 tons, so MCr 2 per ton.
ATVs, 10 tons, so Cr 3000 per ton.
Armored vehicles, 10 tons? So Cr 7000 per ton.
Farm Machinery... 5 or 10 tons? 5 tons at KCr 30 per ton.
Or similar.
I’m coding in C, so values where reasonable will be coded in bits — six bits per trade code, quantity parameters as three bits and two bits, respectively, perhaps, or it can be more generous, stored as integers. Utility is more important than compression.
char label[16];
long base_price;
int quantity_dice :4;
int quantity_multiple :4;
// probably don’t have to all be 4 bits... and a couple might have to be 5 bits.
int purchase_ag :4;
int purchase_na :4;
int purchase_ri :4;
int purchase_po :4;
int purchase_in :4;
int purchase_ni :4;
int resale_ag :4;
int resale_na :4;
int resale_ri :4;
int resale_po :4;
int resale_in :4;
int resale_ni :4;
Guesstimate 27 bytes per record, 36 records = 972 bytes. Rough first approximation.
Each entry has a label, base price, quantity, up to three purchase DMs, and up to three resale DMs.
Label could fit into a 16 character string.
Base price ranges from 300 credits to millions of credits. That’s a long int.
Quantity is of the form nD x m. Up to 8 dice. Multiplier is 1, 5, or 10.
There are six possible trade remarks taken into consideration - ag, non ag, rich, poor, industrial, and non industrial. These DMs range from -8 to +8. Example: item 41, gems.
Quantity has a slight wrinkle, in that items 51-56 are priced by unit, without a tonnage given. That could be rationalized by guesstimating the tons per unit, and then updating the base price and quantity multiplier accordingly.
E.g. guesstimates:
Aircraft, 10 tons, so KCr100 per ton.
Air/raft, 5 tons (call it grav craft and 5 tons would work fine), so KCr 120 per ton.
Computers, 5 tons, so MCr 2 per ton.
ATVs, 10 tons, so Cr 3000 per ton.
Armored vehicles, 10 tons? So Cr 7000 per ton.
Farm Machinery... 5 or 10 tons? 5 tons at KCr 30 per ton.
Or similar.
I’m coding in C, so values where reasonable will be coded in bits — six bits per trade code, quantity parameters as three bits and two bits, respectively, perhaps, or it can be more generous, stored as integers. Utility is more important than compression.
char label[16];
long base_price;
int quantity_dice :4;
int quantity_multiple :4;
// probably don’t have to all be 4 bits... and a couple might have to be 5 bits.
int purchase_ag :4;
int purchase_na :4;
int purchase_ri :4;
int purchase_po :4;
int purchase_in :4;
int purchase_ni :4;
int resale_ag :4;
int resale_na :4;
int resale_ri :4;
int resale_po :4;
int resale_in :4;
int resale_ni :4;
Guesstimate 27 bytes per record, 36 records = 972 bytes. Rough first approximation.