Checking [tilings with] constraints
A set of allowed templates can be specified by a Mathematica pattern of the form t1 | t2 | t3
✖
\!\(\*SubscriptBox[\(t\),\(1\)]\)|\!\(\*SubscriptBox[\(t\),\(2\)]\)|\!\(\*SubscriptBox[\(t\),\(3\)]\)
etc. where the ti
✖
\!\(\*SubscriptBox[\(t\),\(i\)]\)
are for example {{_, 1, _}, {0, 0, 1}, {_, 0, _}}
✖
{{_, 1, _}, {0, 0, 1}, {_, 0, _}}
. To check whether an array list
✖
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}]