Wave function collapse: Difference between revisions
→{{header|C}}: remove (bungled) "discard one row and one column from small tiles" mechanism
(→{{header|J}}: use full tiles in result rather than dropping a row and column of pixels) |
(→{{header|C}}: remove (bungled) "discard one row and one column from small tiles" mechanism) |
||
Line 6:
=={{header|C}}==
{{trans|J}}<lang C>#include <
#include <stdlib.h>
#include <string.h>
Line 141 ⟶ 140:
free(possible);
if (!R) return NULL;
char *tiled= malloc(t0*t1*
for (int i0= 0; i0<t0; i0++)
for (int i1= 0; i1<td1; i1++)
for (int j0= 0; j0<t1; j0++)
for (int j1= 0; j1<td2; j1++)
tiled[j1 +
tiles[j1 +
free(R);
return tiled;
Line 159 ⟶ 158:
char *tiled= wfc((char*)tiles, tdims, size);
if (!tiled) exit(0);
for (int i= 0; i<
for (int j= 0; j<
printf("%c ", " #"[tiled[j+i*
}
printf("\n");
Line 171 ⟶ 170:
{{out}}
<pre> # # # # # #
# # # # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # #
# #
# # # # # # # # # # # # # # # # #
#
#
# # # # # # # # # # # # # # # # # # # #
# # # # # # # # # # # # # # # # # # # # # # # #
# # #
# # # #
# #
# # # # # #
# # # # # # # # # # # # # # # # # # # # # # # #
# #
# # # #
# # # # # # # # # # # # # #
# # # # # #</pre>
=={{header|J}}==
|