Open Skilly146 opened 1 year ago
@Skilly146 Is the consensus to give to the first carrier or round them all down?
According to the thread I started on the forums all the fractions should be truncated and the left over ships should be given round robin from the largest starting fleet to the smallest.
What
When multiple carriers are attacking the same star it correctly distributes the survivors among the carriers but it also shows a decimal remaining instead of rounding the numbers, or more accurately rounding the highest fraction up and the remaining ones down. This definitely happens with multiple carriers owned by the same player (As Paralax showed on the discord) and looking at the code I would think it happens with multiple players as well
How
The problem is in the
for (const k in contribution)
loop at line 712. The best solution would probably be adding a variable that stores whichever carrier had the last fraction of remaining ships in an additionalbiggest_fraction
variable defined before the loop. Simply compare the fraction of the current carrier fromcontribution
to thebiggest_fraction
variable (usingnumber - number.trunc()
) and if it's bigger redefinebiggest_fraction
. The trouble I had with it was that its best done by moving lines 728-730to outside of the loop and instead have them read a list created by the loop. That list would then be for looped through one more time to truncate all of the
contribution[k]
variables except for carrier stored inbiggest_fraction
which would be rounded up.