]> git.pond.sub.org Git - empserver/commit
fairland: Try harder to deliver the requested amount of land
authorMarkus Armbruster <armbru@pond.sub.org>
Tue, 11 Aug 2020 15:58:23 +0000 (17:58 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Tue, 19 Jan 2021 07:27:34 +0000 (08:27 +0100)
commit56c014806ee7fe35908e5b09e97f31ce08245d21
tree61d49ccb263f01f8ccbcd779b9a5d086c7301623
parent696d31460c6c30e73238b734b29dc33310ada492
fairland: Try harder to deliver the requested amount of land

Planned island sizes are random with an expected value that matches
the average size requested by the user.  Can be off quite a bit when
the number of islands is small.  Also, actual island size can be
smaller than planned size when space is tight.

Instead of picking random island sizes independently, pick a random
split of their requested total size.

To reduce the probability of islands not growing to their planned
size, grow large islands before smaller ones.

To compensate for inability to grow, carry the difference over to the
next island size.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/util/fairland.c
tests/fairland/no-spike.out
tests/fairland/no-spike.xdump
tests/fairland/plain.out
tests/fairland/plain.xdump
tests/fairland/spike.out
tests/fairland/spike.xdump
tests/fairland/stunted-newcap_script
tests/fairland/stunted.out
tests/fairland/stunted.xdump