Wave function collapse: Difference between revisions

move "tile" definition to task description -- still could use more conceptual cleanup here
(→‎{{header|J}}: fix the english definition of "tile" to fit how the code works)
(move "tile" definition to task description -- still could use more conceptual cleanup here)
Line 2:
{{Clarify task}}
Write the solution for Wave Function Collapse based on the [https://youtu.be/rI_y2GAlQFM Coding Challenge 171: Wave Function Collapse] and create new map 8x8 tiles with fourth T-blocks with variously directions (┤ ┴ ┬ ├) or blank tiles (space).
 
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. These overlap pixels must identically match with those of its neighboring tile. The "t-blocks" are, thus, partial tiles -- when we build our 8x8 collection of "t-blocks" the individual "t-blocks" must satisfy this overlap constraint with their neighbors.
 
;Reference [https://www.boristhebrave.com/2020/04/13/wave-function-collapse-explained/ WFC explained] and [https://github.com/mxgmn/WaveFunctionCollapse another WFC explained]
Line 214 ⟶ 216:
}}</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 weWe work with two kinds of tiles: the 3x3 argumentpartial tiles, and the larger 17x17 larger tile which we are randomly generating. (17x17 because every 3x3 tile contributes 2x2 pixels to the result and along a horizontal and vertical edge row and column of 3x3 tiles contributes an additional row and column of pixels.)
 
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