Wave function collapse: Difference between revisions
m
→{{header|C}}: variable name fix to match task concepts
(J: The t-blocks are not tiles in the sense of this task) |
m (→{{header|C}}: variable name fix to match task concepts) |
||
Line 13:
#include <time.h>
char
{
{0, 0, 0},
Line 37:
};
char *wfc(char *
int N= target[0]*target[1], t0= target[0], t1= target[1];
int *adj= calloc(N*4, sizeof (int));
Line 56:
horz[j+i*td0]= 1;
for (int k= 0; k<td1; k++) {
if (
horz[j+i*td0]= 0;
break;
Line 68:
vert[j+i*td0]= 1;
for (int k= 0; k<td2; k++) {
if (
vert[j+i*td0]= 0;
break;
Line 142:
free(possible);
if (!R) return NULL;
char *
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++)
free(R);
return
}
Line 158:
time_t t;
srandom((unsigned) time(&t));
char *
if (!
for (int i= 0; i<17; i++) {
for (int j= 0; j<17; j++) {
printf("%c ", " #"[
}
printf("\n");
}
free(
exit(0);
}</lang>
|