Go to file
Brian Hicks 9b1d627c2f build in optimized mode 2020-02-22 06:15:16 -06:00
nix update niv 2020-01-06 09:22:41 -05:00
src don't iterate over data so much 2020-02-22 06:11:10 -06:00
tests figure out further issues in get 2020-02-21 08:35:08 -06:00
.envrc check in .envrc 2020-02-20 20:25:55 -06:00
.gitignore add deps 2020-01-31 05:48:29 -06:00
README.md number items instead of dashing them 2020-01-07 12:15:45 -05:00
develop.sh add script to use when doing local dev 2020-01-06 18:32:09 -05:00
elm.json hash window for ID instead of using grid location 2020-01-09 08:29:24 -05:00
netlify.toml build in optimized mode 2020-02-22 06:15:16 -06:00
package-lock.json add deps 2020-01-31 05:48:29 -06:00
package.json add deps 2020-01-31 05:48:29 -06:00
shell.nix add deps 2020-01-31 05:48:29 -06:00


Wave Function Collapse

How to Develop

  1. have Nix (it's available for Mac and Linux)
  2. have direnv
  3. cd here
  4. direnv allow
  5. ./develop.sh
  6. Go to localhost:8000. The browser will reload automatically when you make changes.

To Do / Done

  1. Read the input bitmap and count NxN patterns.
  • (optional) Augment pattern data with rotations and reflections.
  1. Create an array with the dimensions of the output (called "wave" in the source). Each element of this array represents a state of an NxN region in the output. A state of an NxN region is a superposition of NxN patterns of the input with boolean coefficients (so a state of a pixel in the output is a superposition of input colors with real coefficients). False coefficient means that the corresponding pattern is forbidden, true coefficient means that the corresponding pattern is not yet forbidden.
  2. Initialize the wave in the completely unobserved state, i.e. with all the boolean coefficients being true.
  3. Repeat the following steps:
    • Observation:
      • Find a wave element with the minimal nonzero entropy. If there is no such elements (if all elements have zero or undefined entropy) then break the cycle (4) and go to step (5).
      • Collapse this element into a definite state according to its coefficients and the distribution of NxN patterns in the input.
    • Propagation: propagate information gained on the previous observation step.
  4. By now all the wave elements are either in a completely observed state (all the coefficients except one being zero) or in the contradictory state (all the coefficients being zero). In the first case return the output. In the second case finish the work without returning anything.