distributeRemaining backwards

for BotE Android (get that via Google Play Store) there's a option to get a Windows version >> here
Antworten
jmichael
Junior Kadett
Junior Kadett
Beiträge: 7
Registriert: Freitag 10. Februar 2017, 18:10

distributeRemaining backwards

Beitrag von jmichael » Sonntag 12. Februar 2017, 21:28

A comment in SystemManager says that distributeRemaining is supposed to assign leftover workers to the building types with the highest fractional assignments. The code I see sorts, but does not reverse the list, or process the list backwards. I think this is responsible for a tiny part of the apparent unpredictability of labor assignments.

blotunga
Flottenkapitän
Flottenkapitän
Beiträge: 828
Registriert: Montag 26. Mai 2014, 15:05

Re: distributeRemaining backwards

Beitrag von blotunga » Montag 13. Februar 2017, 09:33

It is sorted then reversed at the end, see here

jmichael
Junior Kadett
Junior Kadett
Beiträge: 7
Registriert: Freitag 10. Februar 2017, 18:10

Re: distributeRemaining backwards

Beitrag von jmichael » Dienstag 14. Februar 2017, 05:20

calc sorts and reverses before returning. It sorts based on count.

Right before this, calc calls distributeRemaining, which sorts on fPart, but does not reverse before adding one worker to each category (until it runs out of idle workers).

blotunga
Flottenkapitän
Flottenkapitän
Beiträge: 828
Registriert: Montag 26. Mai 2014, 15:05

Re: distributeRemaining backwards

Beitrag von blotunga » Dienstag 14. Februar 2017, 10:40

jmichael hat geschrieben:calc sorts and reverses before returning. It sorts based on count.

Right before this, calc calls distributeRemaining, which sorts on fPart, but does not reverse before adding one worker to each category (until it runs out of idle workers).
Ah, I missed that. Yes that should be iterated in reverse. It probably won't make a huge difference, but yes that's the correct way.

Antworten

Zurück zu „BotE Android (Windows version)“