New grids are created either at root, or with wfc
or map
nodes. Example: MazeMap has 2 grids. Grids have one required attribute values
and one optional attribute folder
.
values="BRGUY"
says that black, red, green, blue and yellow values are possible on the grid, and the starting value is black.
folder="DungeonGrowth"
says that the interpreter should look for rule files in the DungeonGrowth folder.
For root grids, there is one more optional boolean attribute called origin
, equal False
by default. If origin is set True
, the interpreter creates a pixel at the center of the grid with the value equal to the second value in values
. For example, values="YRBAN" origin="True"
creates a yellow screen with a red dot in the center.
With most nodes, you can specify the symmetry
attribute. Possible symmetry values are listed in SymmetryHelper.cs. By default, the largest symmetry group is used. Example: in Flowers we need flowers growing vertically and not side-to-side, so we specify that rules should only be mirrored along the x axis.
Rule attributes:
in="BBB/BWB"
- specifies input part of a rule.out="RR DA FR"
- specifies output part of a rule.fin="filename"
- loads input fromfilename.png
orfilename.vox
.fout="filename"
- loads output fromfilename.png
orfilename.vox
.file="filename"
- loads a glued input + output box from file. Example: Circuit.p
- the probability that the rule will be applied. Equals1.0
by default. Example: in Apartemazements only 25% of ceiling locations are converted into light sources.
Slashes /
are y-separators, spaces
are z-separators.
If a file is referenced, the legend
should be specified. Legend lists used values in a scanline order. See example in DungeonGrowth.
There are 3 kinds of rulenodes:
one
nodes, also called(exists)
nodes.all
nodes, also called{forall}
nodes.prl
(parallel) nodes are similar toall
nodes, but they are applied independently of each other, they don't care about rule overlaps. Often executing aprl
node leads to exactly the same result as with anall
node, butprl
is more performant.
Rulenode attributes:
steps="60"
- limits node execution to 60 steps. See an example in River.
See examples of union use in DungeonGrowth.
Inference in MarkovJunior allows to impose constraints on the future state, and generate only those runs that lead to the constrained future. Inference is triggered by putting observe
elements inside rulenodes (inside one
or all
nodes, to be precise). Observe elements have 3 attributes: value
, from
, to
.
For example, <observe value="W" to="BR"/>
means that squares that are currently white should become black or red after a chain of rule applications. <observe value="I" from="B" to="W"/>
means that squares that are currently indigo are turned black immediately, and then should become white after a chain of rule applications.
In SokobanLevel1 we say that the goal I
-squares should become white - this would mean that the puzzle is solved. We also help the inference engine by explicitly saying that the current black, white and red squares should not be white in the end. Since we don't have I
in the ruleset, we say that current indigo squares should be treated as black by setting from="B"
.
Rulenodes with inference have a boolean search
attribute, false by default. If search is set false, the interpreter follows the rule propagation field greedily. If search is set true, the interpreter searches the state graph using the rule propagation field as a heuristic.
If search is set false, the interpreter can be made to follow the goal more strictly or less strictly by varying the floating point temperature
parameter. If search is set true, the attributes are:
- Integer
limit
attribute sets the maximum number of states searched. By default, the number of states is not limited. - Floating point
depthCoefficient
attribute interpolates between breadth-first search and depth-first search.
See examples of inference use in MultiSokoban9, SokobanLevel1, StairsPath, KnightPatrol, CrossCountry, RegularPath, DiagonalPath, EuclideanPath, BishopParity, SnellLaw, SequentialSokoban, CompleteSAW, CompleteSAWSmart.
See examples of map
node use in MazeMap, MarchingSquares, OddScale, OddScale3D, SeaVilla, ModernHouse, CarmaTower.
See examples of path
node use in BasicDijkstraFill, BasicDijkstraDungeon, BernoulliPercolation, Percolation, Circuit, DungeonGrowth.
See examples of convolution
node use in GameOfLife, Cave, ConnectedCaves, ConstrainedCaves, OpenCave, OpenCave3D, Counting, CarmaTower.
See examples of tile WFC in TileDungeon, Knots2D, Knots3D, Surface, EscherSurface, PillarsOfEternity, Apartemazements, SeaVilla, ModernHouse.
See examples of overlap WFC in WaveFlowers, WaveBrickWall, WaveDungeon.
See examples of convchain
node use in ChainMaze, ChainDungeon, ChainDungeonMaze.
Q: How to make a loop? How to make a sequence repeat?
A: To make a sequence repeat, put a sequence
node inside a markov
node. Examples of this: HamiltonianPath, SelectLargeCaves, SelectLongKnots, FireNoise, SmartSAW, FindLongCycle. Counters in markov/sequence nodes are not supported right now. Instead, you may want to repeat the sequence until some node is matched.