fairland: Fail when island can't be placed, for fairness

The previous commit made island distribution more fair by placing
islands close to a continent in turn.  This is still unfair when
fairland can't place all the islands.

Make grow_islands() fail when it can't place all islands, and main()
start over then, just like it does when grow_continents() fails.

Deities can no longer fill the world with islands by asking for a
impossibly high number of islands.  Tolerable loss, I think.

fairland-test needs a tweak to avoid loss of test coverage.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2020-08-11 16:16:30 +02:00
parent d434e0cc87
commit 00bfeb833e
5 changed files with 1112 additions and 1090 deletions

View file

@ -17,7 +17,7 @@ $empdump -x >sandbox/plain.xdump
cmp_out plain.xdump plain-newcap_script
$files -f >/dev/null
run_and_cmp stunted $fairland -s sandbox/stunted-newcap_script -R 1 8 37 24 15 0 0 5 2
run_and_cmp stunted $fairland -s sandbox/stunted-newcap_script -R 1 8 35 16 15 0 0 5 2
$empdump -x >sandbox/stunted.xdump
cmp_out stunted.xdump stunted-newcap_script

View file

@ -1,17 +1,17 @@
add 1 1 1 p
newcap 1 62,16
newcap 1 1,11
add 2 2 2 p
newcap 2 5,5
newcap 2 43,7
add 3 3 3 p
newcap 3 45,7
newcap 3 24,10
add 4 4 4 p
newcap 4 51,27
newcap 4 3,1
add 5 5 5 p
newcap 5 12,24
newcap 5 34,20
add 6 6 6 p
newcap 6 22,12
newcap 6 28,0
add 7 7 7 p
newcap 7 29,31
newcap 7 48,28
add 8 8 8 p
newcap 8 38,18
newcap 8 4,22
add 9 visitor visitor v

View file

