aboutsummaryrefslogtreecommitdiff
path: root/auxiliary
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2023-03-28 20:27:27 +0100
committerSimon Tatham <anakin@pobox.com>2023-03-28 20:51:02 +0100
commit6f75879e9fe7cb5dc72c9229d1772e31e4f5c77b (patch)
tree2593b368da3c58b87a9e75d248ad35bf17cd9ace /auxiliary
parent2b1167d82ad7d7f6617c812f61c6b62dd8553e7e (diff)
downloadpuzzles-6f75879e9fe7cb5dc72c9229d1772e31e4f5c77b.zip
puzzles-6f75879e9fe7cb5dc72c9229d1772e31e4f5c77b.tar.gz
puzzles-6f75879e9fe7cb5dc72c9229d1772e31e4f5c77b.tar.bz2
puzzles-6f75879e9fe7cb5dc72c9229d1772e31e4f5c77b.tar.xz
Hats tiling: more uniform parent selection.
This tweak improves the uniformity of the generated patches of hat tiling, by selecting from (the closest 32-bit approximation I can get to) the limiting probability distribution of finite patches in the whole plane. This shouldn't invalidate any grid description that contains enough coordinates to uniquely specify a piece of tiling - in particular, any generated by the game itself. But if anyone's been brave enough to hand-type a grid description in the last two days and left off some of the coordinates, then those might be invalidated.
Diffstat (limited to 'auxiliary')
-rw-r--r--auxiliary/hatgen.c26
1 files changed, 0 insertions, 26 deletions
diff --git a/auxiliary/hatgen.c b/auxiliary/hatgen.c
index 2f2dd9a..d9c6d73 100644
--- a/auxiliary/hatgen.c
+++ b/auxiliary/hatgen.c
@@ -1476,10 +1476,6 @@ int main(int argc, char **argv)
printf(" };\n\n");
{
- struct Parent {
- MetatileType t;
- unsigned index;
- } parents[4][4*MT_MAXEXPAND];
size_t psizes[4] = {0, 0, 0, 0};
size_t csizes[4] = {0, 0, 0, 0};
@@ -1492,8 +1488,6 @@ int main(int argc, char **argv)
" ", HTPF[i]);
for (j = 0; j < nt; j++) {
MetatileType c = t[j].type;
- parents[c][psizes[c]].t = i;
- parents[c][psizes[c]].index = j;
psizes[c]++;
csizes[i]++;
printf(" TT_%c,", HTPF[c]);
@@ -1509,26 +1503,6 @@ int main(int argc, char **argv)
for (i = 0; i < 4; i++)
printf(" %u,\n", (unsigned)csizes[i]);
printf("};\n\n");
-
- for (i = 0; i < 4; i++) {
- printf("static const MetatilePossibleParent "
- "permitted_parents_%c[] = {\n", HTPF[i]);
- for (j = 0; j < psizes[i]; j++)
- printf(" { TT_%c, %u },\n", HTPF[parents[i][j].t],
- parents[i][j].index);
- printf("};\n");
- }
-
- printf("static const MetatilePossibleParent *const "
- "permitted_parents[] = {\n");
- for (i = 0; i < 4; i++)
- printf(" permitted_parents_%c,\n", HTPF[i]);
- printf("};\n");
-
- printf("static const size_t n_permitted_parents[] = {\n");
- for (i = 0; i < 4; i++)
- printf(" %u,\n", (unsigned)psizes[i]);
- printf("};\n\n");
}
{