Constraints
Constraints are sets of values that define a puzzle under investigation. They include a board, a set of pieces, and a list of true/false flags that define rules for the puzzle. Constraints are passed to a solver program that finds and records all solutions to a puzzle.
These are meant for tiling puzzles (use polycubes/polyominos to fill a footprint with no gaps or overlaps) and packing puzzles (pack a set of polycubes into a specified volume)
Constraint Type
Types of constraints:
- Template: An abstract puzzle definition. Defines a category of puzzles (eg: same constraints and pieces, but over many different board sizes/shapes).
- Generated: An instance of a template- a concrete puzzle definition. Fixed values for all settings.
Board and Piece Supply
The board is a list of coordinates that define a 2D or 3D space that will be filled by pieces.
The piece supply is the set of pieces that fill the board.
Constraint Flags
Constraint flags are true/false values defining rules for a puzzle. Here's a list of constraint flags and what they mean.
Gaps
- 🫥 allowGaps: if true, pieces don't have to fully cover the boardKey. Default false.
Overflow: Pieces extending beyond their board's footprint.
-
🌊 allowGroundLevelOverflow: if true, pieces can extend beyond the footprint of their boardKey, on the level closest to the boardKey. Default false.
-
🌧️ allowSkyLevelOverflow: if true, pieces can extend beyond the footprint of their boardKey, above the level closest to the boardKey. Default false.
-
🏙️ allowUpwardOverflow: if true, pieces can extend upward. This lets us reuse a simple 2D boardKey for 3D puzzles of any height, as long as they don't need a ceiling. Default false. Used by Clones Tile A Rectangle - Restricted Neighbors, Overhang City
Overhangs: where a piece (or part of a piece) is above a different piece or empty space.
-
🪑 allowUnsupportedOverhangs: if true, overhangs over empty space are allowed. Default false.
-
💺 allowSupportedOverhangs: if true, overhangs over other pieces are allowed. Default false. Used by Overhang City, Angel Cube
-
✈️ allowSkyPieces: if true, pieces can be placed without any part touching the ground level. Default false. Used by Angel Cube
Coloring: preventing similar pieces from being placed together. At most one of these can be true. If none of these are true and there are color restrictions enabled, all pieces get the same color.
- 🍏 colorByPiece: if true, each piece is assigned its own color. If a piece is added to supply multiple times, each gets its own color. Default false. Used by Tatami Tiling - 3 color variation
- 🧃 colorByOrientation: if true, each distinct piece orientation gives the piece its own color (up to 6 colors per piece. a cube would have 1 color). Default false. Used by Clones Tile A Rectangle - Restricted Neighbors
Color-Based Restrictions: how close is allowed? If all of these are true, coloring has no effect.
-
👉 allowColorVertexNeighbors: if true, same colors can meet at a vertex. Default true. Used by Clones Tile A Rectangle - Restricted Neighbors, Tatami Tiling - 3 color variation
-
🔪 allowColorEdgeNeighbors: if true, same colors can meet at an edge. Default true.
-
😡 allowColorFaceNeighbors: if true, same colors can meet on a face. Default true.
-
🙈 allowHiddenNeighborsToBreakColorRules: if true, color rules are not applied to pieces where the relevant meeting is buried/hidden in the solved state. Default true.
Other Restrictions on how pieces meet:
- 🚦 allow4PieceEdgeIntersections: if true, four pieces are allowed to meet at an intersection. Used in flat 2D puzzles. Default true. Used by Tatami Tiling - Classic
Turning Pieces
- 🌪️ allowPieceRotation: if true, pieces can be rotated in place (ie, keeping the same face down) Default true. Used by Locked Triangles
- 🎲 allowPieceOrienting: if true, pieces can be flipped to a different face (like rolling dice). Default true. Used by Tatami Tiling - Classic, Tatami Tiling - 3 color variation, P-Pentominos, Locked Triangles
Leftovers
-
🛗 allowUnusedOrientations: if true, the solution can omit piece orientations. This allows for 2D puzzles. Default true.
-
🗑️ allowUnusedPieces: if true, the solution can omit entire pieces. Default false. Used by Tatami Tiling - 3 color variation
Ideas for future constraints
-
allowGroundFloorToBreakColorRules: Spike city would be like block city but towers (any structure beyond ground level) can't touch eachother. This would require an additional flag, like "allowGroundFloorToBreakColorRules"
-
colorEveryOrientation: Does a 1x2x3 piece have 3 orientations or 6? Should there be a flag to decide this? (ie: instead of colorByOrientation, have colorEveryOrientation + colorEveryDistinctOrientation)