fairland: Correct island placement bias
A sector is admissible for island placement when land can be grown in every sector within a certain distance. place_island() picks a random start sector, then searches linearly for an admissible sector. If it finds one, it places the island there. Else, it reduces the distance by one and tries again. It fails when none is found even for distance zero. Trying with extra distance is obviously meant to reduce the risk of islands from running into each other without need. Initial distance is @di, the minimum distance between continents, which doesn't really make sense, and is undocumented. Bug: place_island() never tries the start sector. Bias: placement probability is higher for sectors immediately following inadmissible sectors. Because of that, islands are more often placed to the right of existing islands. Players could exploit that to guide their search for land. Rewrite place_island() to pick sectors with equal probability, dropping the undocumented extra distance feature. If it's missed, we can bring it back. The new code visits each sector once. The old code visits only one sector in the best case, but each sector several times in the worst case. fairland performance improves measurably for crowded setups with large @di, else it suffers. For instance, Hvy Fever example given in the commit before previous runs seven times faster for me. With @di reduced to 2, its run time more than doubles. Not that it matters. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
001674e5c5
commit
eecb9c9825
9 changed files with 3661 additions and 3658 deletions
|
@ -15,41 +15,41 @@ World dimensions: 64x32
|
|||
seed is 1
|
||||
placing capitals...
|
||||
growing continents...
|
||||
growing islands: 1(3) 2(8) 3(13) 4(7) 5(10) 6(10) 7(2) 8(8) 9(14) 10(17) 11(13) 12(15) 13(9) 14(8) 15(3)
|
||||
growing islands: 1(7) 2(14) 3(13) 4(3) 5(16) 6(4) 7(17) 8(9) 9(11) 10(12) 11(13) 12(14) 13(17) 14(11) 15(9)
|
||||
elevating land...
|
||||
writing to sectors file...
|
||||
|
||||
. . . % . . . % . . . . . . . . % % . % . . . . . . . . . . . .
|
||||
. . . . . . . . . . . . . . . . . . % % . . . . . . . . . . . .
|
||||
. . . . . . . # # . . . . . . . . . % % % . . . . % . . . . . .
|
||||
. . . . . . # # . # . . . . . . . % % % . . . . % % . . . . . .
|
||||
. . . . . . # # c c # . . . % % % . . . . . . . % % % . . . . .
|
||||
. . . . . # # # # # # . . . % % % . . . . . . . % % . . . . . .
|
||||
. . . . . . . # # # # . . . % . % . . . . . . . . . . . . . . .
|
||||
. . . . . # # # # # . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . # # # . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . # # . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . . . . % . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . . . % % % % . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . . . . % % % . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . . . . % % . . . % . . . . . . . . . . . . . . . . . .
|
||||
. . . % . . . . . . . . . . % % . . # # # # . . . . . . . . . .
|
||||
. . % % . . . . . . . . . % % % . . # # # # . . . . . . % . . .
|
||||
. . . . . . . . . . . . . % % % % . . # # # # . . . . . % % . .
|
||||
. . . . . # # # . . . . . % % % % . # a a # # . . . . % % % % .
|
||||
. . . . # # # # # . . . % . % % % . # # # # # # . . . % % % . .
|
||||
% . . # # # # # . . . % . . . . . # # # # # # . . . . . . . . .
|
||||
% . . # b b # # # . . % . . % % . . . # . . . . . . . . . . % %
|
||||
% . . # # # # # . . . . % % % % % . . . . . . . . . . . . . % %
|
||||
. . . . # # # # . . . . . % % % % . . . . . . . . . . . . . % %
|
||||
. . . . # # . . . . . . % % % . . . . . . . . . . . . . . . % %
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . % .
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . % % . % .
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . % % % . .
|
||||
. . % % . % . . . . . . . . . . . . . . . . . . . . . % % % . .
|
||||
. . % % % . % . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. % % % % . % % % % . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . % % . . % % % % . . . . . % % % . . % % . . . . . . . . . .
|
||||
. . % . . % % % % . . . . . . % % . . . . . . . . . . . . . . .
|
||||
% % % % . . . . . . . . . . . . . . . . . . . . . . % % . . . .
|
||||
% % % % . . . . . . . . . . . . . . . . . . . . . . % % . . . .
|
||||
. % % % . . . # # . . . . . . . . . . . . . . . . . . . . . . .
|
||||
% % % . . . # # . # . . . . . . . . . . . . . . . % % % . . . .
|
||||
. . . . . . # # c c # . . . . . . . . . % % % . . % % % % . % %
|
||||
. . . . . # # # # # # . . . . . . . . . % % . . . . % % . . % %
|
||||
. . . . . . . # # # # . . . . . % . . . % % % % . . . . . . . .
|
||||
. . . . . # # # # # . . . . . % % . . . % % . . . . . . . . . .
|
||||
. . % . . # # # . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
% % % % . # # . . . . . . . . . . . . . . . . . . . . . . . . %
|
||||
. % % % . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
% % % . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . . . . . . . . % % . . . . . . . . . . . . % . . . . .
|
||||
. . . . . . . . . . . . % % % . . . . . . . . . . % % . . . . .
|
||||
. . % % . . . . . . . . % % % % % . # # # # . . % % . . . . . .
|
||||
. % % . . . . . . . . . % % % % . . # # # # . % % % . . . . . .
|
||||
. % % % . . . . . . . . . % % . . . . # # # # . % % % . . . . .
|
||||
. % % . . # # # . . . . . . . . . . # a a # # . . . . % % % . .
|
||||
. . . . # # # # # . . . . . . . . . # # # # # # . % % % % % % .
|
||||
. . . # # # # # . . . . . . . . . # # # # # # . . . . % % % % .
|
||||
. . . # b b # # # . % % % . . . . . . # . . . . . . . . . . % .
|
||||
. . . # # # # # . % % % % % . . . . . . . . . . . . . . . . . .
|
||||
. . . . # # # # . . % % % % % . . . . . . . . . . . . . . . . .
|
||||
. . . . # # . . . . . % % % . % . . . . . . . . . . . . . . . .
|
||||
. . . . . . . . . . . . . % . % % . . . . . . . . . . . . . . .
|
||||
. . . . % % . . . . . . . . % % % . . % % % . . . . . . . . . .
|
||||
. . . % % % . . . . . . . % % % . . . . % % . . . . . . . . . .
|
||||
. . . % % % . . . . . . % % % % . . . % % . . . . . . . . . . .
|
||||
. . . % % % % . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
. . . % % % % . . . . . . . . . . . . . . . . . . % % % . . . .
|
||||
. . . % . . . . . . . . . . . . . . . . . . . . . % % % . . . .
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . % % % . . .
|
||||
|
||||
A script for adding all the countries can be found in "sandbox/no-spike-newcap_script".
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue