[Community Puzzle] Wave Function Collapse (sans Shannon)

Coding Games and Programming Challenges to Code Better

Send your feedback or ask for help here!

Created by @Wontonimo,validated by @Blabbage,@LazyMammal and @calebharrison.
If you have any issues, feel free to ping them.

This puzzle is written in a tutorial style. Without posting direct solutions, please share any links, videos, or concepts you think would help others.

This puzzle is not ascii art Westicles (Mrs. GloriaZindlebock)

as said in contribution’s, there are wrong width in inputs of many tests…

does approvers really checked the contribution ? i’m not sure …

Wontonimo , could you fix it ?


Found it. Thanks for pointing that out. The fix is being submitted

Of course I checked and implemented a solution before approving, I think you are quite rude to suggest otherwise to be honest.

The errors must not have affected my solution. It worked without the fix (when testing before approval) and also works just now, after seeing the message that Wontonimo fixed something.

That being said, I do appreciate anyone taking the time to help everyone by pointing out errors, the better and more correct the challenges are, the more fun it is to solve them :slight_smile:


Edit: now I pass 100% by adding an extra check in constrainLetters(), so i never constrain the list of letters if the result would be empty. I still don’t fully understand why was it necessary, it is not obvious for me from the statement.

I do not delete my post below, just in case someone runs into the same problem.

Maybe I misunderstand the WFC algorithm, but i have an issue in IDE TEST #2 “Second Example - Grow it” at x = 5, y = 3. At this position the provided partial solution is:


But the provided prototype has a compatible 3x3 patch only at the border, so

| \ 

However earlier I already constrained the pixel at (x=5,y=3) to be a space, so my code here constrains ALL patches and then all letters.
Or shall we treat borders in the prototype in a special way? One of the hint suggested we need to treat them normally, as part of the image…
Any idea where did i go wrong?

I stumbled across the same problem. Reading about the algorithm, there seems to be a requirement that each 3×3 group of cells in the output should correspond to a 3×3 group in the sample grid.
In this case (Test Case 2) as you mention there is no 3x3 patch that could be extracted from the prototype that matches the solution patch starting from cell at row 3 column 5.