wfc in clingo?
✓ Published0🌍 Public
Aaman-tiwari
Last edited Nov 16, 2017
Created on Nov 16, 2017
This example shows a constraint-solving approach to generating a grid of tiles, where each cell is assigned one of two patterns (a or b) so that adjacent cells follow a set of legal pairings. It encodes the Wave Function Collapse algorithm as an answer-set program in Clingo, using a 5×5 grid defined by `cell(1..n, 1..n)` and rules that generate exactly one assignment per cell. The constraints check every adjacent pair via `dx` offsets and forbid any neighbor combination not listed in the `legal` facts. The output is the `assign/3` relation, which reveals the resulting tile layout.
AI-generated description