@ -1,8 +1,8 @@
Creating a planet with:
8 continents
continent size: 37
number of islands: 24
continent size: 35
number of islands: 16
average size of islands: 15
spike: 0%
0% of land is mountain (each continent will have 0 mountains)
@ -15,78 +15,86 @@ World dimensions: 64x32
seed is 1
placing capitals...
growing continents...
Only managed to grow 36 out of 37 sectors.
growing islands: 1(5) 2(7) 3(2) 4(10) 5(12) 6(5) 7(5) 8(1) 9(1) 10(2) 11(7) 12(1) 13(3) 14(1)
No room for island #15
try #2 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 32 out of 37 sectors.
growing islands: 1(17) 2(6) 3(2) 4(9) 5(2) 6(2) 7(3) 8(6) 9(2) 10(1) 11(2) 12(1) 13(1)
No room for island #14
try #3 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 30 out of 37 sectors.
Only managed to grow 32 out of 35 sectors.
try #4 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 33 out of 37 sectors.
growing islands: 1(3) 2(20) 3(2) 4(12) 5(9) 6(2) 7(2) 8(4) 9(1) 10(6) 11(1) 12(1) 13(2) 14(2)
No room for island #15
try #5 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 35 out of 37 sectors.
Only managed to grow 33 out of 35 sectors.
try #6 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 34 out of 37 sectors.
Only managed to grow 33 out of 35 sectors.
try #7 (out of 10)...
placing capitals...
growing continents...
Only managed to grow 29 out of 37 sectors.
Only managed to grow 29 out of 35 sectors.
try #8 (out of 10)...
placing capitals...
growing continents...
growing islands: 1(2) 2(7) 3(16) 4(11) 5(1) 6(2) 7(4) 8(2) 9(1) 10(1) 11(1)
No room for island #12
11 stunted islands
growing islands: 1(4) 2(9) 3(5) 4(8) 5(2) 6(2) 7(3) 8(7) 9(2) 10(8) 11(10) 12(2)
No room for island #13
try #9 (out of 10)...
placing capitals...
growing continents...
growing islands: 1(9) 2(1) 3(2) 4(3) 5(9) 6(4) 7(2) 8(7) 9(3) 10(4) 11(2) 12(2) 13(7) 14(2) 15(1) 16(1)
16 stunted islands
elevating land...
writing to sectors file...
. . # # # # # . . . . . . # # a a # # . . . . . % . . . . . . .
. # # # # # # # . . . . . # # # # # . . . . . . % . . . . . . .
. # # h h # # . . . % . . . . # # # . . . . . . . . . . . . . .
# # # # # . . . . % . . . . . # # . . . . . . . . . . . . . . .
# # # # # . . . . . . . . . . . . . . . . . . . . . . . . . . .
# # # # . . . . . . . . . . . . . . . . . # # # # # # . . . . .
. . . # . . . . . . . . . . . . % % . . . # # # # # # . . . . .
. . . . . . . . . # # # . . . . . . . . # # # # # # . . . . . .
. . . . . . . . # # # # # . . . . . . . # # e e # # . . . . . .
. . . . . . . # # # # # # # . . % . . . # # # # # . . . . . . .
. . % . . . . # # # # # # # . . % . . . . # # # # . . . . . . .
. . % . . . # # # d d # # . . % % . . . . # # # . . . . . # # #
# . . % . . . . # # # # # # . . % % . . . . # . . . . . . # # #
. . . % . . . . . . # # . . . % . . . % . . . . . . . . # # # #
# # . . . . . . . . . . . . . % . . . . . . . . . . . . # # # #
# . . . . . . . . . . . . % % . . . . . . . . . . . . # # # g g
# # . . . % % % . . . . . % . . . . . . . % % . . . . # # # # #
# . . . . . . % % . . . . . . . . . # . . . % % . . . # # # # #
# . . . . . . . . % % % . . . . . # # # . . . . % . . . . . . .
. . . . . # . . . . % % . . . . # # # # # . . . % . . . . . . .
. . . . . # # # . . . % . . . . # # # # # # # . . % . . . . . .
. . . . # # # # # . . % . . . # # # b b # # # . . . . . . . . .
. % . . # # # # # # . . % . . . # # # # # # # . . . . . . . . .
. . . # # # c c # . . . % . . . # # # # # # . . . . . # # . . .
. . . . . # # # # # # . . % . . . . . . . . . . . . . # # # # .
. . . . # # # # # # # . . % . . . . . . . . . . . . # # # # . .
. . . . . . . . . # # . . . . . . . . . . . % . . . # # # # # .
. . . . . . . . . # . . . . . . . . . . . . . . . # # # # # # .
. . . . . . . . . . . . . . . . . . . . . . . . . # # f f # . .
. . . . . . . . . . . . . . # # # # # # . . . . . # # # # # . .
. . . . . . . . . . . . . . # # # # # # # . . . . . # # # # . .
. . # # # # . . . . % . . # # # # # # # # . . . . . # # . . . .
. . . . . . . . . . . % % % . . . . . . . . . . . . . . . . . .
# # # # . . . . . . . . . . . . . . . . . . . . . . . . . . . .
# # # # # # . . % % . . . . . . . . . . . . . . . . . . . . . .
# # # # # # . . % . . % % . . # # # # # # # # . . % . . % . . #
# e e # # # . . % . . % % . . # # # # # # # # # . . . . % . . #
# # # # # . . % % . . % % . . . # # # # # # # . . . . % % . . #
# # # # . . . % . . . . . % . . . # h h # # # . . . . . % % . .
. . # . . . . . . . . . . . . . . . # # # . . . . . . . % % . .
. . . . . . . . . . . . . . . . . . . # # . . . . . % . . . % .
. . . . . . . . . . . . . . . . . . . . . . . . . % % . . . . .
. . . . . . . . # # # # # . . . . . . . . . . . . . % . . . . .
. . . % . . # # # # # # . . . % % . . . . . % % . . . . . . . .
. . . % . . # # g g # # # . . . . . . . . . . . % . . . # # # #
. . . . . # # # # # # # . . . . . . . . . . . . . . . # # # # #
# . . . . . # # # # # # . . . . . # # # # # # . . . . . # # # #
# . . . . . # # # # . . . . . . # # # # # . . . . % . . # # # #
# # . . . . . . . . . . . . . . # # # # # # . . . % . . # # f f
# . . . . . . . . . . % . . . # # d d # # # . . . . . . # # # #
# . . . % . . . . . . . . . . . # # # # # # . . . . . . . . # #
. . . . . . . . . . . . . . . . # # # # # . . . % % . . . . # #
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. . . . # # # # # # . . . . . . . . . . . . . . . . . . . . . .
. . . . # # # # # # . . . % % . . . . . . . . . . # . . . . . .
. . . # # b b # # . . . % . . . . . . . . . . . . # # . . . . .
. . . . # # # # # # . . . . . . . . . . . . . . . . # # . . . .
. . . . # # # # # . . . . . # # # # # # # . . . . . # # # # # .
. . . . . # # # # . . . . . # # # # # # # . . . . . # # c c # #
. . . . . . # # . . . . . # # # a a # # . . . . . # # # # # # #
. . % . . . . . . . . % . . # # # # # # # . . . . . # # # # . .
. % . . . . . . . . . % . . # # # # # # # . . . . . # # # . . .
. . . . . . % % % . . % % . . . . . . . . . . . . . # # # . . .
. . . . . . . . % . . % % . . . . . . . . . . . . . # # . . . .
A script for adding all the countries can be found in "sandbox/stunted-newcap_script".

File diff suppressed because it is too large Load diff