Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

CodingTrain/Wave-Function-Collapse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

67 Commits

Repository files navigation

Wave-Function-Collapse

Straight out of quantum mechanics, Wave Function Collapse (WFC) is an algorithm for procedural generation of images. This repository features two approaches to the WFC: the Tiled Model (Coding Challenge 171) and the Overlapping Model (Coding Challenge #186). Both implementations are available in JavaScript (p5.js) and ported to Processing (Java).

GIF animation of the tiled WFC algorithm GIF animation of the overlapping WFC algorithm

Coding Challenges

Archived Raw Footage

Overview

Wave Function Collapse is a constraint-satisfaction algorithm inspired by quantum mechanics. At a high level, you have:

  1. Tiles (or "patterns") that can appear in each cell.
  2. Adjacency rules describing which tiles can appear next to each other.
  3. Entropy that helps decide which cell to collapse (choose a tile for) next.
  4. Propagation to eliminate invalid tiles from neighbors as constraints tighten.

Completed

  • Implementation of Tile Model (Challenge 171)
  • Implementation of Overlapping Model (Challenge 186)
  • Processing (Java) ports for both models

Corrections / Additional Features

  • Additional edge cases for tiles 4 and 5 (Tiled Model).
  • Computed Property Names (Tiled Model) Issue #35
  • Backtracking for conflict resolution.

Community Contributions and Improvements

Key Resources

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /