Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! 2.6/7 » The Academy » Guts of calculating cargo when fleets split.
Guts of calculating cargo when fleets split. Thu, 13 January 2022 15:51 Go to next message
ricks03 is currently offline ricks03

 
Officer Cadet 1st Year
Creator of TotalHost and Stars! utilities
Created TotalHost and Stars! utilities

Messages: 222
Registered: January 2012
Location: NC
I'm trying to figure out the formula for how cargo splits when a fleet splits. At a simple level, it's:
$cargoFleetA * ($cargoCapacityFleetA / ($cargoCapacityFleetA + $cargoCapacityFleetB)
$cargoFleetB * ($cargoCapacityFleetB / ($cargoCapacityFleetA + $cargoCapacityFleetB)

Which of course almost always leaves you with a fraction. Yet simply rounding the result doesn't provide the correct answer in all cases; there's variance +/- 1

Example:
I have a fleet, that starts out with 58800+7000 cargo space (the two resulting fleets combined cargo) before the split, and 515,180,270,252 cargo.

Simply applying the above formula after a split should give:
55,19,29,27 cargo
460,161,241,223 cargo

where Stars! reports:
55,20,28,26
460,160,232,224

So it's not simple rounding. I can get close to the right formula, but can't quite get there. Split all also spreads out results across fleets somehow. Anyone ever figured this out?



[Updated on: Thu, 13 January 2022 16:31]




https://www.irelandbybicycle.com
http://totalhost.sinister.net:999
https://github.com/ricks03/TotalHost

Report message to a moderator

Re: Guts of calculating cargo when fleets split. Fri, 28 January 2022 12:06 Go to previous messageGo to next message
m.a@stars is currently offline m.a@stars

 
Commander

Messages: 2765
Registered: October 2004
Location: Third star to the left
Rounding is most certainly involved. I'd try applying it at every step of the calculation, not just at the end.


So many Stars, so few Missiles!

In space no one can hear you scheme! Deal

Report message to a moderator

Re: Guts of calculating cargo when fleets split. Fri, 28 January 2022 12:09 Go to previous message
ricks03 is currently offline ricks03

 
Officer Cadet 1st Year
Creator of TotalHost and Stars! utilities
Created TotalHost and Stars! utilities

Messages: 222
Registered: January 2012
Location: NC
There's both rounding and subtraction I think, because Stars! never seems to lose (or add) cargo. So the result on one side clerly ties to the result on the other side.


https://www.irelandbybicycle.com
http://totalhost.sinister.net:999
https://github.com/ricks03/TotalHost

Report message to a moderator

Previous Topic: What planet information do you get without scanners?
Next Topic: Bugs/Exploits in JRC4
Goto Forum:
  


Current Time: Fri Mar 29 04:26:52 EDT 2024