fairland: Make actual island sizes fair
The previous commit reduced the difference in island size within the same batch of islands to at most one. Eliminate the remaining difference by shrinking the bigger islands by one sector. This invalidates the precomputed exclusive zones, so recompute them. 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:
parent
8d0c196c8b
commit
696d31460c
7 changed files with 1749 additions and 1743 deletions
|
@ -65,7 +65,7 @@
|
|||
* Each continent has a "sphere of influence": the set of sectors
|
||||
* closer to it than to any other continent. Each island is entirely
|
||||
* in one such sphere, and each sphere contains the same number of
|
||||
* islands.
|
||||
* islands with the same sizes.
|
||||
*
|
||||
* Pick an island size, and place one island's first sector into each
|
||||
* sphere, randomly. Then add one sector to each island in turn,
|
||||
|
@ -944,15 +944,17 @@ can_grow_at(int c, int x, int y)
|
|||
static void
|
||||
adj_land_update(int x, int y)
|
||||
{
|
||||
int is_land = own[x][y] != -1;
|
||||
int dir, nx, ny, noff;
|
||||
|
||||
assert(own[x][y] != -1);
|
||||
|
||||
for (dir = DIR_FIRST; dir <= DIR_LAST; dir++) {
|
||||
nx = new_x(x + diroff[dir][0]);
|
||||
ny = new_y(y + diroff[dir][1]);
|
||||
noff = XYOFFSET(nx, ny);
|
||||
adj_land[noff] |= 1u << DIR_BACK(dir);
|
||||
if (is_land)
|
||||
adj_land[noff] |= 1u << DIR_BACK(dir);
|
||||
else
|
||||
adj_land[noff] &= ~(1u << DIR_BACK(dir));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1118,13 +1120,17 @@ grow_islands(void)
|
|||
{
|
||||
int n = ni / nc;
|
||||
int stunted_islands = 0;
|
||||
int i, j, c, done, secs, isiz;
|
||||
int xzone_valid = 0;
|
||||
int i, j, c, done, secs, isiz, x, y;
|
||||
|
||||
xzone_init(nc);
|
||||
init_spheres_of_influence();
|
||||
|
||||
for (i = 0; i < n; i++) {
|
||||
c = nc + i * nc;
|
||||
|
||||
if (!xzone_valid)
|
||||
xzone_init(c);
|
||||
|
||||
isiz = roll(is) + roll0(is);
|
||||
|
||||
for (j = 0; j < nc; j++) {
|
||||
|
@ -1143,6 +1149,21 @@ grow_islands(void)
|
|||
}
|
||||
}
|
||||
|
||||
if (!done) {
|
||||
secs--;
|
||||
for (j = 0; j < nc; j++) {
|
||||
if (isecs[c + j] != secs) {
|
||||
isecs[c + j]--;
|
||||
assert(isecs[c + j] == secs);
|
||||
x = sectx[c + j][secs];
|
||||
y = secty[c + j][secs];
|
||||
own[x][y] = -1;
|
||||
adj_land_update(x, y);
|
||||
}
|
||||
}
|
||||
xzone_valid = 0;
|
||||
}
|
||||
|
||||
for (j = 0; j < nc; j++)
|
||||
stunted_islands += isecs[c + j] != isiz;
|
||||
|
||||
|
|
|
@ -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 35 24 3 0 0 5 2
|
||||
run_and_cmp stunted $fairland -s sandbox/stunted-newcap_script -R 1 8 35 24 20 0 0 5 2
|
||||
$empdump -x >sandbox/stunted.xdump
|
||||
cmp_out stunted.xdump stunted-newcap_script
|
||||
|
||||
|
|
|
@ -15,29 +15,29 @@ World dimensions: 64x32
|
|||
seed is 1
|
||||
placing capitals...
|
||||
growing continents...
|
||||
growing islands: 1(12) 2(12) 3(12) 4(11) 5(12) 6(12) 7(12) 8(12)
|
||||
growing islands: 1(11) 2(11) 3(11) 4(11) 5(11) 6(11) 7(11) 8(11)
|
||||
8 stunted islands
|
||||
elevating land...
|
||||
writing to sectors file...
|
||||
|
||||
^ b b # # . . . . ^ % . % % . . % % ^ . . . . . . . . . % . . .
|
||||
# # ^ # . . . % % % % . % % % % % % % . . . . . . . % % . # # #
|
||||
^ b b # # . . . . ^ % . % % . . % % ^ . . . . . . . . . . . . .
|
||||
# # ^ # . . . % % % % . % % % % % % . . . . . . . . % % . # # #
|
||||
# # # # . . . % % % % . % % % . . . . . . . . . . . % % % . # #
|
||||
# # . . . . % . . % . . % % % . % . . . . . . . . . % ^ % . . #
|
||||
# # . . . . . . . % . . % % % . . . . . . . . . . . % ^ % . . #
|
||||
. # . . . . . . # . . . . % % ^ % . . . . . . . . . . % % % . .
|
||||
. . . . . . . # # . . . . . % . . # # . . . . . . . . . . . . .
|
||||
. . . . . # # # ^ # . . . # . . # # # # # # . . . . . . . . . #
|
||||
. . . . # # # # # . . . . # # # ^ f f . . # # . . . . . . . # .
|
||||
# . . . . # # e e ^ # . . . . # # ^ # . . . # . . . . . . . # #
|
||||
. % . . . . # # # # # # . . # ^ # # . . . . # . . . . . . ^ # #
|
||||
. ^ . . . . # # # # # # . . # ^ # # . . . . # . . . . . . ^ # #
|
||||
. % % . . . . # ^ . # # . . # # # . . . . . . . . . . . . # ^ #
|
||||
. % % . . . . # . . . . . . . . . . . . . . . . . . . . h h # ^
|
||||
. % % . . . . . . . . . . . . . . . . . . . . . . . # # # # # #
|
||||
% ^ % . . . . . . . . . . . . . . . . . . . . . . # # # . . # .
|
||||
. % % . . . . . . . . . . . . . . . . # . . . . . # . # . . # #
|
||||
% % % . . . . . . . . . . . . . . . . . . . . . . # # # . . # .
|
||||
. . % . . . . . . . . . . . . . . . . # . . . . . # . # . . # #
|
||||
. . . . . . . . . . . . . . . . . # # # # # # . . . . # . . . .
|
||||
. . . . . . . # . # # . . . . . . . . # ^ # ^ # . . . . . . . .
|
||||
. . . . . . ^ # # # . . . . . . . . # # d d # # . . . . . . % .
|
||||
. . . . . . ^ # # # . . . . . . . . # # d d # # . . . . . . . .
|
||||
% . . . . # # # # . . . . . . . . . # # ^ # # # # . . . . . . %
|
||||
% . . . . # # # . . . . . . . . . # . # . . . # . . . . . # . ^
|
||||
% . . . # # c c . . . . . . . . . # . . . % % . # . . . # # # .
|
||||
|
@ -48,7 +48,7 @@ writing to sectors file...
|
|||
. . . . . % . # ^ . . . . . . # . # # . . . . . . . # # . . # #
|
||||
. . . . . . ^ . . . . . . # # # # # # . . . . . . . . . . . # #
|
||||
. . . . . % % % . . . . . . . ^ # # # # . . . . . . . . # # . .
|
||||
. . . . . . % % % % . . . . . # a a # ^ # . . . . . . . . . . .
|
||||
. . . . . . % % % . . . . . . # a a # ^ # . . . . . . . . . . .
|
||||
. # . . . . . % % % . . . . # # # # # # . . . . . . . . . . . .
|
||||
^ # # . . . . . . . . . . . . . . # # . . . . . . . . . . . . .
|
||||
# # # # . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,17 +1,17 @@
|
|||
add 1 1 1 p
|
||||
newcap 1 13,13
|
||||
newcap 1 47,11
|
||||
add 2 2 2 p
|
||||
newcap 2 45,29
|
||||
newcap 2 42,0
|
||||
add 3 3 3 p
|
||||
newcap 3 49,13
|
||||
newcap 3 57,23
|
||||
add 4 4 4 p
|
||||
newcap 4 17,29
|
||||
newcap 4 61,3
|
||||
add 5 5 5 p
|
||||
newcap 5 31,7
|
||||
newcap 5 31,21
|
||||
add 6 6 6 p
|
||||
newcap 6 63,3
|
||||
newcap 6 14,26
|
||||
add 7 7 7 p
|
||||
newcap 7 31,21
|
||||
newcap 7 24,6
|
||||
add 8 8 8 p
|
||||
newcap 8 63,23
|
||||
newcap 8 9,15
|
||||
add 9 visitor visitor v
|
||||
|
|
|
@ -3,7 +3,7 @@ Creating a planet with:
|
|||
8 continents
|
||||
continent size: 35
|
||||
number of islands: 24
|
||||
average size of islands: 3
|
||||
average size of islands: 20
|
||||
spike: 0%
|
||||
0% of land is mountain (each continent will have 0 mountains)
|
||||
minimum distance between continents: 5
|
||||
|
@ -15,74 +15,59 @@ World dimensions: 64x32
|
|||
seed is 1
|
||||
placing capitals...
|
||||
growing continents...
|
||||
growing islands: 1(2) 2(2) 3(2) 4(2) 5(2) 6(2) 7(1) 8(1) 9(2) 10(2) 11(2) 12(1) 13(2) 14(2) 15(1) 16(2)
|
||||
No room for island #19
|
||||
growing islands: 1(2) 2(2) 3(2) 4(2) 5(2) 6(2) 7(2) 8(2) 9(1) 10(1) 11(1) 12(1) 13(1) 14(1) 15(1) 16(1)
|
||||
No room for island #23
|
||||
|
||||
try #2 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
growing islands: 1(2) 2(3) 3(3) 4(3) 5(2) 6(3) 7(3) 8(3) 9(1) 10(1) 11(2) 12(2) 13(2) 14(2) 15(1) 16(2)
|
||||
No room for island #18
|
||||
Only managed to grow 33 out of 35 sectors.
|
||||
|
||||
try #3 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
Only managed to grow 33 out of 35 sectors.
|
||||
growing islands: 1(2) 2(2) 3(2) 4(2) 5(2) 6(2) 7(2) 8(2) 9(1) 10(1) 11(1) 12(1) 13(1) 14(1) 15(1) 16(1)
|
||||
No room for island #24
|
||||
|
||||
try #4 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
Only managed to grow 32 out of 35 sectors.
|
||||
|
||||
try #5 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
Only managed to grow 29 out of 35 sectors.
|
||||
|
||||
try #6 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
Only managed to grow 33 out of 35 sectors.
|
||||
|
||||
try #7 (out of 10)...
|
||||
placing capitals...
|
||||
growing continents...
|
||||
growing islands: 1(1) 2(2) 3(2) 4(2) 5(2) 6(2) 7(2) 8(2) 9(2) 10(2) 11(2) 12(2) 13(1) 14(2) 15(2) 16(2) 17(2) 18(2) 19(2) 20(2) 21(2) 22(2) 23(1) 24(1)
|
||||
10 stunted islands
|
||||
growing islands: 1(1) 2(1) 3(1) 4(1) 5(1) 6(1) 7(1) 8(1) 9(1) 10(1) 11(1) 12(1) 13(1) 14(1) 15(1) 16(1) 17(1) 18(1) 19(1) 20(1) 21(1) 22(1) 23(1) 24(1)
|
||||
24 stunted islands
|
||||
elevating land...
|
||||
writing to sectors file...
|
||||
|
||||
. # . . . . . # # # # . . . % % . . . . . . # # . . . . . . . .
|
||||
# # . . . . . . # # . . . . . . . . . . . . # # . . . . . . # #
|
||||
# # # . . . . . . . . . . . . . . . . . . . . . . . . . . . # #
|
||||
# # . . . . % . . . . . . . # # # # . . . . . . . % . . . # # #
|
||||
# # # . . . . % . . . . . . # # # # # . . . . . . % . . . . # #
|
||||
g # # . . . . . . . . . . . # # # # # . . % . . . . . % . . # g
|
||||
# # # . . . . . . % % . . # # # # # # # . . . . . . . . . . # #
|
||||
# # . . . . . . . . . . . # # h h # . . . . . . . . . . . . # #
|
||||
. # . . . % % . . . . . . . # # # # # . . . . . . . . . . . . .
|
||||
. . . . . . . . . . % . . . # # # # . . . . . # # # . . . . . .
|
||||
. . . . . . . . . . . % . . . . . . . . . . . # # # # . . . . .
|
||||
% . . . . # # # # . . . . . . . . . . . % . . # # # # . . . . %
|
||||
. . . . . # # # # # . . . . . . . . . . % . . # # # # # . . . .
|
||||
. . . . # # b b # # # . . . % % . . . . . . # # d d # # . . . .
|
||||
. . . . . # # # # # # # . . . . . . . . . . . # # # # # . . % %
|
||||
. . . . . # # # # # # . . . . . . . . . . . . # # # # . . . . .
|
||||
. % % . . . # # # # . . . . . . # # # . . . . . # # # . . . . .
|
||||
. . . . . . . # # . . . . . . # # # # . . . . . . # . . . . . .
|
||||
. . . . . . . . . . . . . . . # # # # # . . . . . . . . . % . .
|
||||
# # . . . % . . . . . . . . # f f # # # . . . . . . . . % . . .
|
||||
# # # . . . % . . . . . . . . # # # # # # . . . % % . . . . . .
|
||||
# # # . . . . . . . . . % . . # # # # # . . . . . . . . . . # #
|
||||
# # # # . . . . . % % . . % . . # # # # . . . . . . . % . . # #
|
||||
e # # # . . . . . . . . . . . # # . . . . . . . . . . . . # # e
|
||||
# # # # . . . . . . . . . . . . . . . . . . . . . . . . . . # #
|
||||
# # . . . . . . # # . . . . . . . . . . . . . # . . . . . . # #
|
||||
# . . . . . . . # # # . . . . . . % % . . . . # # # . . . . . #
|
||||
. . . . . . . # # # # . . . . . . . . . . . # # # # . . . . . .
|
||||
. . . . . . . # # # # # # . . % . . . . . # # # # # # . . . . .
|
||||
. . % . . . # # c c # . . . % . . . . . # # a a # # . . % . . .
|
||||
. . . % . . . # # # # # . . . . . . % . . # # # # # # . . . . .
|
||||
. . . . . . . # # # # . . . . . . . % . . # # # # # . . . . . .
|
||||
. . . . . . . . . . . . . . . . . . . # # # # # # . . . . . . %
|
||||
. . . . . . . . . . . . . . . . . . . # # # # # # # . . . . . .
|
||||
. . . . . . . % . . . . . . . . . . . . # # # # # # . . . . . .
|
||||
. # # # . . . . . . . . . . . . . . . . . . . . . . . . . . # .
|
||||
# # # # # . . . . . . # # # # # . . . . . . . . . . . . . . # #
|
||||
e # # # . . . . . # # # # # # # . . . . . . . . . . . % . . # e
|
||||
# # # # # . . . . . # # # # # # # . . % . . . . . . . . . . # #
|
||||
# # # . . . . % . . # # c c # # # . . . . . . . . . . . . . # #
|
||||
# # # . . . . . . . . # # # # # # . . . . . # # # # . . . . . #
|
||||
# . . . . . . . . . . . # # . . . . . . . # # # # # . . . . . #
|
||||
. . . . . . . . . . . . . # . . . . . . . # # f f # # . . . . .
|
||||
. . . . . . . . . . . . . . . . % . . . # # # # # # # . . . . .
|
||||
. . . . . . # # . . % . . . . . . . . . . # # # # # # # . . . %
|
||||
. % . . . # # # . . . . . . . . . . . . . . # # # # . . . . . .
|
||||
. . . . # # # # # . . . % . . . . . . % . . . # # . . . . . . .
|
||||
. . . # # # # # . . . . . . . . . . . . . . . . . . . . % . . %
|
||||
. . . # # b b # # . . . . . # # # . . . . . . . . . . . . . . .
|
||||
. . . # # # # # # . . . . . # # # . . . . . % . . . . . . . . .
|
||||
. . . . # # # # # . . . . . # # # # # . . . . . . . . . . . . %
|
||||
. . . # # # . . . . . . . # d d # # . . % . . . . . . . . . . .
|
||||
. . . . . . . . . . . . . # # # # # # . . . . . . . # # # . . .
|
||||
. . . . . . . . . . . . . # # # # # . . . . % . . # # # # . . .
|
||||
. . . . . . . . . . . . . . # # # # . . . . . . . . # # g g # .
|
||||
. . . . . . . . . . . . . . # # # . . . % . . . . . # # # # # #
|
||||
. . . . . % . . . # . . . . . # . . . . . . . . . . # # # # # #
|
||||
. . . . . . . # # # . . . . . . . . . . . . . . . . # # # # # .
|
||||
. . . . . . . # # # # . . . . . . . . . % . . . . . . # # # # .
|
||||
. . . . . # # a a # # . . . . . . % . . . . . . . . . # # . . .
|
||||
. . . . . # # # # # # # . . . . . . . . . . . . . . . . . . . .
|
||||
. . . . . # # # # # # # . . . . . . . # # # # . . . . . . . . %
|
||||
. . . . . . . # # # # # # . . . . . # # # # # # . . . . . . . .
|
||||
. . . . . . . # . . . . . . % . . . # # h h # # . . . % . . . .
|
||||
|
||||
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
Loading…
Add table
Add a link
Reference in a new issue