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>
Sun, 17 Jan 2021 20:24:28 +0000 (21:24 +0100)
commit4fca4dfddd470d1802eee939c28995dfbabcba5d
tree79e2edd482dfb2f651fe2de9e05a072030307947
parent08ca6ace121318bc31e0c9d8b678ba7a4bf38b11
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