Class ParityConstraint
This constraint doesn't actually constrain anything, it improves the quality for the search. It only works for tilesets that entirely, or predominantly, have even numbers of exits (i.e. straights, corners, crossroads, but not forks or deadends). These sorts of tilesets can be challenging for WFC without the additional guidance this constraint supplies.
The parity of any set of tiles is defined as the even/oddness of the sum over those tiles of path exits. Let's assume that path exits are symmetric - x has an exit to adjacent tile y if y has an exit to x. Then the parity of a connected region of cells is often computable even before all the tiles are selected. The parity constraint uses this to lookahead and determine what tiles must be placed.
This constraint is experimental.
Implements
Namespace: DeBroglie.Constraints
Assembly: DeBroglie.dll
Syntax
public class ParityConstraint : ITileConstraint
Properties
| Edit this page View SourcePathSpec
Declaration
public EdgedPathSpec PathSpec { get; set; }
Property Value
Type | Description |
---|---|
EdgedPathSpec |
Methods
| Edit this page View SourceCheck(TilePropagator)
Called frequently during generation to help maintain the constraint.
Declaration
public void Check(TilePropagator propagator)
Parameters
Type | Name | Description |
---|---|---|
TilePropagator | propagator | The propagator to constrain |
Init(TilePropagator)
Called once when the propagator first initializes.
Declaration
public void Init(TilePropagator propagator)
Parameters
Type | Name | Description |
---|---|---|
TilePropagator | propagator | The propagator to constrain |
VisitIndex(int, bool[])
Declaration
public void VisitIndex(int index, bool[] visited)
Parameters
Type | Name | Description |
---|---|---|
int | index | |
bool[] | visited |