Wave function collapse: Difference between revisions

→‎{{header|J}}: fix the english definition of "tile" to fit how the code works
(J: bugfix)
(→‎{{header|J}}: fix the english definition of "tile" to fit how the code works)
Line 214:
}}</lang>
 
For this task, a "tile" represents a rectangular matrix of black or white pixels which is thought of a being potentially repeated arbitrarily in all directions with a one pixel overlap with each of its adjacent neighbors. And, we work with two kinds of tiles: the 3x3 argument tiles, and the 16x1617x17 larger tile which we are randomly generating. (Conceptually,17x17 ofbecause theevery argument tiles overlaps with its neighbors by one pixel, thus each argument3x3 tile only contributes a 2x2 pixel regionpixels to the result. (Perhapsand we should makealong a onehorizontal pixeland exceptionvertical foredge tworow bordersand incolumn theof larger3x3 tiletiles whichcontributes wean areadditional assemblingrow --and creating a 17x17 tile -- but if it's actually a tile, regularitycolumn of structure in its larger tiling space suggests that that would be a bad ideapixels.))
 
Here, <code>m</code> is the list of tiles, and <code>i</code> represents an 8x8 list of indexes into that list (or, conceptually whatever dimensions were specified by <code>y</code>, the right argument to <code>wfc</code> -- but for this task <code>y</code> will always be <code>8 8</code>), with <code>_1</code> being a placeholder for the case where the index hasn't been choosen -- initially, we pick a random location in <code>i</code> and assign an arbitrarily picked tile to that location.
6,962

edits