Notes

Chapter 5: Two Dimensions and Beyond

Section 7: Systems Based on Constraints


Checking [tilings with] constraints

A set of allowed templates can be specified by a Mathematica pattern of the form t1 | t2 | t3 etc. where the ti are for example {{_, 1, _}, {0, 0, 1}, {_, 0, _}}. To check whether an array list contains only arrangements of colors corresponding to allowed templates one can then use

SatisfiedQ[list_, allowed_] := Apply[And, Map[MatchQ[#, allowed]&, Partition[list, {3, 3}, {1, 1}], {2}], {0, 1}]

From Stephen Wolfram: A New Kind of Science [citation]