chiark / gitweb /
Filling: remove directional bias in grid generation.
authorSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 19:49:17 +0000 (20:49 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 20:00:13 +0000 (21:00 +0100)
commit083de051cbc88f391c6bd28481b856013e293ce9
treec9c38b27f22e58b7583b3d0ad424d9ab6a10a3eb
parent1fcb61cffe538c11a11fc2ec94d6470a61df019e
Filling: remove directional bias in grid generation.

The method of generating a solved Filling grid (before winnowing
clues) is to loop over every square of the board, and for each one, if
it has a neighbour which is part of a different region of the same
size (i.e. the board is not currently legal), fix it by merging with
one of its neighbours. We pick a neighbour to merge with based on the
size of its region - but we always loop over the four possible
neighbours in the same order, which introduces a directional bias into
the breaking of ties in that comparison.

Now we iterate over the four directions in random order.
filling.c