Full Code of mxgmn/MarkovJunior for AI

main 42aaf24bcf54 cached
409 files
384.9 KB
128.8k tokens
188 symbols
1 requests
Download .txt
Showing preview only (432K chars total). Download the full file or copy to clipboard to get everything.
Repository: mxgmn/MarkovJunior
Branch: main
Commit: 42aaf24bcf54
Files: 409
Total size: 384.9 KB

Directory structure:
gitextract_hx1ombn3/

├── .github/
│   └── FUNDING.yml
├── .gitignore
├── CITATION.cff
├── LICENSE
├── MarkovJunior.csproj
├── README.md
├── models/
│   ├── Apartemazements.xml
│   ├── Backtracker.xml
│   ├── BacktrackerCycle.xml
│   ├── Basic.xml
│   ├── BasicBrickWall.xml
│   ├── BasicDijkstraDungeon.xml
│   ├── BasicDijkstraFill.xml
│   ├── BasicDungeonGrowth.xml
│   ├── BasicKeys.xml
│   ├── BasicPartitioning.xml
│   ├── BasicSkyline.xml
│   ├── BasicSnake.xml
│   ├── BernoulliPercolation.xml
│   ├── BiasedGrowth.xml
│   ├── BiasedGrowthContraction.xml
│   ├── BiasedMazeGrowth.xml
│   ├── BiasedVoronoi.xml
│   ├── BishopParity.xml
│   ├── BlueNoise.xml
│   ├── CarmaTower.xml
│   ├── Cave.xml
│   ├── CaveContour.xml
│   ├── CentralCrawlers.xml
│   ├── CentralSAW.xml
│   ├── ChainDungeon.xml
│   ├── ChainDungeonMaze.xml
│   ├── ChainMaze.xml
│   ├── Chase.xml
│   ├── Circuit.xml
│   ├── ClosedSurface.xml
│   ├── ColoredKnots.xml
│   ├── CompleteSAW.xml
│   ├── CompleteSAWSmart.xml
│   ├── ConnectedCaves.xml
│   ├── ConstrainedCaves.xml
│   ├── Counting.xml
│   ├── Coupling.xml
│   ├── Crawlers.xml
│   ├── CrawlersChase.xml
│   ├── CrossCountry.xml
│   ├── Cycles.xml
│   ├── DenseSAW.xml
│   ├── DiagonalPath.xml
│   ├── Digger.xml
│   ├── DijkstraDungeon.xml
│   ├── Division.xml
│   ├── DualRetraction.xml
│   ├── DualRetraction3D.xml
│   ├── DungeonGrowth.xml
│   ├── DwarfPath.xml
│   ├── Dwarves.xml
│   ├── Escher.xml
│   ├── EscherSurface.xml
│   ├── EuclideanPath.xml
│   ├── FindLongCycle.xml
│   ├── FireNoise.xml
│   ├── Flowers.xml
│   ├── Forest.xml
│   ├── ForestFire.xml
│   ├── ForestFireCA.xml
│   ├── GameOfLife.xml
│   ├── GoTo.xml
│   ├── GoToGradient.xml
│   ├── GrowTo.xml
│   ├── Growth.xml
│   ├── GrowthCompetition.xml
│   ├── GrowthContraction.xml
│   ├── GrowthWalk.xml
│   ├── HamiltonianPath.xml
│   ├── HamiltonianPaths.xml
│   ├── Hills.xml
│   ├── IrregularMazeGrowth.xml
│   ├── IrregularSAW.xml
│   ├── Island.xml
│   ├── Keys.xml
│   ├── KnightPatrol.xml
│   ├── Knots2D.xml
│   ├── Knots3D.xml
│   ├── Laplace.xml
│   ├── Lightning.xml
│   ├── LoopErasedWalk.xml
│   ├── LoopGrowth.xml
│   ├── LostCity.xml
│   ├── MarchingSquares.xml
│   ├── MazeBacktracker.xml
│   ├── MazeGrowth.xml
│   ├── MazeMap.xml
│   ├── MazeTrail.xml
│   ├── ModernHouse.xml
│   ├── MultiHeadedDungeon.xml
│   ├── MultiHeadedWalk.xml
│   ├── MultiHeadedWalkDungeon.xml
│   ├── MultiSokoban8.xml
│   ├── MultiSokoban9.xml
│   ├── NestedGrowth.xml
│   ├── NoDeadEnds.xml
│   ├── Noise.xml
│   ├── NystromDungeon.xml
│   ├── OddScale.xml
│   ├── OddScale3D.xml
│   ├── OpenCave.xml
│   ├── OpenCave3D.xml
│   ├── OrganicMechanic.xml
│   ├── OrientedEscher.xml
│   ├── PaintCompetition.xml
│   ├── ParallelGrowth.xml
│   ├── ParallelMazeGrowth.xml
│   ├── ParallelWalk.xml
│   ├── Partitioning.xml
│   ├── Percolation.xml
│   ├── PeriodicEscher.xml
│   ├── PillarsOfEternity.xml
│   ├── Push.xml
│   ├── PutColoredLs.xml
│   ├── PutLs.xml
│   ├── RainbowGrowth.xml
│   ├── RandomWalk.xml
│   ├── Rectangle.xml
│   ├── RegularPath.xml
│   ├── RegularSAW.xml
│   ├── RegularSAWRestart.xml
│   ├── River.xml
│   ├── Rosettes.xml
│   ├── SAWRestart.xml
│   ├── SeaVilla.xml
│   ├── SelectLargeCaves.xml
│   ├── SelectLongKnots.xml
│   ├── SelfAvoidingWalk.xml
│   ├── SequentialSnake.xml
│   ├── SequentialSokoban.xml
│   ├── Sewers.xml
│   ├── SmartSAW.xml
│   ├── SmarterDigger.xml
│   ├── SmoothTrail.xml
│   ├── Snake.xml
│   ├── SnellLaw.xml
│   ├── SoftPath.xml
│   ├── SokobanLevel1.xml
│   ├── SokobanLevel2.xml
│   ├── StableCrawlers.xml
│   ├── StairsPath.xml
│   ├── StochasticVoronoi.xml
│   ├── StormySnellLaw.xml
│   ├── StrangeDungeon.xml
│   ├── StrangeGrowth.xml
│   ├── StrangeNoise.xml
│   ├── SubmergedKnots.xml
│   ├── Surface.xml
│   ├── Tetris.xml
│   ├── Texture.xml
│   ├── TileDungeon.xml
│   ├── TilePath.xml
│   ├── Trail.xml
│   ├── Voronoi.xml
│   ├── WaveBrickWall.xml
│   ├── WaveDungeon.xml
│   ├── WaveFlowers.xml
│   ├── Wilson.xml
│   └── WolfBasedApproach.xml
├── models.xml
├── resources/
│   ├── palette.xml
│   ├── rules/
│   │   ├── BasicDijkstraRoom.vox
│   │   ├── CarmaTower/
│   │   │   ├── block_1_5x3.vox
│   │   │   ├── block_2_4x3.vox
│   │   │   ├── bracing_h_1.vox
│   │   │   ├── bracing_h_2.vox
│   │   │   ├── bracing_h_3.vox
│   │   │   ├── bracing_v_1.vox
│   │   │   ├── bracing_v_2.vox
│   │   │   ├── bracing_v_3.vox
│   │   │   ├── cut_1.vox
│   │   │   ├── cut_2.vox
│   │   │   ├── holes_2.vox
│   │   │   ├── holes_4.vox
│   │   │   ├── holes_h_4.vox
│   │   │   ├── holes_v_3.vox
│   │   │   ├── roof_3x5.vox
│   │   │   ├── roof_5x9.vox
│   │   │   ├── roof_7x11.vox
│   │   │   ├── roof_7x7.vox
│   │   │   ├── roof_thing_1.vox
│   │   │   ├── roof_thing_2.vox
│   │   │   ├── roof_thing_5x9.vox
│   │   │   ├── roof_thing_7x11.vox
│   │   │   ├── side_11x7.vox
│   │   │   ├── side_13x5.vox
│   │   │   ├── side_3x5.vox
│   │   │   ├── side_3x5_fake.vox
│   │   │   ├── side_5x13.vox
│   │   │   ├── side_5x3.vox
│   │   │   ├── side_5x3_fake.vox
│   │   │   ├── side_7x11.vox
│   │   │   ├── small_windows_2.vox
│   │   │   ├── small_windows_3.vox
│   │   │   ├── window_1.vox
│   │   │   ├── window_2.vox
│   │   │   └── window_3.vox
│   │   ├── DualRetraction/
│   │   │   ├── Room1.vox
│   │   │   └── Room2.vox
│   │   ├── ModernHouse/
│   │   │   ├── Bridge.vox
│   │   │   ├── ColumnBottom.vox
│   │   │   ├── ColumnTop.vox
│   │   │   ├── ContactBottom.vox
│   │   │   ├── ContactTop.vox
│   │   │   ├── Dir.vox
│   │   │   ├── Down.vox
│   │   │   ├── Edge.vox
│   │   │   ├── FrameDir.vox
│   │   │   ├── FrameVertex.vox
│   │   │   ├── GlassColumnBottom.vox
│   │   │   ├── GlassColumnMid.vox
│   │   │   ├── GlassColumnTop.vox
│   │   │   ├── Grass.vox
│   │   │   ├── In.vox
│   │   │   ├── Node.vox
│   │   │   ├── Out.vox
│   │   │   ├── SecondaryDir.vox
│   │   │   ├── SecondaryNode.vox
│   │   │   ├── StyleBottom.vox
│   │   │   ├── StyleTop.vox
│   │   │   ├── TertiaryDir.vox
│   │   │   ├── Up.vox
│   │   │   ├── Wall.vox
│   │   │   ├── WallBottom.vox
│   │   │   ├── WallTop.vox
│   │   │   ├── WindowBottom.vox
│   │   │   ├── WindowMid.vox
│   │   │   ├── WindowTop.vox
│   │   │   ├── WoodBottom.vox
│   │   │   └── WoodTop.vox
│   │   ├── SeaVilla/
│   │   │   ├── BridgeWood.vox
│   │   │   ├── ContactWood.vox
│   │   │   ├── Cross.vox
│   │   │   ├── CrossX.vox
│   │   │   ├── Dir.vox
│   │   │   ├── DrawPier.vox
│   │   │   ├── Edge.vox
│   │   │   ├── Goal.vox
│   │   │   ├── In.vox
│   │   │   ├── KeyK.vox
│   │   │   ├── KeyL.vox
│   │   │   ├── KeyR.vox
│   │   │   ├── Ladder.vox
│   │   │   ├── LadderBottom.vox
│   │   │   ├── LadderTop.vox
│   │   │   ├── Line.vox
│   │   │   ├── LockK.vox
│   │   │   ├── LockL.vox
│   │   │   ├── LockR.vox
│   │   │   ├── Out.vox
│   │   │   ├── OutIn.vox
│   │   │   ├── OutWall.vox
│   │   │   ├── Pier.vox
│   │   │   ├── Room.vox
│   │   │   ├── RoomDouble.vox
│   │   │   ├── RoomIn.vox
│   │   │   ├── RoomOut.vox
│   │   │   ├── RoomWall.vox
│   │   │   ├── StairsBottom.vox
│   │   │   ├── StairsTop.vox
│   │   │   ├── Stone.vox
│   │   │   ├── TopContactWood.vox
│   │   │   ├── TopCross.vox
│   │   │   ├── TopDir.vox
│   │   │   ├── TopEdge.vox
│   │   │   ├── TopIn.vox
│   │   │   ├── TopOut.vox
│   │   │   ├── TopStone.vox
│   │   │   ├── TopWall.vox
│   │   │   ├── Wall.vox
│   │   │   ├── Water.vox
│   │   │   └── WaterWall.vox
│   │   └── Stairs/
│   │       ├── Down.vox
│   │       ├── End.vox
│   │       ├── Line.vox
│   │       ├── Turn.vox
│   │       └── Up.vox
│   ├── settings.xml
│   └── tilesets/
│       ├── Dungeon/
│       │   ├── Door.vox
│       │   ├── Empty.vox
│       │   ├── In.vox
│       │   ├── Line.vox
│       │   ├── Out.vox
│       │   ├── Stone.vox
│       │   ├── T.vox
│       │   ├── Turn.vox
│       │   └── Wall.vox
│       ├── Dungeon.xml
│       ├── Escher/
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Stairs.vox
│       │   ├── Turn.vox
│       │   └── X.vox
│       ├── Escher.xml
│       ├── EscherSurface/
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Stairs.vox
│       │   ├── Turn.vox
│       │   └── X.vox
│       ├── EscherSurface.xml
│       ├── Knots2D/
│       │   ├── Cross.vox
│       │   ├── Empty.vox
│       │   ├── End.vox
│       │   ├── Line.vox
│       │   └── Turn.vox
│       ├── Knots2D.xml
│       ├── Knots3D/
│       │   ├── 3/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   ├── 4/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   ├── 5/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   └── Tubes/
│       │       ├── Empty.vox
│       │       ├── Line.vox
│       │       └── Turn.vox
│       ├── Knots3D.xml
│       ├── MarchingHills/
│       │   ├── Empty.vox
│       │   ├── In.vox
│       │   ├── Out.vox
│       │   ├── Stone.vox
│       │   └── Wall.vox
│       ├── MarchingHills.xml
│       ├── OrientedEscher/
│       │   ├── Cube.vox
│       │   ├── Empty.vox
│       │   ├── Stairs.vox
│       │   ├── T.vox
│       │   └── Turn.vox
│       ├── OrientedEscher.xml
│       ├── OrientedStairs/
│       │   ├── Cube.vox
│       │   ├── Empty.vox
│       │   ├── StairsB.vox
│       │   ├── StairsT.vox
│       │   ├── T1.vox
│       │   ├── T2.vox
│       │   └── Turn.vox
│       ├── OrientedStairs.xml
│       ├── Partition/
│       │   ├── I.vox
│       │   ├── Nothing.vox
│       │   └── T.vox
│       ├── Partition.xml
│       ├── PartitionedEdges/
│       │   ├── 00.vox
│       │   ├── 01.vox
│       │   ├── 10.vox
│       │   ├── 11.vox
│       │   ├── Bridge.vox
│       │   ├── ContactDown.vox
│       │   ├── ContactUp.vox
│       │   ├── Cross.vox
│       │   ├── Down.vox
│       │   ├── Empty.vox
│       │   ├── I.vox
│       │   ├── Line.vox
│       │   ├── Nothing.vox
│       │   ├── T.vox
│       │   ├── Turn.vox
│       │   ├── Up0.vox
│       │   ├── Up1.vox
│       │   ├── X.vox
│       │   └── o.vox
│       ├── PartitionedEdges.xml
│       ├── Paths/
│       │   ├── Down.vox
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Turn.vox
│       │   ├── Up.vox
│       │   └── X.vox
│       ├── Paths.xml
│       ├── Surface/
│       │   ├── Angle.vox
│       │   ├── Concave.vox
│       │   ├── Corner.vox
│       │   ├── Empty.vox
│       │   └── Plane.vox
│       └── Surface.xml
├── source/
│   ├── AllNode.cs
│   ├── ArrayHelper.cs
│   ├── ConvChain.cs
│   ├── Convolution.cs
│   ├── Field.cs
│   ├── GUI.cs
│   ├── Graphics.cs
│   ├── Grid.cs
│   ├── Helper.cs
│   ├── Interpreter.cs
│   ├── Map.cs
│   ├── Node.cs
│   ├── Observation.cs
│   ├── OneNode.cs
│   ├── OverlapModel.cs
│   ├── ParallelNode.cs
│   ├── Path.cs
│   ├── Program.cs
│   ├── Rule.cs
│   ├── RuleNode.cs
│   ├── Search.cs
│   ├── SymmetryHelper.cs
│   ├── TileModel.cs
│   ├── VoxHelper.cs
│   ├── WaveFunctionCollapse.cs
│   └── XMLHelper.cs
└── syntax.md

================================================
FILE CONTENTS
================================================

================================================
FILE: .github/FUNDING.yml
================================================
github: [mxgmn]


================================================
FILE: .gitignore
================================================
.idea/
.vscode/
.vs/

bin/
obj/
doc/

*.user

output/
source/old/


================================================
FILE: CITATION.cff
================================================
cff-version: 1.1.0
message: "citation"
authors:
  - family-names: Gumin
    given-names: Maxim
title: MarkovJunior, a probabilistic programming language based on pattern matching and constraint propagation
version: 1.0
date-released: 2022-06-01
keywords:
  - probabilistic programming
  - procedural generation
  - constraint satisfaction
  - language
url: https://github.com/mxgmn/MarkovJunior


================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2022 Maxim Gumin

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: MarkovJunior.csproj
================================================
<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <OutputPath>bin\</OutputPath>
    <AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
    <AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="SixLabors.ImageSharp" Version="3.1.12" />
  </ItemGroup>

  <ItemGroup>
    <None Include="models\*">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="resources\**\*">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Include="models.xml">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>


================================================
FILE: README.md
================================================
# MarkovJunior
MarkovJunior is a probabilistic programming language where programs are combinations of rewrite rules and inference is performed via constraint propagation. MarkovJunior is named after mathematician [Andrey Andreyevich Markov](https://en.wikipedia.org/wiki/Andrey_Markov,_Jr.), who defined and studied what is now called [Markov algorithms](https://en.wikipedia.org/wiki/Markov_algorithm).
<p align="center">
<img src="images/top-iso.gif"/>
<img src="images/top-mv.gif"/>
</p>

In its basic form, a MarkovJunior program is an ordered list of rewrite rules. For example, [MazeBacktracker](models/MazeBacktracker.xml) (animation on the left below) is a list of 2 rewrite rules:
1. `RBB=GGR` or "replace red-black-black with green-green-red".
2. `RGG=WWR` or "replace red-green-green with white-white-red".

On each execution step MJ interpreter finds the first rule in the list that has a match on the grid, finds all matches for that rule and applies that rule for a random match. In the [maze backtracker](https://en.wikipedia.org/wiki/Maze_generation_algorithm#Depth-first_search) example, interpreter first applies a bunch of `RBB=GGR` rules. But eventually the green self-avoiding walk gets stuck. At this point the first rule has no matches, so interpreter applies the second rule `RGG=WWR` until the walk gets unstuck. Then it can apply the first rule again, and so on. Interpreter stops when there are no matches for any rule.
<p align="center">
<img src="images/MazeBacktracker.gif"/>
<img src="images/multisokoban.gif"/>
</p>

Probabilistic inference in MarkovJunior allows to impose constraints on the future state, and generate only those runs that lead to the constrained future. For example, inference in Sokoban rules `{RWB=BRW RB=BR}` makes a group of (red) agents organize (white) crates into specified shapes.

Using these ideas, we construct [many probabilistic generators](models/) of dungeons, architecture, puzzles and fun simulations.
<p align="center"><a href="images/top-1764.png"/><img src="images/top-882.png"/></a></p>

Additional materials:
1. [Xml syntax overview](syntax.md).
2. Higher resolution screenshots and more seeds: [ModernHouse](https://github.com/mxgmn/Blog/blob/master/ModernHouse.md), [SeaVilla](https://github.com/mxgmn/Blog/blob/master/SeaVilla.md), [Apartemazements](https://github.com/mxgmn/Blog/blob/master/Apartemazements.md), [CarmaTower](https://github.com/mxgmn/Blog/blob/master/CarmaTower.md), [Escheresque](https://github.com/mxgmn/Blog/blob/master/Escheresque.md), [PillarsOfEternity](https://github.com/mxgmn/Blog/blob/master/PillarsOfEternity.md), [Surface](https://github.com/mxgmn/Blog/blob/master/RandomSurface.md), [Knots](https://twitter.com/ExUtumno/status/895688856304992256).
3. Unofficial [technical notes](https://gist.github.com/dogles/a926ab890552cc7e45400a930398449d) by Dan Ogles and [code documentation](https://github.com/kaya3/MarkovJunior-docs) by Andrew Kay.



## Markov algorithms
A Markov algorithm over an alphabet `A` is an ordered list of rules. Each rule is a string of the form `x=y`, where `x` and `y` are words in `A`, and some rules may be marked as halt rules. Application of a Markov algorithm to a word `w` proceeds as follows:
1. Find the first rule `x=y` where `x` is a substring of `w`. If there are no such rules, then halt.
2. Replace the leftmost `x` in `w` by `y`.
3. If the found rule was a halt rule, then halt. Otherwise, go to step 1.

For example, consider this Markov algorithm in the alphabet `{0, 1, x}` (ε is the empty word):
```
1=0x
x0=0xx
0=ε
```
If we apply it to the string `110` we get this sequence of strings:
```
110 -> 0x10 -> 0x0x0 -> 00xxx0 -> 00xx0xx -> 00x0xxxx -> 000xxxxxx -> 00xxxxxx -> 0xxxxxx -> xxxxxx
```
In general, this algorithm converts a binary representation of a number into its unary representation.

Markov's student [Vilnis Detlovs](https://lv.wikipedia.org/wiki/Vilnis_Detlovs) [proved](http://www.mathnet.ru/php/archive.phtml?wshow=paper&jrnid=tm&paperid=1293) that for any Turing machine there exists a Markov algorithm that computes the same function. In comparison, grammars are unordered sets of rewrite rules and L-systems are rewrite rules that are applied in parallel. For more interesting examples of Markov algorithms check [Markov's book](http://www.mathnet.ru/links/1543dd6e347b444e6f3e108fafaf9f2a/tm1178.pdf) or see the greatest common divisor example in the [comment section](#comments) or [multiplication example](https://en.wikipedia.org/wiki/Markov_algorithm#Description) on Wikipedia.

How would one generalize Markov algorithms to multiple dimensions? First, in multiple dimensions there are no natural ways to insert a string into another string, so the lefts and rights of our rewrite rules should have the same size. Second, there are no natural ways to choose *the leftmost* match. Possible options are:
* Choose a random match. This is what MJ's `(exists)` nodes do.
* Choose all matches. There is a problem with this option however because different matches can overlap and have conflicts. Possible solutions are:
	* Greedily choose a maximal subset of non-conflicting matches. This is what MJ's `{forall}` nodes do.
	* Consider all matches in superposition. That is, instead of separate values, keep waves in each grid cell - boolean vectors that tell which spacetime patterns are forbidden and which are not. And this is how MJ performs inference.

We lose Turing completeness because our new procedure is not deterministic, but practice shows that this formalism still allows to describe a huge range of interesting random processes.



## Rewrite rules
The simplest MarkovJunior program is probably `(B=W)`. It contains just a single rule `B=W`. On each turn, this program converts a random black square into a white square.
<p align="center">
<a href="models/Basic.xml"><img src="images/Basic.gif"/></a>
<a href="models/Growth.xml"><img src="images/Growth.gif"/></a>
<a href="models/MazeGrowth.xml"><img src="images/MazeGrowth.gif"/></a>
<a href="models/MazeGrowth.xml"><img src="images/MazeGrowth.png"/></a><br/>
(B=W) | (WB=WW) | (WBB=WAW) | (WBB=WAW)
</p>

[Growth](models/Growth.xml) model `(WB=WW)` is more interesting. On each turn it replaces a black-white pair of adjacent cells `BW` with a white-white pair `WW`. In other words, on each turn it picks a random black cell adjacent to some white cell and color it into white. This model is almost identical to the [Eden growth model](http://digitalassets.lib.berkeley.edu/math/ucb/text/math_s4_v4_article-15.pdf): on each turn both models choose among the same set of black cells. They differ only in probability distributions: a uniform distribution over black cells adjacent to white cells is not the same as a uniform distribution over pairs of adjacent black and white cells.

Model `(WBB=WAW)` generates a maze, with a single line of code! Compare it with an [implementation](https://bl.ocks.org/mbostock/70a28267db0354261476) in a conventional language. Any MarkovJunior model can be run in any number of dimensions without changes. On the right you can see the end result of [MazeGrowth](models/MazeGrowth.xml) in 3d, rendered in [MagicaVoxel](https://ephtracy.github.io/). By default, we use [PICO-8 palette](resources/palette.xml):
<p align="center"><img src="images/palette.png"/></p>

Model `(RBB=WWR)` is a [self-avoiding random walk](https://en.wikipedia.org/wiki/Self-avoiding_walk). Note that self-avoiding walks in 3d are longer on average than in 2d. In general, comparing the behaviors of similar random processes in different dimensions is a fascinating topic. A [classic result](https://sites.math.washington.edu/~morrow/336_19/papers19/Legrand.pdf) of George Pólya says that a random walk in 2d returns to its initial position with probability one, while in 3d this is no longer the case.
<p align="center">
<a href="models/RegularSAW.xml"><img src="images/RegularSAW.gif"/></a>
<a href="models/LoopErasedWalk.xml"><img src="images/LoopErasedWalk.gif"/></a>
<a href="models/Trail.xml"><img src="images/Trail.gif"/></a><br/>
(RBB=WWR) | LoopErasedWalk | (RB=WR RW=WR)
</p>

We can put several rules into one **rulenode**. For example, `(RBB=WWR RBW=GWP PWG=PBU UWW=BBU UWP=BBR)` is a [loop-erased random walk](https://en.wikipedia.org/wiki/Loop-erased_random_walk). Trail model `(RB=WR RW=WR)` generates [decent connected caves](https://blog.jrheard.com/procedural-dungeon-generation-drunkards-walk-in-clojurescript).

Model `(RBB=WWR R*W=W*R)` is known as the [Aldous-Broder maze generation algorithm](http://weblog.jamisbuck.org/2011/1/17/maze-generation-aldous-broder-algorithm). The **wildcard** symbol `*` in the input means that *any* color is allowed to be in the square. The wildcard symbol in the output means that the color doesn't change after the application of the rule. Aldous-Broder algorithm takes much more turns on average to generate a maze than MazeGrowth, for example, but it has a nice property that MazeGrowth doesn't have: each maze has the same probability to be generated. In other words, MazeTrail is an unbiased maze generation algorithm, or it samples mazes (or spanning trees) with the uniform distribution. [Wilson's algorithm](http://web.stanford.edu/~yuvalwig/math/teaching/UniformSpanningTrees.pdf) is a more efficient unbiased maze generation algorithm. Compare its [MarkovJunior](images/Wilson.gif) [implementation](models/Wilson.xml) with an [implementation](https://bl.ocks.org/mbostock/11357811) in a conventional language!



## Combining rulenodes
We can put several rulenodes into a **sequence node**, to be run one after the other. In the [River](models/River.xml) model we first construct a stochastic [Voronoi](models/Voronoi.xml) diagram with 2 sources, and use the boundary between the formed regions as a base for a river. Then we spawn a couple more Voronoi seeds to grow forests and simultaneously grow grass from the river. As a result, we get random river valleys!
<p align="center">
<a href="models/River.xml"><img src="images/River.gif"/></a>
<a href="models/Apartemazements.xml"><img src="images/Apartemazements.gif"/></a>
</p>

In [Apartemazements](models/Apartemazements.xml) we start with a WFC node and then do constructive postprocessing with rulenodes:
1. Prepare constraints: mark bottom cells with a separate bottom color, mark the remaining border cells (sides and top) with a separate border color. Border cells should map to Empty, bottom cells should map to all tiles except Down.
2. Run WFC [Paths](resources/tilesets/Paths.xml) tileset to generate closed stairy cycles.
3. Randomize light sources.
4. Drop columns from corners of flat tiles.
5. Retract double columns, columns that touch ground and columns that touch stairs, except columns growing from corners of the Turn tiles.
6. Grow windows between neighboring columns.
7. Merge windows into bigger rectangles. We do this in several steps:
	1. Detect uneven patterns of windows when window corners touch window midpoints.
	2. Mark these patterns and propagate the markings through the whole lengths of window sides.
	3. Merge unmarked pairs of window sides.
8. Turn the remaining 1x1 windows into walls.

A more interesting way to combine nodes is to put them into a **Markov node**. Markov nodes substantially expand what we can do, because they allow to return to past nodes. When a Markov node is active, interpreter finds its first child node that matches and applies it. On the next turn, it finds the first matching node in the list again, and so on. The simplest example of the Markov node use is [MazeBacktracker](models/MazeBacktracker.xml) explained in the top section.

<p align="center">
<a href="models/NystromDungeon.xml"><img src="images/NystromDungeon.gif"/></a>
<a href="models/Flowers.xml"><img src="images/Flowers.gif"/></a>
</p>

One of my favorite examples that motivated the development of MarkovJunior is [Bob Nystrom's dungeon generation algorithm](https://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/). It goes as follows:
1. Draw a grid `{PBB=**P}`.
2. Spawn a bunch of rooms `(room.png)`.
3. Generate a maze on the rest of the grid. We can use any maze generation algorithm, but [MazeBacktracker](models/MazeBacktracker.xml) is preferred because it produces fewer branching points.
4. Make the resulting configuration of rooms and corridors connected. This can be elegantly done with a Markov node `({GWW=**G}(GBW=*WG))`.
5. Make some additional connections `(GBG=*W* #5)`, so the resulting dungeon has cycles. Dungeons without cycles are pretty boring, since the player has to return through already explored zones.
6. Retract dead ends `{BBB/BWB=BBB/BBB}`.

<p align="center">
<a href="models/Circuit.xml"><img src="images/Circuit.gif"/></a>
<a href="models/DungeonGrowth.xml"><img src="images/DungeonGrowth.gif"/></a>
</p>

Like in REFAL, Markov nodes can be nested: once we go into a child node, we ignore outer nodes until the child branch completes.



## Inference
Probabilistic inference in MarkovJunior allows to impose constraints on the future state, and generate only those runs that lead to the constrained future. In other words, inference connects 2 given states (or partially observed states) with a chain of rewrite rules.

The simplest example of inference use is connecting 2 points with a path. In the self-avoiding walk model `(RBB=WWR)` we can **observe** a given square on the grid to become `R` red. Then the interpreter would generate only those walks that lead to the observed square. We can set the interpreter to follow the goal more strictly or less strictly by varying the **temperature** parameter. By default, temperature is set to zero.
<p align="center">
<img src="images/coldest.gif"/>
<img src="images/cold.gif"/>
<img src="images/hot.gif"/>
<img src="images/hottest.gif"/><br>
Coldest | Cold | Hot | Hottest
</p>

Another thing we can do is to observe *all* odd grid squares becoming white or red. Then the interpreter would generate self-avoiding walks that cover the entire grid.
<p align="center">
<a href="models/CompleteSAW.xml"><img src="images/CompleteSAW.gif"/></a>
<a href="models/SokobanLevel1.xml"><img src="images/SokobanLevel1.gif"/></a>
</p>

We can engage inference for any rewrite rules. For example, inference for [stair-drawing rules](models/StairsPath.xml) connects 2 points with a stairy path. Inference for rule `R**/**B=B**/**R` generates paths that a chess knight can take. Inference in the [CrossCountry](models/CrossCountry.xml) model connects 2 points with a path taking terrain costs into account. Inference for the Sokoban ruleset `{RB=BR RWB=BRW}` solves Sokoban puzzles or even [multiagent Sokoban puzzles](images/multisokoban.gif)!
<p align="center"><img src="images/StairsPath.gif"/></a></p>

Inference in MarkovJunior is done via unidirectional (fast) or bidirectional (slow, but more powerful) constraint propagation. Unidirectional constraint propagation for rewrite rules can be described equivalently in terms of **rule propagation** fields which generalize Dijkstra fields for arbitrary rewrite rules. Dijkstra fields is a popular technique in grid-based procedural generation ([1](https://groups.google.com/forum/#!topic/rec.games.roguelike.development/6yNIuhSerpM), [2](http://www.roguebasin.com/index.php?title=The_Incredible_Power_of_Dijkstra_Maps), [3](http://www.roguebasin.com/index.php?title=Dijkstra_Maps_Visualized)). They in turn generalize [distance fields](https://iquilezles.org/www/articles/distfunctions/distfunctions.htm) used in computer graphics.

If constraint propagation completes it doesn't necessarily mean that the goal state is achievable. But if the propagation fails then we know for sure that the goal is not achievable. This allows to catch states where a crate is pushed to the wrong wall in Sokoban, or where the grid-covering walk splits the grid into 2 disconnected parts. In addition to this boolean heuristic, it's worth looking at the minimal number of turns required for constraint propagation to complete. This integer-valued heuristic is [admissible](https://en.wikipedia.org/wiki/Admissible_heuristic), and we use it in A\* search to sample paths made of rewrite rules between 2 given states.



## Open problems
1. **Program synthesis for procedural generation**. William Chyr's talk ["Level Design in Impossible Geometry"](https://youtu.be/ed2zmmcEryw?t=1298) is not at all about procedural generation, yet I find [one slide](images/ps-for-procgen.jpg) to be very characteristic for pcg practice. William compares his earlier and later approaches to level design. The earlier one produced chaotic levels, while the later approach produced more structured, more intentional levels based on one central idea. Later levels weren't simpler, yet they were more memorable and easier for players to perceive. To me, the left level looks like it was generated procedurally! It has a very similar feel to my [procedural voxel puzzles](https://twitter.com/ExUtumno/status/971031987304763393). Can we make generators that produce levels that are more like the one on the right? This problem may seem AI-complete. But I'd argue it is very similar to classic genetic programming problems like [Koza's lawnmower problem](https://pdfs.semanticscholar.org/555e/13cc2dd246e3d63ceb00590605f3ff59593d.pdf). For example, take a simple procgen task of [generating Hamiltonian paths on the grid](models/CompleteSAW.xml). Even for small grid sizes like 29x29 this task is already computationally demanding. But do we really need to sample from all possible paths in practice? If we give this task to a human, they would probably draw a spiral or a zigzag curve - these are much more memorable and intentional designs than a random Hamiltonian path, plus they generalize to any grid sizes. To summarize, we can ask the system either to find a random Hamiltonian path or to find a short program that generates Hamiltonian paths. In the first case the result would look like the left level on the slide, and in the second case like the right level. Solving the latter program synthesis problem would create more memorable and intentional generators.
2. **Model synthesis from examples**. Markov algorithms seem to be a perfect environment for program/model synthesis: no variables, ifs or whiles, nodes can be easily moved around without breaking correctness, models are easy to make differentiable. Random MJ programs are often fun and can produce human-relatable results and behaviors.
	1. Can we synthesize a MJ model from a result, or a set of results?
	2. Given a maze, is it possible to determine (or assign probabilities) whether it was generated by [MazeGrowth](models/MazeGrowth.xml) or [MazeBacktracker](models/MazeBacktracker.xml)?
	3. Solve the [Abstraction and Reasoning Challenge](https://www.kaggle.com/c/abstraction-and-reasoning-challenge) by inferring MarkovJunior models. Adjoint problem: use insights from the ARC challenge to build a better DSL for procedural generation on a grid.
3. **Custom algorithms that run in the wave space**. To unite the advantages of constructive and constrained-based procedural generation. Related: custom algorithms (MJ rewrite rules) with custom energy functions like Ising energy or ConvChain energy.
4. Generalize the notion of a pattern.
5. Investigate MJ-like processes on other (possibly nonregular) grids or arbitrary graphs.
6. Experiment with interactive extensions of Markov algorithms. It's possible to turn any MJ model into a game by assigning specific rewrite rules or nodes to key presses.
7. Push the state of the art in grid-based procedural generation. [ModernHouse](https://twitter.com/ExUtumno/status/1141354217774428160) does not yet reach the structural variety of human-designed houses like [Sims 2 houses](https://www.thesimsresource.com/downloads/browse/category/sims2-lots/featured/1/search/modern%20house/). Use more subtle constraints.



## Comments
Compared to Turing machines and lambda calculus, Markov algorithms is probably the shortest and simplest way to rigorously define what an algorithm is.

Exercise: prove that the following Markov algorithm finds the greatest common divisor of 2 numbers written in a unary representation. For example, if we apply it to `111111*1111111111` we get `11`.
```
1a=a1
1*1=a*
1*=*b
b=1
a=c
c=1
*=ε (halt)
```

Fast pattern matching. MarkovJunior interpreter samples matches uniformly, but it doesn't scan the whole grid every turn. To keep pattern matching fast, the interpreter remembers previously found matches and searches only around the places that got changed. When a rulenode is encountered for the first time, MJ interpreter uses a multidimensional version of the [Boyer–Moore algorithm](https://en.wikipedia.org/wiki/Boyer%E2%80%93Moore_string-search_algorithm).

Stochastic relaxation. Markov nodes have a very nice representations as limits of differentiable nodes. Consider an unordered set of rewrite rules where each rule `r` is assigned a weight `w(r)`. On each step the interpreter finds all matches for all rules and chooses a random match according to the Boltzmann distribution `p(r) ~ exp(-w(r)/t)`. Then in the freezing limit `t->0` we get a Markov node, ordered by weights. What's good about this construction, is that for any `t>0` and for a typical score function, score's average on multiple runs would be a continuous (and smooth for practical purposes) function of weights. This means that one can find the optimal weights by gradient descent and then freeze the system to get the final discrete program.

Read this [essay](https://www.jstor.org/stable/27641983) by [Boris Kushner](https://en.wikipedia.org/wiki/Boris_Kushner_(mathematician)) about A. A. Markov and his work in constructive mathematics.



## Used work
Main used work:
1. Andrey A. Markov, [The Theory of Algorithms](http://www.mathnet.ru/php/archive.phtml?wshow=paper&jrnid=tm&paperid=1117&option_lang=eng), 1951. Markov used these ideas earlier in 1947 in his proof of the algorithmic undecidability of the word problem in semigroups. See also a later [book](http://www.mathnet.ru/php/archive.phtml?wshow=paper&jrnid=tm&paperid=1178&option_lang=eng) with a more detailed treatment. I would be grateful for links to English translations in open access.
2. Guilherme S. Tows, [Imagegram](https://zaratustra.itch.io/imagegram), 2009. MarkovJunior takes forall-nodes from Imagegram.
3. Valentin Turchin, [REFAL language](http://fprog.ru/2011/issue7/practice-fp-7-screen.pdf), 1968. MJ takes the idea of nested Markov nodes from REFAL.
4. Brian Walker et al., [The incredible power of Dijkstra maps](https://groups.google.com/forum/#!topic/rec.games.roguelike.development/6yNIuhSerpM), 2010. A discussion in the the roguelike community that contains many techniques of using Dijkstra maps/distance fields for procedural generation and NPC AI. Later writeups: [1](http://www.roguebasin.com/index.php?title=The_Incredible_Power_of_Dijkstra_Maps), [2](http://www.roguebasin.com/index.php?title=Dijkstra_Maps_Visualized). We generalize Dijkstra maps to arbitrary rewrite rules.
5. Pavlos S. Efraimidis, Paul Spirakis, [Weighted Random Sampling](https://utopia.duth.gr/~pefraimi/research/data/2007EncOfAlg.pdf), 2005.
6. Work used in custom nodes: [Model Synthesis](http://graphics.stanford.edu/~pmerrell/thesis.pdf), [Wave Function Collapse Algorithm](https://github.com/mxgmn/WaveFunctionCollapse), [ConvChain Algorithm](https://github.com/mxgmn/ConvChain).
7. Classic algorithms: [constraint propagation](https://en.wikipedia.org/wiki/Local_consistency), [constraint solving algorithms](https://www.cs.ubc.ca/~mack/Publications/AI77.pdf), [graph traversal](https://en.wikipedia.org/wiki/Graph_traversal), [A* search](https://www.cs.auckland.ac.nz/courses/compsci709s2c/resources/Mike.d/astarNilsson.pdf).

Related work:
1. Daniel Ritchie, [Probabilistic Programming for Procedural Modeling and Design](https://dritchie.github.io/pdf/thesis.pdf), 2016.
2. Lingfeng Yang, [From Execution Traces to Specialized Inference](https://stacks.stanford.edu/file/druid:kq822ym0815/et2si-reduced-opt-augmented.pdf), 2015.

Sources of examples:
1. [BasicKeys](models/BasicKeys.xml) and [Keys](models/Keys.xml) are adaptations of graph grammars formulated by Joris Dormans, [Engineering Emergence: Applied Theory for Game Design](https://www.illc.uva.nl/Research/Publications/Dissertations/DS-2012-12.text.pdf), 2012. Which in turn are development of the earlier work by David Adams, [Automatic Generation of Dungeons for Computer Games](https://pdfs.semanticscholar.org/2502/0f8d955aee07b7dd49a3ec23b1f2a8cf1d06.pdf), 2002. I use a variation of these models to generate key-lock-bridge puzzles in [SeaVilla](models/SeaVilla.xml).
1. [CarmaTower](models/CarmaTower.xml) is a proceduralization of a [voxel scene](https://twitter.com/Sir_carma/status/851883489628704768) by Antoine Lendrevie.
1. The [NystromDungeon](models/NystromDungeon.xml) model is a MarkovJunior port of [Bob Nystrom's dungeon generator](https://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/).
1. [HamiltonianPath](models/HamiltonianPath.xml) algorithm is adapted from [this](http://aip.scitation.org/doi/pdf/10.1063/1.443937) article. Compare it with an [implementation](http://clisby.net/projects/hamiltonian_path/hamiltonian_path_v1.html) in a conventional language.
1. Room shapes in [DungeonGrowth](models/DungeonGrowth.xml) are taken from the [r/proceduralgeneration post](https://old.reddit.com/r/proceduralgeneration/comments/3pa8a1/my_take_at_a_roguelike_level_generator_ft/). Note that MJ interpreter automatically performs the optimizations described in the post.
1. The [Wilson](models/Wilson.xml) model is a rewrite rule formulation of the [Wilson's algorithm](https://en.wikipedia.org/wiki/Loop-erased_random_walk#Uniform_spanning_tree). Compare it with an [implementation](https://bl.ocks.org/mbostock/11357811) in a conventional language.
1. [MazeGrowth](models/MazeGrowth.xml) model is also known as maze generation via random traversal. Compare it with an [implementation](https://bl.ocks.org/mbostock/70a28267db0354261476) in a conventional language.
1. [Growth](models/Growth.xml) is closely related to the [Eden growth model](http://digitalassets.lib.berkeley.edu/math/ucb/text/math_s4_v4_article-15.pdf).
1. [BernoulliPercolation](models/BernoulliPercolation.xml) is a well studied model in a [percolation theory](https://en.wikipedia.org/wiki/Percolation_theory).
1. [NestedGrowth](models/NestedGrowth.xml) is taken from [Imagegram](https://zaratustra.itch.io/imagegram).
1. [SmoothTrail](models/SmoothTrail.xml) is adapted from [128_mhz's tweet](https://twitter.com/128_mhz/status/953847394403205120).
1. [SokobanLevel1](models/SokobanLevel1.xml) seems to be the first level from Hiroyuki Imabayashi's Sokoban puzzle. [SokobanLevel2](models/SokobanLevel2.xml) is the [level 452](https://www.sokobanonline.com/play/web-archive/razorflame/ionic-catalysts-xi/58022_ionic-catalysts-xi-452) from Ionic Catalysts XI set.
1. [RainbowGrowth](models/RainbowGrowth.xml) was [proposed](https://github.com/mxgmn/MarkovJunior/discussions/25) by [mure](https://github.com/mure).
1. [MultiHeadedWalk](models/MultiHeadedWalk.xml), [MultiHeadedDungeon](models/MultiHeadedDungeon.xml) and [MultiHeadedWalkDungeon](models/MultiHeadedWalkDungeon.xml) are [based](https://github.com/mxgmn/MarkovJunior/discussions/38) on the idea by [Ilya Kudritsky](https://github.com/Inferdy).
1. [Island](models/Island.xml) model is by [Guillaume Fiette](https://github.com/woldendans/MJ-simple-island).
1. [LostCity](models/LostCity.xml), [Forest](models/Forest.xml) and [Texture](models/Texture.xml) models are based on the model by [Andrew Kay](https://github.com/kaya3/pattern-match-2d).
1. [Division](models/Division.xml) and [Rosettes](models/Rosettes.xml) models were developed by [scorpion451](https://github.com/scorpion451).

Voxel scenes were rendered in [MagicaVoxel](https://ephtracy.github.io/) by [ephtracy](https://github.com/ephtracy). Special thanks to [Brian Bucklew](https://github.com/unormal) for demonstrating the power of Dijkstra fields to me in roguelike level generation and [Kevin Chapelier](https://github.com/kchapelier) for a number of good suggestions. The font used in GUI is [Tamzen](https://github.com/sunaku/tamzen-font).



## How to build
MarkovJunior interpreter is a console application that depends only on the standard library. Get [.NET Core](https://dotnet.microsoft.com/download) for Windows, Linux or macOS and run
```
dotnet run --configuration Release MarkovJunior.csproj
```
To build the application without running it, run
```
dotnet publish --configuration Release MarkovJunior.csproj
```
After this, a self-contained app will appear in the `bin/publish` folder. Run `MarkovJunior.exe`, and it will put all the generated artifacts in the `output` folder.

Alternatively, download and run the latest [release](https://github.com/mxgmn/MarkovJunior/releases) for Windows.

Generated results are put into the `output` folder. Edit `models.xml` to change model parameters. Open `.vox` files with [MagicaVoxel](https://ephtracy.github.io/).



## Notable ports, forks and spinoffs
* Yuu made a [TypeScript version of MarkovJunior](https://github.com/Yuu6883/MarkovJuniorWeb) that [runs on the web](https://yuu6883.github.io/MarkovJuniorWeb/), extended the language and added the ability to bind nodes to keypresses.
* Aseaday is [porting](https://github.com/aseaday/MarkovJunior.js) MarkovJunior to JavaScript.
* Andrew Kay added [XML documentation](https://github.com/kaya3/MarkovJunior-docs) to C# source code.
* [Dan Ogles](https://github.com/dogles) wrote MarkovJunior [technical notes](https://gist.github.com/dogles/a926ab890552cc7e45400a930398449d) with the focus on fields and inference.
* Andrew Kay designed [MJr](https://github.com/kaya3/MJr), a compiled language based on pattern rewriting.
* Ashley is writing a [Rust implementation of MarkovJunior](https://github.com/expenses/markov) as a Python library.
* LMCuber [is porting](https://github.com/LMCuber/PyMarkovJunior) MarkovJunior to Python.
* William Manning developed a [Julia implementation](https://github.com/heyx3/MarkovJunior.jl) of MarkovJunior that runs in any number of space dimensions.



## Funding
MarkovJunior development was [funded](https://github.com/users/mxgmn/sponsorship) by
1. **[Embark Studios](https://www.embark-studios.com/)**
2. [Oskar Stålberg](https://twitter.com/OskSta)
3. [Freehold Games](https://store.steampowered.com/app/333640/Caves_of_Qud/)
4. [Bob Burrough](https://bobburrough.com/)


================================================
FILE: models/Apartemazements.xml
================================================
<sequence values="BWN" symmetry="(xy)">
  <prl in="B" out="W"/>
  <prl in="***/***/*** ***/*W*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <prl in="B W" out="B N"/>
  <wfc values="BYDAWP RFUENC" tileset="Paths">
    <rule in="W" out="Empty"/>
    <rule in="N" out="Empty|Line|Up|Turn|X"/>

    <prl in="B" out="C" comment="draw earth"/>
    <prl in="C * *" out="B * *" comment="remove extra earth"/>
    <prl in="C C" out="E N" comment="draw grass"/>
    <prl in="C" out="N"/>
    <prl in="Y" out="C" p="0.25" steps="1"/>
    <prl in="Y" out="B"/>

    <all comment="draw columns">
      <rule in="D B" out="* F"/>
      <rule in="F B" out="* F"/>
    </all>
    <all comment="remove extra columns">
      <rule in="FF EE" out="BB EE"/>
      <rule in="FF FD EE" out="FF BD EE"/>
      <rule in="F B" out="B B"/>
      <rule in="B F" out="B B"/>
      <rule in="F P" out="B P"/>
      <rule in="P* *F" out="** *B"/>
    </all>
    <all comment="draw corner columns">
      <rule in="*A*/ADB/*B* ***/*B*/***" out="***/***/*** ***/*F*/***"/>
      <rule in="F B" out="F F"/>
    </all>
    <all comment="place windows">
      <rule in="FBBBF *AAA*" out="*RRR* *****"/>
      <rule in="FBBBF *RRR*" out="*RRR* *****"/>
    </all>
    <prl comment="find h-uneven windows">
      <rule in="RFFR RFDA" out="U**U U***"/>
      <rule in="RFDA RFFR" out="U*** U**U"/>
    </prl>
    <all comment="mark h-uneven windows">
      <rule in="R U" out="U *"/>
      <rule in="U R" out="* U"/>
    </all>
    <prl in="RFFR/BBBB" out="*RR*/****" comment="merge h-even windows"/>
    <prl in="U" out="R" comment="erase markings"/>
    <prl comment="find v-uneven windows">
      <rule in="RR DA FR" out="UU ** *U"/>
      <rule in="FR DA RR" out="*U ** UU"/>
    </prl>
    <all comment="mark v-uneven windows">
      <rule in="RU" out="U*"/>
      <rule in="UR" out="*U"/>
    </all>
    <prl comment="merge v-even windows">
      <rule in="RB AB RB" out="RB RB RB"/>
      <rule in="RB DB RB" out="RB RB RB"/>
    </prl>
    <prl comment="forget structure">
      <rule in="F" out="A"/>
      <rule in="D" out="A"/>
      <rule in="P" out="A"/>
      <rule in="U" out="R"/>
    </prl>
    <prl in="AAAAA ARRRA ARRRA ARRRA ARRRA AAAAA" out="AAAAA AAAAA AAAAA AAAAA AAAAA AAAAA"/>
  </wfc>
</sequence>

<!--
Some rendered outputs: https://github.com/mxgmn/Blog/blob/master/Apartemazements.md
-->


================================================
FILE: models/Backtracker.xml
================================================
<markov values="BRWU" origin="True">
  <one in="RB" out="WR"/>
  <one in="RW" out="UR"/>
</markov>

<!--
Generates connected cave systems with pools.
-->


================================================
FILE: models/BacktrackerCycle.xml
================================================
<sequence values="BRGWA" origin="True">
  <union symbol="?" values="WA"/>
  <markov>
    <one in="RBB" out="GGR"/>
    <one in="RGG" out="WAR"/>
  </markov>
  <one in="R" out="W"/>
  <one in="WBW" out="WAW" steps="1"/>
  <all in="BBB/B?B" out="***/*B*"/>
  <all in="A" out="W"/>
</sequence>

<!--
Generates a random cycle.
-->


================================================
FILE: models/Basic.xml
================================================
<one values="BW" in="B" out="W"/>


================================================
FILE: models/BasicBrickWall.xml
================================================
<sequence values="BWO" symmetry="(x)">
  <all in="B/*" out="O/*"/>
  <all in="O/*/*" out="W/*/*"/>
  <markov>
    <all in="BW" out="BB"/>
    <one in="W/W/W/W/W/W/W/W" out="*/*/*/B/*/*/*/*"/>
  </markov>
  <one in="OOOOOOOO/BBBBBBBB" out="***B****/********"/>
  <markov>
    <all in="OW" out="*O" symmetry="(xy)"/>
    <all in="OO/OB" out="*B/**"/>
    <one in="OOOO/BBBB/OOOO" out="**B*/****/****"/>
    <one in="WW/BB/OB" out="*O/**/**"/>
  </markov>
</sequence>

<!--
To make BrickWall, add texture and shading.
-->


================================================
FILE: models/BasicDijkstraDungeon.xml
================================================
<sequence values="BGW">
  <one file="BasicDijkstraRoom" legend="BW" steps="1"/>
  <all in="W" out="G"/>
  <markov>
    <all in="GW" out="GG"/>
    <path from="W" to="G" on="B" color="G" inertia="True"/>
    <one file="BasicDijkstraRoom" legend="BW"/>
  </markov>
</sequence>


================================================
FILE: models/BasicDijkstraFill.xml
================================================
<sequence values="BWG">
  <all file="BasicDijkstraRoom" legend="BW"/>
  <markov>
    <all in="GW" out="GG"/>
    <path from="G" to="W" on="B" color="G" inertia="True"/>
    <one in="W" out="G"/>
  </markov>
</sequence>


================================================
FILE: models/BasicDungeonGrowth.xml
================================================
<sequence values="BRACDG" origin="True">
  <union symbol="?" values="BR"/>
  <one in="**?**/*BBB*/*BBB?/*BBB*/**R**" out="AARAA/ADDDA/ADDDR/ADDDA/AACAA"/>
  <one in="ACA/BBB" out="ARA/BBB"/>
  <all>
    <rule in="C" out="D"/>
    <rule in="R" out="D"/>
  </all>
  <all in="BD" out="*A"/>
  <all in="DDD/ADA/DDD" out="***/D*D/***"/>
  <all in="DDD/DAD/DDD" out="***/*D*/***"/>
</sequence>


================================================
FILE: models/BasicKeys.xml
================================================
<sequence values="BDIRGYNOKPFCU" origin="True">
  <all in="DB*" out="*ID" comment="draw a grid"/>
  <one in="D" out="G" limit="1" comment="put an end"/>
  <one comment="put a start far from the end">
    <rule in="D" out="R" limit="1"/>
    <field for="R" from="G" on="RID"/>
  </one>
  <one in="RID" out="*NO" limit="1"/>
  <one temperature="2.0" comment="draw a non-optimal path from start to end">
    <rule in="OID" out="YNO"/>
    <rule in="OIG" out="YNG"/>
    <field for="O" to="G" on="GIDO"/>
  </one>
  <one in="RNY" out="KFR" limit="1"/>
  <markov>
    <one in="UID" out="CCU"/>
    <one in="RID" out="OCU"/>
    <one>
      <rule in="RNY" out="FFR"/>
      <rule in="ONY" out="FPR"/>
      <rule in="RNG" out="FFG"/>
      <rule in="ONG" out="FPG"/>
    </one>
  </markov>
  <all in="CID" out="*CC"/>
  <all in="I" out="B"/>
</sequence>

<!--
Generates a random puzzle with keys and locks on the main path. For a variation that can put locks on any paths see Keys.

Used in SeaVilla.
-->


================================================
FILE: models/BasicPartitioning.xml
================================================
<sequence values="BW">
  <all in="***/*B*/***" out="***/*W*/***"/>
  <markov>
    <one in="WWW/WBW" out="WBW/WBW"/>
    <one in="WWW/BBB" out="WBW/BBB"/>
  </markov>
</sequence>


================================================
FILE: models/BasicSkyline.xml
================================================
<sequence values="BEC" symmetry="(x)">
  <one in="B" out="E" steps="7"/>
  <one in="EB" out="EE" steps="100"/>
  <all in="EB" out="CB"/>
  <all in="C/B" out="C/C"/>
</sequence>


================================================
FILE: models/BasicSnake.xml
================================================
<sequence values="BWDPGR" origin="True">
  <all>
    <rule in="WBB" out="**D"/>
    <rule in="DBB" out="**D"/>
  </all>
  <one in="WBD" out="PGR"/>
  <one in="RBD" out="GGR" steps="2"/>
  <one in="D" out="W" steps="15"/>
  <markov>
    <one in="RBW" out="GGR"/>
    <all>
      <rule in="RBD" out="GGR"/>
      <rule in="PGG" out="DBP"/>
    </all>
  </markov>
</sequence>


================================================
FILE: models/BernoulliPercolation.xml
================================================
<sequence values="RDAUBW" origin="True">
  <prl in="*R" out="*U" symmetry="()"/>
  <prl in="U*" out="B*" symmetry="()"/>
  <all in="DB*" out="*AD"/>
  <prl in="A" out="D" p="0.517" steps="1"/>
  <prl in="A" out="B"/>
  <path from="R" to="U" on="D" color="W"/>
</sequence>


================================================
FILE: models/BiasedGrowth.xml
================================================
<sequence values="NWSB" origin="True">
  <prl in="N/*" out="S/*" symmetry="()"/>
  <prl in="*/S" out="*/B" symmetry="()"/>
  <one temperature="10.0">
    <rule in="WB" out="WW"/>
    <field for="W" to="N" on="B" recompute="False"/>
  </one>
</sequence>


================================================
FILE: models/BiasedGrowthContraction.xml
================================================
<sequence values="NWSB" origin="True">
  <prl in="N/*" out="S/*" symmetry="()"/>
  <prl in="*/S" out="*/B" symmetry="()"/>
  <one in="B/W" out="W/B" symmetry="()" steps="20"/>
  <one temperature="35.0">
    <rule in="WB" out="WW"/>
    <rule in="BWW" out="BBW"/>
    <field for="W" to="N" on="BW" recompute="False"/>
    <field for="B" to="S" on="BW" recompute="False"/>
  </one>
</sequence>


================================================
FILE: models/BiasedMazeGrowth.xml
================================================
<sequence values="NWAUB" origin="True">
  <prl in="N/*" out="U/*" symmetry="()"/>
  <prl in="*/U" out="*/B" symmetry="()"/>
  <one temperature="10.0">
    <rule in="WBB" out="WAW"/>
    <field for="W" to="N" on="B" recompute="False"/>
  </one>
</sequence>


================================================
FILE: models/BiasedVoronoi.xml
================================================
<sequence values="BOS">
  <one in="B" out="O" steps="1"/>
  <one in="B" out="S" steps="1"/>
  <one>
    <rule in="OB" out="OO"/>
    <rule in="SB" out="SS"/>

    <field for="S" to="O" on="BS" recompute="True"/>
    <field for="O" to="S" on="BO" recompute="True"/>
  </one>
</sequence>


================================================
FILE: models/BishopParity.xml
================================================
<sequence values="BRGUW">
  <one in="B" out="R" steps="1"/>
  <one in="B" out="G" steps="1" temperature="10.0">
    <field for="G" from="R" on="B"/>
  </one>
  <one in="BBB/BBB/BBB" out="***/*U*/***" steps="1" temperature="10.0">
    <field for="U" from="RG" on="B"/>
  </one>
  <one>
    <rule in="R*/*B" out="W*/*R"/>
    <rule in="U*/RB" out="U*/WR"/>
    <rule in="U*/BR" out="U*/RW"/>

    <observe value="G" from="B" to="R"/>
    <observe value="R" to="W"/>
    <observe value="B" to="BW"/>
    <observe value="U" to="U"/>
  </one>
</sequence>

<!--
To capture the target, the bishop might need to step into the magic portal that changes its parity.
-->


================================================
FILE: models/BlueNoise.xml
================================================
<one values="BW" origin="True" temperature="0.3">
  <rule in="B" out="W"/>
  <field for="W" from="W" on="B" recompute="True"/>
</one>


================================================
FILE: models/CarmaTower.xml
================================================
<sequence values="BtTRL" origin="True" symmetry="(xy)" folder="CarmaTower">
  <one in="B t" out="t B" />
  <one in="BB/Bt" out="tt/tt" steps="1" symmetry="()" />
  <all steps="2">
    <rule in="tB" out="*t" />
    <rule in="t*/*B" out="**/*t" />
  </all>
  <prl in="t B" out="* t" steps="2" />
  <prl in="t B" out="* T" steps="1" />
  <prl in="T B" out="* T" />
  <union symbol="r" values="RTB" color="45283c" /> z

  <!--one file="block_2_5x4"/>
    <one file="block_1_2x2"/--><!--one file="block_2_4x3"/>
    <one file="block_1_3x2"/--><!--one file="block_2_6x4"/>
    <one file="block_1_2x2"/--><one>
    <rule file="block_2_4x3" legend="rB*LTR" />
    <rule file="block_1_5x3" legend="rB*LTR" />
  </one>
  <all symmetry="(xyz)">
    <rule in="BRB" out="*B*" />
    <rule in="RB/B* B*/**" out="B*/** **/**" />
  </all>
  <prl in="R" out="T" />
  <all comment="add on sides">
    <rule in="LT/BB" out="**/L*" />
    <rule in="BL/LL" out="L*/**" />
  </all>
  <prl in="t" out="B" />
  <all in="B T" out="* B" steps="2" />
  <all>
    <rule in="BB LT" out="R* **" />
    <rule in="RB LL" out="*R **" />
  </all>
  <prl in="B R" out="R *" steps="1" />
  <prl in="R" out="L" />
  <union symbol="^" values="BL" />
  <one steps="4">
    <rule in="^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ TTTT/TTTT/TTTT" out="LLLL/LLLL/LLLL LLLL/LLLL/LLLL ****/****/****" />
    <rule in="^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ TTTT/TTTT/TTTT" out="LLLL/LLLL/LLLL LLLL/LLLL/LLLL LLLL/LLLL/LLLL ****/****/****" />
    <rule in="^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ ^^^^/^^^^/^^^^ TTTT/TTTT/TTTT" out="LLLL/LLLL/LLLL LLLL/LLLL/LLLL LLLL/LLLL/LLLL LLLL/LLLL/LLLL ****/****/****" />
    <rule in="^^^/^^^ ^^^/^^^ ^^^/^^^ TTT/TTT" out="LLL/LLL LLL/LLL LLL/LLL ***/***" />
  </one>
  <prl in="L" out="T" />
  <prl in="B" out="L" />
  <prl in="T" out="B" />
  <map scale="4 4 4" values="BLaDwWgKhORGUuoTtVQMpHlY" outputValues="BaLDWYl" transparent="OoH" folder="CarmaTower">
    <rule in="L" out="LLLLL/LLLLL/LLLLL/LLLLL/LLLLL LLLLL/LLLLL/LLLLL/LLLLL/LLLLL LLLLL/LLLLL/LLLLL/LLLLL/LLLLL LLLLL/LLLLL/LLLLL/LLLLL/LLLLL LLLLL/LLLLL/LLLLL/LLLLL/LLLLL" comment="EEEEE" />
    <prl steps="1">
      <rule in="B" out="L" />
      <rule in="L" out="B" />
    </prl>
    <sequence symmetry="(xyz)" comment="scaffolding">
      <all in="LB/BB BB/BB" out="**/** **/*O" />
      <all in="OBBBB/***** *****/****L" out="****O/***** *****/*****" />
      <union symbol="+" values="BO" comment="black or scaffold" />
    </sequence>
    <all in="BBB/+++ LLL/BBB *L*/BBB" out="***/*** ***/*** *W*/***" comment="setting up panels" />
    <all>
      <rule in="LWWL" out="*LL*" />
      <rule in="LWWWL" out="*LLL*" />
    </all>
    <markov>
      <one in="aWWW" out="***a" />
      <one>
        <rule in="BLWWW" out="****a" />
        <rule in="BLWWW" out="****R" />
      </one>
    </markov>
    <all>
      <rule in="aL/BB" out="L*/**" />
      <rule in="aWL/BBB" out="LL*/***" />
    </all>
    <one in="aWWaWWa" out="***L***" />
    <all comment="fill down">
      <rule in="W* L* L+" out="** W* **" />
      <rule in="a* L* L+" out="** a* **" />
    </all>
    <all comment="mark uneven panels">
      <rule in="WaW L*W" out="RRR **R" />
      <rule in="WW LW" out="RR *R" />
      <rule in="WWW" out="RRR" />
      <rule in="LT/LB" out="*R/**" />
    </all>
    <all symmetry="(xyz)">
      <rule in="RW" out="*R" />
      <rule in="Ra" out="*R" />
    </all>
    <all comment="delete too short panels">
      <rule in="L a a a a a a a" out="* t t t t t t t" />
      <rule in="t a" out="* t" />
      <rule in="tW" out="*T" />
      <rule in="TW" out="*T" />
    </all>
    <prl>
      <rule in="W" out="R" />
      <rule in="a" out="R" />
      <rule in="R" out="L" />
    </prl>
    <all in="BBB/+++ LLL/BBB *L*/BBB" out="***/*** ***/*** *H*/***" comment="special windows" /><union symbol="2" values="HW" /><all>
      <rule in="H L L L L L L" out="H H H W W W W" />
      <rule in="W+ LB LB" out="** ** H*" />
    </all>
    <all>
      <rule in="L 2 L" out="* R *" />
      <rule in="L2L" out="*R*" />
      <rule in="2T" out="R*" />
      <rule in="22/BL" out="RR/**" />
      <rule in="2L/BL" out="R*/**" />
    </all>
    <all in="R2" out="*R" symmetry="(xyz)" />
    <all comment="mark long enough windows">
      <rule in="LHHHHHH LHHHHHH LHHHHHH" out="*VVVVVV *VVVVVV *VVVVVV" />
      <rule in="VH" out="*V" />
      <rule in="V W W W W" out="* Q Q Q Q" />
      <rule in="Q W" out="* Q" />
    </all>
    <prl>
      <rule in="H" out="L" />
      <rule in="W" out="L" />
      <rule in="R" out="L" />
    </prl>
    <prl comment="delete solo windows">
      <rule in="Q" out="W" />
      <rule in="V" out="H" />
    </prl>
    <prl in="W * H" out="Q * V" />
    <all symmetry="(xyz)">
      <rule in="QW" out="*Q" />
      <rule in="QH" out="*V" />
      <rule in="VH" out="*V" />
      <rule in="VW" out="*Q" />
    </all>
    <prl>
      <rule in="W" out="L" />
      <rule in="H" out="L" />
    </prl>
    <all symmetry="(xyz)" comment="fine scaffold">
      <rule in="OBB/*L*" out="**H/***" />
      <rule in="HBB/*L*" out="**H/***" />
    </all>
    <union symbol="-" values="OH" color="fec601" /> H
    <union symbol="=" values="OHoB" />
    <all>
      <rule in="T-" out="*B" />
      <rule in="T*/*-" out="**/*B" />
      <rule in="t-" out="*B" />
      <rule in="V-" out="*B" />
      <rule in="LQ/B-" out="**/*B" />
      <rule in="Q- L* V*" out="*B ** **" />
      <rule in="VL/B-" out="**/*B" />
      <rule in="QL/B-" out="**/*B" />
    </all>
    <all in="-B-/*L*" out="*o*/***" symmetry="(xyz)" />
    <all in="BQ oL" out="H* **" />
    <markov symmetry="(xyz)" comment="connect special windows">
      <all in="WQ" out="*W" />
      <one in="GQ" out="*W" />
      <path from="Q" to="WG" on="HOo" color="G" inertia="True" />
      <one in="Q" out="W" />
    </markov>
    <prl in="W" out="Q" /><prl>
      <rule in="oQ" out="B*" />
      <rule in="OQ" out="B*" />
      <rule in="HQ" out="B*" />
    </prl>
    <convolution neighborhood="VonNeumann" comment="mark edges">
      <rule in="L" out="p" sum="2..3" values="Bo" />
    </convolution>
    <union symbol="5" values="LURG" /><union symbol="6" values="LD" color="222034" /> b
    <all symmetry="(xyz)">
      <rule in="QL/==" out="*D/**" />
      <rule in="DL/==" out="*D/**" />
    </all>
    <all>
      <rule in="LL/LL/Qp" out="*D/*D/**" />
      <rule in="LL/LL/Vp" out="*D/*D/**" />
    </all>
    <markov symmetry="(xyz)" comment="marking small or large faces">
      <one in="RL/==" out="*R/**" steps="200" />
      <all in="RL/==" out="UU/**" />
      <all>
        <rule in="UR/==" out="UU/**" />
        <rule in="UL/==" out="UU/**" />
      </all>
      <one in="L5/=5" out="R*/**" />
    </markov>
    <one in="R" out="K" steps="12" />
    <all in="KR" out="*K" symmetry="(xyz)" />
    <prl>
      <rule in="U" out="L" />
      <rule in="R" out="L" />
      <rule in="p" out="L" />
    </prl>
    <markov comment="surface prefab placement">
      <all in="hLL/=== hLL/=== hLL/===" out="*h*/*B* *h*/*B* *h*/*B*" />
      <all in="UW" out="*U" symmetry="(xyz)" />
      <one in="GW" out="*U" symmetry="(xyz)" />
      <path from="W" to="GQU" on="HOo" color="G" inertia="True" />
      <one>
        <rule file="side_13x5" legend="*o6-W" />
        <rule file="side_5x13" legend="*o6-W" />
        <rule file="side_7x11" legend="*o6-W" />
        <rule file="side_11x7" legend="*o6-W" />
        <!--<altrule file="side_15x5" />
        <altrule file="side_5x15" />
        <altrule file="side_7x13" />
        <altrule file="side_13x7" />
        <altrule file="side_17x5" />
        <altrule file="side_5x17" />
        <altrule file="side_7x11" />
        <altrule file="side_11x7" />-->
        <rule file="roof_7x11" legend="6*o-W" />
        <rule file="window_3" legend="OoH*BLh" />
        <rule file="window_3" legend="OoH*BLh" />
      </one>
    </markov>
    <markov comment="intermediate prefab placement">
      <all in="UW" out="*U" symmetry="(xyz)" />
      <one in="GW" out="*U" symmetry="(xyz)" />
      <path from="W" to="GQU" on="HOo" color="G" inertia="True" />
      <one>
        <rule file="roof_7x7" legend="6*o-W" />
        <rule file="roof_5x9" legend="6*o-W" />
      </one>
    </markov>
    <markov comment="secondary prefab placement">
      <all in="UW" out="*U" symmetry="(xyz)" />
      <one in="GW" out="*U" symmetry="(xyz)" />
      <path from="W" to="GQU" on="HOo" color="G" inertia="True" />
      <one>
        <rule file="side_3x5" legend="*o6-W" />
        <rule file="side_5x3" legend="*o6-W" />
        <!--<altrule file="side_3x7" />
        <altrule file="side_7x3" />-->
        <rule file="side_3x5_fake" legend="*oM6-K" />
        <rule file="side_5x3_fake" legend="*oM6-K" />
        <rule file="roof_3x5" legend="6*-oW" />
        <rule file="window_2" legend="OoH*BLh" />
        <rule file="window_2" legend="OoH*BLh" />
        <rule file="window_2" legend="OoH*BLh" />
        <rule file="window_2" legend="OoH*BLh" />
        <rule file="holes_4" legend="*oL-Bh" />
        <rule file="small_windows_3" legend="*oL-Bh" />
      </one>
    </markov>
    <all in="BoB UUU" out="*** *u*" symmetry="(xyz)" />
    <markov symmetry="(xyz)" comment="draw secondary tubes">
      <one>
        <rule in="WUu" out="**W" />
        <rule in="WUU UUU UUu" out="*** *** **W" />
      </one>
      <path from="u" to="W" on="OHo" color="G" inertia="True" longest="True" />
      <one in="W" out="R" />
      <one in="u" out="W" />
    </markov>
    <prl in="R" out="U" />
    <prl in="M" out="o" />
    <all file="small_windows_2" legend="o*L-Bh" />
    <all file="holes_2" legend="o*L-Bh" />
    <markov>
      <one in="hLL/=== hLL/=== hLL/===" out="*h*/*B* *h*/*B* *h*/*B*" />
      <one file="window_1" legend="OoH*BLh" />
    </markov>
    <all in="LLLLL LhhhL LhhhL LhhhL LLLLL" out="***** **L** *LLL* **L** *****" />
    <one file="small_windows_2" legend="o*L-Bh" />
    <one>
      <rule file="holes_h_4" legend="*oL-Bh" />
      <rule file="holes_v_3" legend="*oL-Bh" />
    </one>
    <prl comment="delete fine scaffold">
      <rule in="H" out="B" />
      <rule in="o" out="B" />
      <rule in="O" out="B" />
      <rule in="D" out="L" />
      <rule in="K" out="L" />
    </prl>
    <prl in="L B B" out="R * *" />
    <prl in="L B" out="* g" />
    <prl in="R" out="L" />
    <all in="LLL/BBB LhL/BBB LLL/BBB BBB/BBB" out="***/*** *L*/*** ***/*** ***/***" />
    <all comment="propagate holes">
      <rule in="LLLLL/BBBBB LhLLL/BBBBB LLLLL/BBBBB" out="*****/***** ***h*/***** *****/*****" />
      <rule in="LLL/BBB LLL/BBB LLL/BBB LhL/BBB LLL/BBB" out="***/*** *h*/*** ***/*** ***/*** ***/***" />
    </all>
    <all in="BB BL" out="a* **" comment="top edges" />
    <all in="aB/Ba BL/BB" out="**/a* **/**" />
    <all in="hhh/BaB" out="RRR/***" />
    <all>
      <rule in="hh/Ba" out="RR/**" />
      <rule in="h R" out="R *" />
    </all>
    <prl in="R" out="L" />
    <all in="LhL LhL LhL" out="*L* *L* *L*" />
    <one in="Lhhhhh Lhhhhh Lhhhhh" out="***L** ***L** ***L**" />
    <all in="hhhLh/BBBBB" out="***u*/*****" />
    <prl in="u" out="h" />
    <one in="LLLL LhhL LhhL LhhL LLLL" out="**** *LL* *LL* *LL* ****" steps="7" comment="remove some windows" />
    <one in="LLL LhL LLL" out="*** *L* ***" steps="3" />
    <one in="LLL LhL LhL LLL" out="*** *L* *L* ***" steps="2" />
    <!--<altone in="LLLL LhhL LhhL LhhL LLLL" out="**** *LL* *LL* *LL* ****" steps="22" comment="remove some windows" />
    <altone in="LLL LhL LLL" out="*** *L* ***" steps="10" />
    <altone in="LLL LhL LhL LLL" out="*** *L* *L* ***" steps="4" />-->
    <all steps="1" comment="shorten panels">
      <rule in="L T" out="* L" />
      <rule in="L t" out="* L" />
      <rule in="T L" out="L *" />
      <rule in="t L" out="L *" />
    </all>
    <all steps="1">
      <rule in="L t" out="* T" />
      <rule in="t L" out="T *" />
    </all>
    <markov>
      <all in="DU" out="*D" />
      <one in="UU/UU" out="DD/DD" />
    </markov>
    <convolution neighborhood="VonNeumann" steps="1" comment="mark radiator edges">
      <rule in="U" out="R" sum="2..3" values="U" />
    </convolution>
    <markov symmetry="(xyz)">
      <all>
        <rule in="uU UU" out="** *u" />
        <rule in="BU UU" out="** *B" />
        <rule in="uUU" out="**u" />
        <rule in="BUU" out="**B" />
      </all>
      <one>
        <rule in="RR RU" out="** *u" />
        <rule in="RR RU" out="** *B" />
      </one>
    </markov>
    <prl in="R" out="U" />
    <all steps="1">
      <rule in="LTB" out="*LT" />
      <rule in="LtB" out="*Lt" />
    </all>
    <union symbol="0" values="LH" />
    <all in="0hB 0hB 0hB" out="HB* HB* Haa" comment="deepen windows" />
    <all in="0hB 0hB" out="HB* Haa" />
    <all in="0hB" out="HB*" />
    <all comment="deepen special windows">
      <rule in="QGB" out="*B*" />
      <rule in="LQB" out="B**" />
      <rule in="LVB" out="B**" />
    </all>
    <union symbol="#" values="Lh" />
    <all in="#BV" out="h*B" />
    <all in="BV/VL" out="*B/B*" />
    <all>
      <rule in="Lh/LB" out="*R/**" />
      <rule in="Bh/BB" out="*R/**" />
    </all>
    <one in="Rhhhhh Rhhhhh Rhhhhh" out="***R** ***R** ***R**" />
    <one comment="merge some special windows">
      <rule in="hRh hRh hRh" out="*h* *h* *h*" />
      <rule in="hRh hRh hRh" out="*M* *M* *M*" />
      <rule in="hRh hRh hRh" out="*M* *M* *M*" />
    </one>
    <all in="0hB" out="HB*" comment="secondary deepening" />
    <prl>
      <rule in="R" out="L" />
      <rule in="M" out="L" />
    </prl>
    <all in="BBBB/BBBB/BBBB BaBB/BGGG/BaBB BBLL/BGLL/BBLL" out="****/GGG*/**** ****/Ga**/**** ****/G***/****" comment="resolve some conflicts between tubes and borders" />
    <prl comment="color bottoms">
      <rule in="L B B B B" out="g * * * *" />
      <rule in="L G B B B" out="g * * * *" />
    </prl>
    <all in="LgL" out="*L*" />
    <all in="BQ*/BLQ/BBB BQ*/BLQ/BBB BQ*/BLQ/BBB BQ*/BLQ/BBB" out="***/***/*** ***/***/*** ***/L**/LL* ***/***/***" />
    <union symbol="_" values="Tt" />
    <markov comment="put panel holders">
      <one>
        <rule in="__/OB" out="**/*O" />
        <rule in="TB/OB" out="*O/*O" />
        <rule in="OT/OB" out="**/*O" />
      </one>
      <one>
        <rule in="BBB/BBB BBT/BBB BBT/BBB BBT/BBB" out="***/*** ***/*** *O*/*OO ***/***" />
        <rule in="BBB/BBB BBT/BBB BBT/BBB BBT/BBB" out="***/*** ***/*** ***/*** *O*/*OO" />
        <rule in="BBT/BBB BBT/BBB BBT/BBB BBB/BBB" out="***/*** *O*/*OO ***/*** ***/***" />
        <rule in="BBT/BBB BBT/BBB BBT/BBB BBB/BBB" out="*O*/*OO ***/*** ***/*** ***/***" />
      </one>
    </markov>
    <one steps="1">
      <rule file="cut_1" legend="BTt*" />
      <rule file="cut_2" legend="BTt*" />
    </one>
    <markov>
      <one>
        <rule in="__/OB" out="**/*O" />
        <rule in="TB/OB" out="*O/*O" />
      </one>
      <one>
        <rule in="BBB/BBB BBT/BBB BBT/BBB BBT/BBB" out="***/*** ***/*** *O*/*OO ***/***" />
        <rule in="BBB/BBB BBT/BBB BBT/BBB BBT/BBB" out="***/*** ***/*** ***/*** *O*/*OO" />
        <rule in="BBT/BBB BBT/BBB BBT/BBB BBB/BBB" out="***/*** *O*/*OO ***/*** ***/***" />
        <rule in="BBT/BBB BBT/BBB BBT/BBB BBB/BBB" out="*O*/*OO ***/*** ***/*** ***/***" />
      </one>
    </markov>
    <all in="OT/OB" out="**/*O" />
    <all in="TtT/OOO" out="***/BBB" />
    <one steps="2">
      <rule file="bracing_v_3" legend="*LG" />
      <rule file="bracing_h_3" legend="*GL" />
    </one>
    <one steps="3">
      <rule file="bracing_v_2" legend="*LG" />
      <rule file="bracing_h_2" legend="*GL" />
    </one>
    <one steps="16">
      <rule file="bracing_v_1" legend="*LG" />
      <rule file="bracing_h_1" legend="*GL" />
      <rule in="*LLL/BBGL/BBBL/BBB* *LLL/BBGL/BBBL/BBB* *LLL/BBGL/BBBL/BBB*" out="****/****/****/**** ****/*L**/**L*/**** ****/****/****/****" />
    </one>
    <all>
      <rule file="roof_thing_7x11" legend="DL*a" />
      <rule file="roof_thing_2" legend="DLRao*" />
    </all>
    <all>
      <rule file="roof_thing_1" legend="DLRao*" />
      <rule file="roof_thing_5x9" legend="DL*a" />
    </all>
    <prl in="o *" out="B B" />
    <all in="GRL" out="*G*" />
    <all in="BL/GR" out="**/*G" />
    <prl in="R" out="B" />
    <prl>
      <rule in="G" out="D" />
      <rule in="Q" out="W" />
      <rule in="T" out="W" />
      <rule in="t" out="a" />
      <rule in="O" out="L" />
      <rule in="U" out="a" />
      <rule in="u" out="D" />
      <rule in="g" out="l" />
      <rule in="H" out="Y" />
    </prl>
  </map>
</sequence>

<!--
Some rendered outputs: https://github.com/mxgmn/Blog/blob/master/CarmaTower.md

TODO: a more modular example in this style.
-->


================================================
FILE: models/Cave.xml
================================================
<sequence values="DA">
  <prl in="***/*D*/***" out="***/*A*/***"/>
  <prl in="A" out="D" p="0.435" steps="1"/>
  <convolution neighborhood="Moore">
    <rule in="A" out="D" sum="5..8" values="D"/>
    <rule in="D" out="A" sum="6..8" values="A"/>
  </convolution>
  <all in="AD/DA" out="AA/DA"/>
</sequence>


================================================
FILE: models/CaveContour.xml
================================================
<sequence values="EFDA">
  <prl in="***/*E*/***" out="***/*F*/***"/>
  <prl in="F" out="E" p="0.5" steps="1"/>
  <convolution neighborhood="Moore" periodic="True">
    <rule in="F" out="E" sum="5..8" values="E"/>
    <rule in="E" out="F" sum="5..8" values="F"/>
  </convolution>
  <all>
    <rule in="EF" out="*A"/>
    <rule in="E*/*F" out="**/*A"/>
  </all>
  <all>
    <rule in="AE" out="*D"/>
    <rule in="A*/*E" out="**/*D"/>
  </all>
  <prl>
    <rule in="E" out="F"/>
    <rule in="A" out="D"/>
  </prl>
  <prl in="F" out="A"/>
  <all in="AD/DA" out="D*/**"/>
</sequence>


================================================
FILE: models/CentralCrawlers.xml
================================================
<sequence values="BWUR" origin="True">
  <one in="BB" out="UR" steps="10"/>
  <all temperature="5.0">
    <rule in="URB" out="BUR"/>
    <rule in="UR/*B" out="BU/*R"/>
    <rule in="W" out="B"/>
    <field for="R" to="W" on="B" recompute="False"/>
  </all>
</sequence>


================================================
FILE: models/CentralSAW.xml
================================================
<one values="BRW" origin="True" in="RBB" out="WWR" temperature="0.1">
  <field for="W" to="R" on="B" recompute="False"/>
</one>


================================================
FILE: models/ChainDungeon.xml
================================================
<sequence values="DABWO">
  <all in="***/*D*/***" out="***/*B*/***"/>
  <one in="BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/**BBB***/**BBB***/**BBB***"
      out="DDDDDDDD/DOOOOOOD/DOOOOOOD/DOOOOOOD/DOOOOOOD/DDDODDDD/**DOD***/**DWD***/********" steps="2"/>
  <markov>
    <all in="AW" out="AA"/>
    <path from="A" to="W" on="B" color="A" inertia="False"/>
    <one in="W" out="A"/>
  </markov>
  <convchain sample="Room" on="B" black="D" white="A" n="3" steps="10"/>
  <all in="AD/DA" out="AD/AA"/>
  <all in="DDD/DAD" out="DDD/DDD"/>
  <all in="OA" out="OO"/>
</sequence>


================================================
FILE: models/ChainDungeonMaze.xml
================================================
<sequence values="DABWO">
  <all in="***/*D*/***" out="***/*B*/***"/>
  <one in="BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/**BBB***/**BBB***/**BBB***"
      out="DDDDDDDD/DOOOOOOD/DOOOOOOD/DOOOOOOD/DOOOOOOD/DDDODDDD/**DOD***/**DWD***/********" steps="10"/>
  <markov>
    <all in="AW" out="AA"/>
    <path from="A" to="W" on="B" color="A" inertia="True"/>
    <one in="W" out="A"/>
  </markov>
  <convchain sample="Maze" on="B" black="D" white="A" n="2" steps="10"/>
  <all in="AD/DA" out="AD/AA"/>
  <all in="OA" out="*O"/>
</sequence>

<!--
TODO: Add more room shapes.
-->


================================================
FILE: models/ChainMaze.xml
================================================
<sequence values="BDA">
  <convchain sample="Maze" on="B" black="D" white="A" n="2" steps="10"/>
  <all in="AD/DA" out="AD/AA"/>
</sequence>


================================================
FILE: models/Chase.xml
================================================
<sequence values="BRW" periodic="True">
  <one in="B" out="R" steps="20"/>
  <one in="B" out="W" steps="20"/>
  <all temperature="1.0">
    <rule in="RB" out="BR"/>
    <rule in="WB" out="BW"/>
    <rule in="RW" out="BR"/>
    <field for="W" from="R" on="BW" recompute="True"/>
    <field for="R" to="W" on="BR" recompute="True"/>
  </all>
  <all in="RB" out="BR"/>
</sequence>

<!--
Every red predator tries to catch the closest white creature. White creatures try to run away from red predators.

Nonzero temperature causes creatures to make small mistakes.
-->


================================================
FILE: models/Circuit.xml
================================================
<sequence values="BtEDGANYOWU" origin="True">
  <prl in="***/*B*/***" out="***/*E*/***"/>
  <all in="tEE" out="**t"/>
  <one file="Chip" legend="*tEADN" steps="2"/>
  <markov>
    <all>
      <rule in="EG" out="tG"/>
      <rule in="E*/*G" out="t*/*G"/>
    </all>
    <path from="A" to="U" on="E" color="G" inertia="True"/>
    <all in="A" out="U"/>
    <one file="Chip" legend="*tEADN"/>
  </markov>
  <prl in="B" out="E"/>
  <all>
    <rule in="EU" out="EE"/>
    <rule in="EEE/ttE/EEE" out="***/E**/***"/>
  </all>
  <markov>
    <one>
      <rule in="NUAU" out="NAGG"/>
      <rule in="UAG" out="GUA"/>
      <rule in="UA/*G" out="GU/*A"/>
    </one>
    <one in="UG" out="UA"/>
  </markov>
  <all in="NG" out="NW"/>
  <all>
    <rule in="ND" out="DN"/>
    <rule in="NWGG" out="DWYO"/>
    <rule in="YOG" out="GYO"/>
    <rule in="YO/*G" out="GY/*O"/>
    <rule in="YOAD" out="GGAN"/>
  </all>
</sequence>

<!--
This is not how circuits actually work.

TODO: Make a generator of WireWorld networks.
-->


================================================
FILE: models/ClosedSurface.xml
================================================
<sequence values="BW">
  <all in="B" out="W"/>
  <all in="***/***/*** ***/*W*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <wfc values="BW" tileset="Surface">
    <rule in="W" out="Empty"/>
  </wfc>
</sequence>


================================================
FILE: models/ColoredKnots.xml
================================================
<sequence values="BRW">
  <all in="B" out="R"/>
  <all in="***/***/*** ***/*R*/*** ***/***/***" out="***/***/*** ***/*W*/*** ***/***/***"/>
  <wfc values="BWIPENDAROYGUCKF" tileset="Knots3D" tiles="Knots3D/3">
    <rule in="R" out="Empty"/>
    <rule in="W" out="Line|Turn|Empty"/>
    <markov>
      <all>
        <rule in="IW" out="*I"/>
        <rule in="PW" out="*P"/>
        <rule in="EW" out="*E"/>
        <rule in="NW" out="*N"/>
        <rule in="DW" out="*D"/>
        <rule in="AW" out="*A"/>
        <rule in="RW" out="*R"/>
        <rule in="OW" out="*O"/>
        <rule in="YW" out="*Y"/>
        <rule in="GW" out="*G"/>
        <rule in="UW" out="*U"/>
        <rule in="CW" out="*C"/>
        <rule in="KW" out="*K"/>
        <rule in="FW" out="*F"/>
      </all>
      <one>
        <rule in="W" out="I"/>
        <rule in="W" out="P"/>
        <rule in="W" out="E"/>
        <rule in="W" out="N"/>
        <rule in="W" out="D"/>
        <rule in="W" out="A"/>
        <rule in="W" out="R"/>
        <rule in="W" out="O"/>
        <rule in="W" out="Y"/>
        <rule in="W" out="G"/>
        <rule in="W" out="U"/>
        <rule in="W" out="C"/>
        <rule in="W" out="K"/>
        <rule in="W" out="F"/>
      </one>
    </markov>
  </wfc>
</sequence>

<!--
TODO: To avoid listing rules for all colors, introduce logical expressions like u=(!W)&(!B). Then we can write W=u and maybe even uW=uu.
-->


================================================
FILE: models/CompleteSAW.xml
================================================
<sequence values="BRWD" origin="True">
  <all>
    <rule in="R*B" out="**D"/>
    <rule in="D*B" out="**D"/>
  </all>
  <one in="RBB" out="WWR" search="True" limit="1000" depthCoefficient="-1.0">
    <observe value="D" from="B" to="RW"/>
    <observe value="R" to="W"/>
    <observe value="B" to="BW"/>
  </one>
</sequence>


================================================
FILE: models/CompleteSAWSmart.xml
================================================
<sequence values="BDIORGW" origin="True">
  <all>
    <rule in="I*B" out="**D"/>
    <rule in="D*B" out="**I"/>
  </all>
  <one in="DBI" out="OR*" steps="1"/>
  <one in="D" out="G" steps="1"/>
  <all in="D" out="I"/>
  <one search="True" limit="300" depthCoefficient="-1.0">
    <rule in="ORBBB" out="WWOR*"/>
    <rule in="ORBBG" out="WWWWO"/>
    <rule in="BBB/R**/O**" out="OR*/W**/W**"/>
    <rule in="BBG/R**/O**" out="WWO/W**/W**"/>

    <observe value="I" from="B" to="W"/>
    <observe value="O" to="W"/>
    <observe value="R" to="W"/>
    <observe value="G" to="O"/>
    <observe value="B" to="BW"/>
  </one>
</sequence>


================================================
FILE: models/ConnectedCaves.xml
================================================
<sequence values="DAW">
  <prl in="***/*D*/***" out="***/*A*/***"/>
  <prl in="A" out="D" p="0.5" steps="1"/>
  <convolution neighborhood="Moore" periodic="True">
    <rule in="A" out="D" sum="5..8" values="D"/>
    <rule in="D" out="A" sum="5..8" values="A"/>
  </convolution>
  <markov>
    <all in="WA" out="WW"/>
    <path from="W" to="A" on="D" color="A"/>
    <one in="A" out="W"/>
  </markov>
</sequence>


================================================
FILE: models/ConstrainedCaves.xml
================================================
<sequence values="DABWOP">
  <prl in="***/*D*/***" out="***/*B*/***"/>
  <one file="ConstrainedRoom" legend="BDWO*" steps="5"/>
  <markov>
    <all in="AW" out="AA"/>
    <path from="A" to="W" on="B" color="A" inertia="True"/>
    <one in="W" out="A"/>
  </markov>
  <prl in="B" out="P" p="0.4545" steps="1"/>
  <convolution neighborhood="Moore">
    <rule in="P" out="B" sum="5..8" values="BD"/>
    <rule in="B" out="P" sum="5..8" values="PA"/>
  </convolution>
  <prl in="D" out="B"/>
</sequence>


================================================
FILE: models/Counting.xml
================================================
<convolution values="BRGUY" neighborhood="VonNeumann">
  <rule in="B" out="R" sum="3" values="B"/>
  <rule in="B" out="G" sum="4" values="B"/>
  <rule in="B" out="U" sum="5" values="B"/>
  <rule in="B" out="Y" sum="6" values="B"/>
</convolution>


================================================
FILE: models/Coupling.xml
================================================
<sequence values="EYUD">
  <one in="E" out="Y" steps="30"/>
  <one in="E" out="U" steps="30"/>
  <all>
    <rule in="YE" out="DY"/>
    <rule in="UE" out="DU"/>
    <rule in="YU" out="DD"/>
    <rule in="Y*/*U" out="D*/*D"/>

    <field for="Y" to="U" on="YUE" recompute="True"/>
    <field for="U" to="Y" on="YUE" recompute="True"/>
  </all>
</sequence>


================================================
FILE: models/Crawlers.xml
================================================
<sequence values="BUR">
  <one in="BB" out="UR" steps="12"/>
  <all>
    <rule in="URB" out="BUR"/>
    <rule in="UR/*B" out="BU/*R"/>
  </all>
</sequence>


================================================
FILE: models/CrawlersChase.xml
================================================
<sequence values="BWRUGE">
  <one in="BB" out="UR" steps="12"/>
  <markov>
    <all>
      <rule in="URB" out="BUR"/>
      <rule in="UR/*B" out="BU/*R"/>
      <rule in="URW" out="BEG"/>
      <rule in="UR/*W" out="BE/*G"/>
      <rule in="EG/BB" out="UR/RU"/>
      <rule in="BB/BW" out="**/WB"/>

      <field for="R" to="W" on="B" recompute="True" essential="True"/>
      <field for="W" from="R" on="B" recompute="True"/>
    </all>
    <one in="B" out="W"/>
  </markov>
</sequence>

<!--
White creature tries to run away from a pack of crawlers. As usual, crawlers can break.
-->


================================================
FILE: models/CrossCountry.xml
================================================
<sequence values="FUOZGWNR">
  <prl in="***/*F*/***" out="***/*U*/***"/>
  <prl in="U" out="F" p="0.435" steps="1"/>
  <convolution neighborhood="Moore">
    <rule in="U" out="F" sum="5..8" values="F"/>
    <rule in="F" out="U" sum="6..8" values="U"/>
  </convolution>
  <all in="UF/FU" out="UU/FU"/>
  <one in="F" out="O" steps="1"><field for="O" from="U" on="F"/></one>
  <one in="FFFFFFF/FFFFFFF/FFFFFFF/FFFFFFF/FFFFFFF/FFFFFFF/FFFFFFF" out="*******/*******/*******/***G***/*******/*******/*******" steps="1"><field for="G" from="O" on="F"/></one>
  <one>
    <rule in="OF" out="NO"/>
    <rule in="OU" out="NZ"/>
    <rule in="RU" out="WZ"/>
    <rule in="RF" out="WO"/>
    <rule in="Z" out="R"/>

    <observe value="G" from="F" to="O"/>
    <observe value="F" to="FN"/>
    <observe value="U" to="UW"/>
    <observe value="O" to="N"/>
  </one>
</sequence>

<!--
Finds the shortest path in the rugged terrain. Moving through lakes is 2 times slower than moving through plains. See also SnellLaw.xml.
-->


================================================
FILE: models/Cycles.xml
================================================
<sequence values="BWA" origin="True">
  <one in="WBB" out="WAW"/>
  <one in="WBW" out="*W*" steps="2"/>
  <all in="A" out="W"/>
  <all in="BBB/BWB" out="***/*B*"/>
</sequence>


================================================
FILE: models/DenseSAW.xml
================================================
<sequence values="BRW" origin="True">
  <one in="RBB" out="WWR" steps="1"/>
  <one in="RBB" out="WWR" temperature="0.3">
    <field for="R" to="W" on="B" recompute="True"/>
  </one>
</sequence>


================================================
FILE: models/DiagonalPath.xml
================================================
<sequence values="BRGW">
  <one in="B" out="R" steps="1"/>
  <one in="B" out="G" temperature="4.0" steps="1">
    <field for="G" from="R" on="B"/>
  </one>  
  <one>
    <rule in="RB" out="WR"/>
    <rule in="R*/*B" out="W*/*R"/>
    <observe value="G" from="B" to="R"/>
    <observe value="R" to="W"/>
    <observe value="B" to="BW"/>
  </one>
</sequence>


================================================
FILE: models/Digger.xml
================================================
<markov values="BRW" origin="True">
  <one in="RB" out="WR"/>
  <one in="RW" out="WR"/>
</markov>


================================================
FILE: models/DijkstraDungeon.xml
================================================
<sequence values="BGWRDU">
  <union symbol="?" values="BD"/>
  <one file="DijkstraRoom" legend="?DW*BR" steps="1"/>
  <all in="W" out="G"/>
  <markov>
    <one in="GR" out="GG"/>
    <path from="R" to="G" on="B" color="G" inertia="True"/>
    <one file="DijkstraRoom" legend="?DW*BR"/>
  </markov>
  <all>
    <rule in="G" out="W"/>
    <rule in="D" out="B"/>
  </all>
  <all in="RW" out="*R"/>
  <all in="R" out="B"/>
</sequence>


================================================
FILE: models/Division.xml
================================================
<sequence values="WBUuAaI" origin="true">
    <prl in="***/*W*/***" out="***/*U*/***"/>
    <prl in="W" out="I"/>
    <prl in="U" out="W"/>

    <!-- rounder origin target -->
    <prl in="WWWWW/WWWWW/WWWWW/WWWWW/BWWWW" out="B***B/B**B*/B*B**/BB***/B****" steps="1"/>

    <!-- clean division, would be a lot more versatile if one of the fields could be given a constant value instead of needing to set up two references-->
    <all temperature="0" steps="1">
        <rule in="W" out="U"/>
        <rule in="W" out="u"/>
        <field for="U" to="I" on="W" essential="False" recompute="True"/>
        <field for="u" to="B" on="W" essential="False" recompute="True"/>
    </all>

    <!-- blur -->
    <all temperature="2" steps="1">
        <rule in="U" out="U"/>
        <rule in="U" out="A"/>
        <rule in="u" out="a"/>
        <rule in="u" out="u"/>
        <field for="U" to="I" on="U" essential="False" recompute="True"/>
        <field for="A" to="u" on="U" essential="False" recompute="True"/>
        <field for="a" to="U" on="u" essential="False" recompute="True"/>
        <field for="u" to="B" on="u" essential="False" recompute="True"/>
    </all>

    <!-- Recursive contract/dilate. Very handy for edge finding on byzantine shapes. Strays left behind on noisy edges can be cleaned up but can also be useful sometimes.-->
    <all temperature="0" steps="2">
        <rule in="A" out="U"/>
        <rule in="A" out="A"/>
        <rule in="a" out="a"/>
        <rule in="a" out="u"/>
        <field for="U" to="U" on="A" essential="False" recompute="True"/>
        <field for="A" to="a" on="A" essential="False" recompute="True"/>
        <field for="a" to="A" on="a" essential="False" recompute="True"/>
        <field for="u" to="u" on="a" essential="False" recompute="True"/>
    </all>
    <!-- There's a bunch of ways to use this, especially when you start adding obstacles and noise fields to give "flow resistance" in different directions.-->
    <!-- Adding min, max and constant options would hugely expand the potential here, opening up potential for fuzzy calculations in the vein of Gaussian, Laplacian, and Lagrangian methods.-->
</sequence>


================================================
FILE: models/DualRetraction.xml
================================================
<sequence values="BRUW" origin="True">
  <one>
    <rule in="BB*BB/BBBBB/BBBBR/BBBBB/BB*BB" out="**R**/*WWW*/*WWWU/*WWW*/**R**"/>
    <rule in="BBBBB/BBBBB/RBBB*/BBBBB/BBBBB" out="*****/*****/UWWWR/*****/*****"/>
  </one>
  <all>
    <rule in="R" out="W"/>
    <rule in="U" out="W"/>
  </all>
  <all>
    <rule in="BBB/BWB" out="BBB/BBB"/>
    <rule in="WWW/WBW" out="WWW/WWW"/>
  </all>
  <all in="BBB/WWB/WWB" out="***/*B*/***"/>
</sequence>


================================================
FILE: models/DualRetraction3D.xml
================================================
<sequence values="BRUWG" origin="True" folder="DualRetraction">
  <one>
    <rule file="Room1" legend="B*RUW"/>
    <rule file="Room2" legend="B*RGWU"/>
  </one>
  <all>
    <rule in="R" out="W"/>
    <rule in="U" out="W"/>
  </all>
  <all>
    <rule in="BBB/BBB/BBB BBB/BWB/BBB" out="***/***/*** ***/*B*/***"/>
    <rule in="WWW/GBG" out="***/*G*"/>
    <rule in="GGG/GBG" out="***/*G*"/>
    <rule in="BBB/BBB/BBB GGG/GWG/GGG" out="***/***/*** ***/*G*/***"/>
  </all>
</sequence>


================================================
FILE: models/DungeonGrowth.xml
================================================
<sequence values="WRBUPY" origin="True" folder="DungeonGrowth">
  <union symbol="?" values="BR"/>
  <!--<prl in="***/*W*/***" out="***/*B*/***"/>-->
  <prl in="*****/*****/**W**/*****/*****" out="*****/*****/**B**/*****/*****"/>
  <one>
    <rule file="Room1"  legend="*?WRBPU"/>
    <rule file="Room2"  legend="*?WRBPU"/>
    <rule file="Room3"  legend="*?WRBPU"/>
    <rule file="Room4"  legend="*?WRBPU"/>
    <rule file="Room5"  legend="*?WRBPU"/>
    <rule file="Room7"  legend="*?WRBPU"/>
    <rule file="Room13" legend="*?WRBPU"/>
    <rule file="Room8"  legend="*?WRBPU"/>
    <rule file="Room9"  legend="*WBPR?U"/>
    <rule file="Room10" legend="*W?BRPU"/>
    <rule file="Room11" legend="*?WRBPU"/>
    <rule file="Room12" legend="*WBP?RU"/>
    <rule file="Room14" legend="*?WRBPU"/>
    <rule file="Room15" legend="*WBPRU?"/>
    <rule file="Room16" legend="*?WRBPU"/>
    <rule file="Room17" legend="*?WRBPU"/>
    <rule file="Room18" legend="*?WRBPU"/>
    <rule file="Room6"  legend="*?WRBPU"/>
  </one>
  <one in="WUW/BBB" out="WRW/BBB"/>
  <all in="U" out="P"/>
  <markov>
    <all>
      <rule in="RY" out="UU"/>
      <rule in="UR" out="UU"/>
      <rule in="UY" out="UU"/>
      <rule in="BU" out="WU"/>
      <rule in="B*/*U" out="W*/*U"/>
    </all>
    <path from="R" to="Y" on="B" color="U" inertia="True" longest="True"/>
    <one in="Y" out="W"/>
    <one in="R" out="Y"/>
  </markov>
  <all>
    <rule in="U" out="P"/>
    <rule in="W" out="B"/>
  </all>
  <all in="BBB/BPB" out="***/*B*"/>
  <all>
    <rule in="BP" out="WP"/>
    <rule in="B*/*P" out="W*/*P"/>
  </all>
</sequence>

<!--
Room shapes and placement algorithm are taken from
https://old.reddit.com/r/proceduralgeneration/comments/3pa8a1/my_take_at_a_roguelike_level_generator_ft/

Note that MJ interpreter automatically performs optimizations 1-3 from the post.
-->


================================================
FILE: models/DwarfPath.xml
================================================
<sequence values="BRWAPGEY">
  <one in="BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB" out="******/*AAAA*/*A**A*/*A**A*/*AAAA*/******" steps="1"/>
  <one in="BBB/BBB" out="WWW/WWW" steps="2"/>
  <one in="B" out="R" steps="1"/>
  <markov>
    <one>
      <rule in="GE" out="BG"/>
      <rule in="GA" out="RY"/>
    </one>
    <path from="G" to="A" on="B" color="E" inertia="False"/>
    <one>
      <rule in="RP" out="BR"/>
      <rule in="RW" out="BG"/>
    </one>
    <path from="R" to="W" on="B" color="P" inertia="False"/>
  </markov>
</sequence>


================================================
FILE: models/Dwarves.xml
================================================
<sequence values="BRWGNAEP">
  <one in="BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB" out="******/*NNNN*/*N**N*/*N**N*/*NNNN*/******" steps="1"/>
  <one in="BBB/BBB" out="WWW/WWW" steps="2"/>
  <one in="B" out="R" steps="2"/>
  <all>
    <rule in="RB" out="BR"/>
    <rule in="RW" out="BE"/>
    <rule in="E" out="G"/>
    <rule in="P" out="R"/>
    <rule in="GB" out="BG"/>
    <rule in="GN" out="PA"/>

    <field for="R" to="W" on="B" recompute="True"/>
    <field for="G" to="N" on="B" recompute="True"/>
  </all>
</sequence>


================================================
FILE: models/Escher.xml
================================================
<sequence values="BR">
  <all in="B" out="R"/>
  <all in="***/***/*** ***/*R*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <wfc values="BAYRW" tileset="Escher">
    <rule in="R" out="Empty"/>
    <all>
      <rule in="WBW" out="*W*"/>
      <rule in="RBR" out="*R*"/>
    </all>
  </wfc>
</sequence>


================================================
FILE: models/EscherSurface.xml
================================================
<sequence values="BW">
  <all in="B" out="W"/>
  <all in="***/***/*** ***/*W*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <wfc values="BADG" tileset="EscherSurface">
    <rule in="W" out="Empty"/>
    <all>
      <rule in="ABA" out="*A*"/>
      <rule in="GBG" out="*G*"/>
      <rule in="DBD" out="*D*"/>
    </all>
  </wfc>
</sequence>


================================================
FILE: models/EuclideanPath.xml
================================================
<sequence values="BRGWOAD">
  <one in="BBB/BBB/BBB" out="***/*D*/***" steps="8"/>
  <one in="D" out="A" steps="1"/>
  <one in="D" out="R" steps="1"><field for="R" from="A" on="BD"/></one>
  <one in="D" out="G" steps="1"><field for="G" from="R" on="BD"/></one>
  <all>
    <rule in="D" out="B"/>
    <rule in="A" out="B"/>
  </all>
  <one>
    <rule in="RB" out="WO"/>
    <rule in="O" out="R"/>

    <rule in="R*/*B" out="W*/*A"/>
    <rule in="A" out="D"/>
    <rule in="D" out="R"/>

    <observe value="G" from="B" to="R"/>
    <observe value="B" to="BW"/>
    <observe value="R" to="W"/>
  </one>
</sequence>


================================================
FILE: models/FindLongCycle.xml
================================================
<sequence values="BWARDEU" origin="True">
  <union symbol="?" values="BDE"/>
  <one in="WBB" out="WAW"/>
  <markov>
    <markov>
      <one in="RAW" out="**R" steps="20"/>
      <all>
        <rule in="RAW" out="UAU"/>
        <rule in="UAW" out="UAU"/>
        <rule in="UAR" out="UAU"/>
      </all>
      <sequence>
        <one in="WBW" out="RBR" steps="1"/>
        <all>
          <rule in="B?B/?W?" out="***/*E*"/>
          <rule in="???/BAB" out="***/*D*"/>
        </all>
      </sequence>
    </markov>
    <markov>
      <all>
        <rule in="R" out="W"/>
        <rule in="WDE" out="WAW"/>
      </all>
    </markov>
  </markov>
  <one in="B?B/?U?" out="***/*R*"/>
  <one in="RBR" out="UAU"/>
  <prl>
    <rule in="U" out="W"/>
    <rule in="D" out="E"/>
  </prl>
</sequence>


================================================
FILE: models/FireNoise.xml
================================================
<sequence values="BGOERK">
  <prl steps="75">
    <rule in="OG" out="*O"/>
    <rule in="O*/*G" out="**/*O"/>
    <rule in="B" out="G" p="0.01"/>
    <rule in="O" out="B"/>
    <rule in="G" out="O" p="0.0001"/>
  </prl>
  <all in="*G*/GBG" out="***/*G*"/>
  <all>
    <rule in="*B*/BGB/*B*" out="***/*B*/***"/>
    <rule in="*BB*/BGGB/*BB*" out="****/*BB*/****"/>
  </all>
  <markov>
    <sequence>
      <one in="G" out="R" steps="1"/>
      <all in="RG" out="RR" steps="10"/>
      <all in="RG" out="EE"/>
      <all>
        <rule in="ER" out="*E"/>
        <rule in="EG" out="*E"/>
      </all>
    </sequence>
  </markov>
  <markov>
    <sequence>
      <one in="B" out="K" steps="1"/>
      <all in="KB" out="*K" steps="10"/>
      <all in="KB" out="GG"/>
      <all>
        <rule in="GB" out="*G"/>
        <rule in="GK" out="*G"/>
      </all>
    </sequence>
  </markov>
  <prl>
    <rule in="K" out="E"/>
    <rule in="G" out="B"/>
  </prl>
</sequence>

<!--
A noise-like generator based on the forest-fire model https://en.wikipedia.org/wiki/Forest-fire_model
-->


================================================
FILE: models/Flowers.xml
================================================
<sequence values="NGUEPY" symmetry="(x)">
  <all in="N/*/*/*" out="G/*/*/*"/>
  <all in="G/*/*/*/*" out="U/*/*/*/*"/>
  <markov>
    <one>
      <rule in="UUU/UUU/UPU" out="***/*P*/*E*"/>
      <rule in="UUU/UUU/UUU/PUU/**U" out="***/*P*/*E*/EE*/***"/>
      <rule in="UUUUU/UUUUU/UUUUU/UUPUU/U***U" out="*****/*P*P*/*E*E*/*EEE*/*****"/>
      <rule in="UUU/UPU/UEU/UEU" out="*Y*/YEY/*Y*/***"/>
    </one>
    <one in="UUUUU/UUUUU/UUUUU/GGGGG/NNNNN" out="*****/**P**/**E**/**E**/**E**"/>
  </markov>
  <all in="***/*P*/***" out="*Y*/YEY/*Y*"/>
</sequence>


================================================
FILE: models/Forest.xml
================================================
<sequence values="BIEW">
  <one in="BB*/BBB/*B*" out="***/*I*/***"/>
  <all in="*I*/IBI" out="***/*I*"/>
  <all in="*B*/BIB/*B*" out="***/*W*/***"/>
  <one in="I" out="E" steps="2"/>
  <markov>
    <all in="EI" out="*E"/>
    <one in="EBI/EBI" out="**E/**E"/>
  </markov>
  <all in="E*W" out="**E"/>
  <prl>
    <rule in="I" out="B"/>
    <rule in="W" out="B"/>
  </prl>
</sequence>


================================================
FILE: models/ForestFire.xml
================================================
<prl values="BGR">
  <rule in="RG" out="*R"/>
  <rule in="R*/*G" out="**/*R"/>
  <rule in="B" out="G" p="0.01"/>
  <rule in="R" out="B"/>
  <rule in="G" out="R" p="0.0001"/>
</prl>

<!--
https://en.wikipedia.org/wiki/Forest-fire_model
-->


================================================
FILE: models/ForestFireCA.xml
================================================
<convolution values="BGR" neighborhood="Moore">
  <rule in="G" out="R" sum="1..8" values="R"/>
  <rule in="R" out="B"/>
  <rule in="B" out="G" p="0.01"/>
  <rule in="G" out="R" p="0.0001"/>
</convolution>


================================================
FILE: models/GameOfLife.xml
================================================
<sequence values="DA">
  <prl in="D" out="A" p="0.5" steps="1"/>
  <convolution neighborhood="Moore" periodic="True">
    <rule in="D" out="A" sum="3" values="A"/>
    <rule in="A" out="D" sum="0,1,4..8" values="A"/>
  </convolution>
</sequence>


================================================
FILE: models/GoTo.xml
================================================
<markov values="BRWD" origin="True">
  <one>
    <rule in="RW" out="BR"/>
    <rule in="RD" out="BR"/>
  </one>
  <path from="R" to="W" on="B" color="D"/>
  <one in="B" out="W"/>
</markov>


================================================
FILE: models/GoToGradient.xml
================================================
<markov values="BRW" origin="True">
  <one in="RW" out="BR"/>
  <one temperature="1.0">
    <rule in="RB" out="BR"/>
    <field for="R" to="W" on="B" recompute="True" essential="True"/>
  </one>
  <one in="B" out="W"/>
</markov>


================================================
FILE: models/GrowTo.xml
================================================
<sequence values="BUN">
  <one in="B" out="U" steps="1"/>
  <one in="B" out="N" steps="1"/>
  <one in="NB" out="NN" temperature="10.0">
    <field for="N" to="U" on="B" recompute="False"/>
  </one>
</sequence>


================================================
FILE: models/Growth.xml
================================================
<one values="BW" origin="True" in="WB" out="WW"/>


================================================
FILE: models/GrowthCompetition.xml
================================================
<sequence values="BEY" periodic="True">
  <one in="B" out="E" steps="5"/>
  <one in="B" out="Y" steps="5"/>
  <one>
    <rule in="EB" out="EE"/>
    <rule in="YB" out="YY"/>
    <rule in="EY" out="EE"/>
    <rule in="YE" out="YY"/>
  </one>
</sequence>


================================================
FILE: models/GrowthContraction.xml
================================================
<one values="BW" origin="True">
  <rule in="WB" out="WW"/>
  <rule in="BWW" out="BBW"/>
</one>


================================================
FILE: models/GrowthWalk.xml
================================================
<one values="BW" origin="True">
  <rule in="WB" out="BW"/>
  <rule in="WB" out="WW"/>
</one>


================================================
FILE: models/HamiltonianPath.xml
================================================
<sequence values="BRWGU" origin="True">
  <one symmetry="()">
    <rule in="B/B/R" out="R/B/B"/>
    <rule in="BBR" out="RBB"/>
  </one>
  <markov symmetry="(x)">
    <one in="RBB" out="WWR"/>
    <one in="R/B/B" out="W/W/R"/>
  </markov>
  <one in="BBB/BWB" out="***/*R*"/>
  <markov>
    <one in="UWW" out="UUU"/>
    <sequence>
      <one in="UWG" out="RBW"/>
      <all in="U" out="W"/>
    </sequence>
    <one in="RBW" out="UWG"/>
  </markov>
</sequence>

<!--
Starts with a fixed Hamiltonian path and applies transformations to it to generate other Hamiltonian paths (containing only one connectivity component).

For a simpler version that doesn't care about maintaining a single connectivity component see HamiltonianPaths.

Algorithm adapted from: https://aip.scitation.org/doi/10.1063/1.443937

Compare with an implementation in a conventional language: http://clisby.net/projects/hamiltonian_path/hamiltonian_path_v1.html
-->


================================================
FILE: models/HamiltonianPaths.xml
================================================
<sequence values="BRWG" origin="True">
  <one in="RBB" out="WWR" steps="1"/>
  <one in="R*B/***/W**" out="WWR/***/***" symmetry="(xy+)"/>
  <one in="BBB/BWB" out="***/*R*"/>
  <markov>
    <all in="GWW" out="WBR"/>
    <all in="WBR" out="GWW"/>
  </markov>
</sequence>

<!--
See HamiltonianPath for a modification that maintains a single connectivity component.

Algorithm adapted from: https://aip.scitation.org/doi/10.1063/1.443937

Compare with an implementation in a conventional language: http://clisby.net/projects/hamiltonian_path/hamiltonian_path_v1.html
-->


================================================
FILE: models/Hills.xml
================================================
<sequence values="BA">
  <prl in="B" out="A"/>
  <prl in="A *" out="B *" symmetry="()"/>
  <one in="AB" out="AA" steps="8000"/>
  <convolution neighborhood="NoCorners" periodic="True">
    <rule in="B" out="A" sum="10..18" values="A"/>
    <rule in="A" out="B" sum="10..18" values="B"/>
  </convolution>
</sequence>


================================================
FILE: models/IrregularMazeGrowth.xml
================================================
<one values="BW" origin="True" in="*BB/WBB/*BB" out="***/WW*/***"/>


================================================
FILE: models/IrregularSAW.xml
================================================
<one values="BRW" origin="True" in="*BB/RBB/*BB" out="***/WR*/***"/>


================================================
FILE: models/Island.xml
================================================
<sequence values="UWBRGEYINSOTus" origin="True">
  <prl in="***/*U*/***" out="***/*Y*/***"/>

  <one in="WY" out="WW" steps="1" comment="draw an island skeleton"/>
  <one in="YWY/YYY" out="YWY/YWY" steps="400" comment="steps define the lenght of the backbone"/>
  <one in="YWY/YWY/YYY" out="YWY/YRY/YYY" />
  <one in="YYY/WWW" out="YWY/WWW" steps="20" comment="adjust steps to change number of branches. More branches = rounder, smoother island with less inner water"/>
  <one in="YWY/YYY" out="YWY/YWY" steps="2300" comment="adjust steps for the length of branches. More lenght = bigger island"/>
  <all in="R" out="W" />

  <prl in="Y" out="U" p="0.00003" steps="1" comment="adjust p to reduce lakes"/>

  <one comment="Voronoi">
    <rule in="WY" out="WW"/>
    <rule in="UY" out="UU"/>
  </one>
  <convolution neighborhood="Moore" comment="smoothing">
    <rule in="U" out="W" sum="5..8" values="W"/>
    <rule in="W" out="U" sum="5..8" values="U"/>
  </convolution>

  <all in="U/*" out="I/*" symmetry="(x)" comment="paint ocean to find out coasts. Sea will be U, lakes I, deep ocean B"/>
  <all in="UI" out="UU"/>
  <all in="WU" out="WR"/>
  <prl in="RU" out="RR" steps="30" p="0.5" comment="steps = size of the shallow water around the coast"/>
  <prl in="U" out="B"/>
  <prl in="R" out="U"/>

  <all in="UW" out="UG" comment="spawn a few river sources (paint coast green on some thickness to force sources to be inland)"/>
  <all in="GW" out="GG" steps="80" comment="increase steps to push sources back from the sea"/>
  <prl in="WW" out="WI" p="0.000015" steps="1" comment="play with p to change the number of sources"/>
  <all in="G" out="W"/>

  <sequence>
    <one in="IW" out="IR" steps="1">
      <field for="R" from="U" on="W"/>
    </one>
    <one>
      <rule in="RU" out="NU"/>
      <rule in="RO" out="NO"/>
      <rule in="NNNRW/WWWWW" out="NNWWW/WWNNR" comment="break long, straight lines" />
      <rule in="RW" out="NR" />

      <observe value="W" to="WN"/>
      <observe value="R" to="N"/>
    </one>

    <all in="N" out="O" comment="color done (O) so that we can merge rivers"/>
    <all in="OI" out="OO" />
  </sequence>

  <prl steps="2" p="0.8" comment="widen the connection with the sea">
    <rule in="UO/UW" out="UO/UO" />
    <rule in="UO/WW" out="UO/OO" />
  </prl>
  <convolution neighborhood="Moore" periodic="True" comment="smooth">
    <rule in="W" out="O" sum="6..8" values="O"/>
  </convolution>

  <prl in="WU" out="YU" steps="1" p="0.005" comment="generate beaches starting points"/>
  <all steps="30" comment="march them along the coast">
    <rule in="UU/YW" out="UU/YY" />
    <rule in="UW/YW" out="UY/YY" />
  </all>
  <prl in="WY" out="YY" steps="3" p="0.4" comment="widen them with a bit of randomness"/>
  <convolution neighborhood="Moore" periodic="True" comment="smooth them">
    <rule in="Y" out="W" sum="5..8" values="W"/>
    <rule in="W" out="Y" sum="5..8" values="Y"/>
  </convolution>

  <all in="O" out="u" comment="lakes and rivers back to lake blue"/>
  <all in="UY" out="TY" />
  <all in="UW" out="TW" />
  <all in="uW" out="TW" />
  <convolution neighborhood="Moore" periodic="True">
    <rule in="U" out="T" sum="5..8" values="T"/>
    <rule in="u" out="T" sum="5..8" values="T"/>
  </convolution>

  <prl in="UTW" out="UTG" p="0.1" steps="1" comment="seed forests and plains"/>
  <prl in="YW" out="YG" p="1" steps="1" />
  <prl in="WTW" out="WTE" p="0.05" steps="1" />
  <prl in="W" out="G" p="0.00001" steps="1" />

  <one comment="grow them, forest 3x stronger">
    <rule in="WE" out="EE" />
    <rule in="WE" out="EE" />
    <rule in="WE" out="EE" />
    <rule in="WG" out="GG" />
  </one>

  <convolution neighborhood="Moore" periodic="True">
    <rule in="G" out="E" sum="5..8" values="E"/>
    <rule in="E" out="G" sum="6..8" values="O"/>
  </convolution>
  <all in="W" out="G" comment="if any white, it's grass (islands). TODO: Eliminate islands next to lakes or islands too small"/>
  <all in="B" out="I" comment="change deep ocean color"/>
  <convolution neighborhood="Moore" periodic="True">
    <rule in="U" out="I" sum="5..8" values="I"/>
    <rule in="I" out="U" sum="5..8" values="U"/>
  </convolution>

  <all in="GE" out="GR" comment="let's grow mountains"/>
  <all in="TE" out="TR" />
  <prl in="E" out="S" p="0.0001" steps="1" />
  <one>
    <rule in="RE" out="RR" />
    <rule in="SE" out="SS" />
    <rule in="SE" out="SS" />
  </one>
  <all in="R" out="E" />
  <convolution neighborhood="Moore" periodic="True">
    <rule in="E" out="S" sum="5..8" values="S"/>
    <rule in="S" out="E" sum="5..8" values="E"/>
  </convolution>

  <all in="ES" out="ER" />
  <prl in="S" out="s" p="0.0002" steps="1" />
  <one>
    <rule in="RS" out="RR" />
    <rule in="RS" out="RR" />
    <rule in="RS" out="RR" />
    <rule in="sS" out="ss" />
    <rule in="sS" out="ss" />
    <rule in="sS" out="ss" />
    <rule in="sS" out="ss" />
  </one>
  <all in="R" out="S" />
  <convolution neighborhood="Moore" periodic="True">
    <rule in="S" out="s" sum="5..8" values="s"/>
    <rule in="s" out="S" sum="5..8" values="S"/>
  </convolution>

  <sequence comment="final step, trace back rivers to mountains">
    <one in="EEE/ETE" out="EEE/ERE" steps="1" />
    <one>
      <rule in="RS" out="NS" />
      <rule in="RO" out="NO" />
      <rule in="NNNRE/EEEEE" out="NNEEE/EENNR" comment="break long, straight lines" />
      <rule in="RE" out="NR" />

      <observe value="E" to="EN"/>
      <observe value="R" to="N"/>
    </one>

    <one in="NS" out="RN" steps="5" />
    <all in="R" out="T" />
    <all in="N" out="T" />
  </sequence>
  <prl in="u" out="U"/>
</sequence>

<!--
Made by Guillaume Fiette https://github.com/woldendans/MJ-simple-island
-->


================================================
FILE: models/Keys.xml
================================================
<sequence values="BADGRIFYUP" origin="True">
  <prl in="ABB*" out="*DDA"/>
  <one in="A" out="G" steps="1"/>
  <one steps="1">
    <rule in="A" out="R"/>
    <field for="R" from="G" on="RDA"/>
  </one>
  <one in="RDDA" out="*IYU" steps="1"/>
  <one temperature="2.0">
    <rule in="UDDA" out="FIYU"/>
    <rule in="UDDG" out="FIYG"/>
    <field for="U" to="G" on="GDAU"/>
  </one>
  <markov>
    <one in="UDDA" out="FIYU"/>
    <one in="IBB*/FDDA" out="P***/*IYU"/>
  </markov>
  <prl>
    <rule in="Y" out="F"/>
    <rule in="I" out="F"/>
    <rule in="D" out="B"/>
  </prl>
</sequence>

<!--
Generates a random puzzle with keys and locks.

Adapted graph grammar from the dissertation "Engineering Emergence. Applied Theory for Game Design" by Joris Dormans.
-->


================================================
FILE: models/KnightPatrol.xml
================================================
<markov values="BRGWA" origin="True">
  <one in="R**/**B" out="W**/**R">
    <observe value="G" from="B" to="R"/>
    <observe value="B" to="BW"/>
    <observe value="R" to="W"/>
  </one>
  <prl in="W" out="A"/>
  <one in="B" out="G"/>
</markov>


================================================
FILE: models/Knots2D.xml
================================================
<sequence values="DB">
  <all in="***/*D*/***" out="***/*B*/***"/>
  <wfc tileset="Knots2D" values="IE">
    <rule in="D" out="Empty"/>
    <rule in="B" out="Empty|Line|Turn|Cross"/>
  </wfc>
</sequence>


================================================
FILE: models/Knots3D.xml
================================================
<sequence values="BW">
  <all in="B" out="W"/>
  <all in="***/***/*** ***/*W*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <wfc values="BFE" tileset="Knots3D" tiles="Knots3D/Tubes">
    <rule in="W" out="Empty"/>
  </wfc>
</sequence>


================================================
FILE: models/Laplace.xml
================================================
<one values="BW" origin="True" temperature="12.0">
  <rule in="B" out="W"/>
  <field for="W" to="W" on="B" recompute="False"/>
</one>


================================================
FILE: models/Lightning.xml
================================================
<sequence values="NBRGUW">
  <all in="***/*N*/***" out="***/*B*/***"/>
  <one in="B" out="R" steps="1"/>
  <markov>
    <one>
      <rule in="RU" out="*W"/>
      <rule in="WU" out="*W"/>
      <rule in="WG" out="*N"/>
    </one>
    <path from="R" to="G" on="B" color="U"/>
    <all in="W" out="B"/>
    <one in="N" out="G"/>
  </markov>
</sequence>

<!--
TODO: modify path block so that the direction probabilities are proportional to the corresponding lengths.
-->


================================================
FILE: models/LoopErasedWalk.xml
================================================
<one values="BRWGOU" origin="True">
  <rule in="RBB" out="WWR"/>
  <rule in="RBW" out="GWO"/>
  <rule in="OWG" out="OBU"/>
  <rule in="UWW" out="BBU"/>
  <rule in="UWO" out="BBR"/>
</one>


================================================
FILE: models/LoopGrowth.xml
================================================
<sequence values="BAW" origin="True">
  <one in="BBB/BAB/BBB" out="WAW/ABA/WAW"/>
  <one in="BBB/BBB/WAW" out="WAW/ABA/WBW"/>
  <all in="A" out="W"/>
</sequence>


================================================
FILE: models/LostCity.xml
================================================
<sequence values="BWRDIE">
  <one in="B" out="I" steps="4" comment="make a few lakes by random growth"/>
  <one in="IB" out="*I" steps="24000"/>
  <convolution neighborhood="Moore">
    <rule in="I" out="B" sum="5..8" values="B"/>
    <rule in="B" out="I" sum="5..8" values="I"/>
  </convolution>

  <one in="B" out="R" steps="20" comment="make some land by a self-avoiding random walk with backtracking"/>
  <markov>
    <all in="RBB" out="WWR"/>
    <all in="RWW" out="DDR"/>
  </markov>
  <all in="R" out="D"/>

  <one in="BBWBB" out="**B**" comment="erode narrow sections of land"/>  
  <all>
    <rule in="IW" out="*D"/>
    <rule in="I*/*W" out="**/*D"/>
    <rule in="DW" out="*D"/>
  </all>
  <prl in="D" out="B"/>

  <prl steps="2">
    <rule in="WB" out="*D"/>
    <rule in="DB" out="*D" p="0.5"/>
  </prl>
  <convolution neighborhood="Moore">
    <rule in="D" out="B" sum="5..8" values="B"/>
    <rule in="B" out="D" sum="5..8" values="DI"/>
  </convolution>

  <one in="BB*/BBB/*B*" out="***/*E*/***"/>
  <all in="*E*/EBE" out="***/*E*"/>
  <prl in="D" out="B"/>
</sequence>

<!--
Based on the model by Andrew Kay https://github.com/kaya3/pattern-match-2d
-->


================================================
FILE: models/MarchingSquares.xml
================================================
<sequence values="BW">
  <prl in="B" out="W" p="0.5" steps="1"/>
  <map scale="3 3 1" values="DA">
    <rule in="BB/BB" out="DDD/DDD/DDD"/>
    <rule in="BB/BW" out="DDD/DDD/DDA"/>
    <rule in="BB/WW" out="DDD/DDD/AAA"/>
    <rule in="BW/WB" out="DDA/DDD/ADD"/>
    <rule in="BW/WW" out="DDA/DDA/AAA"/>
    <rule in="WW/WW" out="AAA/AAA/AAA"/>
  </map>
</sequence>


================================================
FILE: models/MazeBacktracker.xml
================================================
<markov values="BRGW" origin="True">
  <one in="RBB" out="GGR"/>
  <one in="RGG" out="WWR"/>
</markov>


================================================
FILE: models/MazeGrowth.xml
================================================
<one values="BWA" in="WBB" out="WAW" origin="True"/>

<!--
Compare to an implementation in a conventional language: https://bl.ocks.org/mbostock/70a28267db0354261476

Note that MJ interpreter automatically performs optimizations. It doesn't forget past matches, so it searches only over a small part of the grid each turn.
-->


================================================
FILE: models/MazeMap.xml
================================================
<sequence symmetry="()" values="BOEIN">
  <all>
    <rule in="B" out="O"/>
    <rule in="B" out="E"/>
    <rule in="B" out="I"/>
    <rule in="B" out="N"/>
  </all>
  <map scale="2 2 1" values="DA">
    <rule in="O" out="DD/DA" comment="1 cell"/>
    <rule in="E" out="DD/AA" comment="horizontal 2 cells"/>
    <rule in="I" out="DA/DA" comment="vertical 2 cells"/>
    <rule in="N" out="DA/AA" comment="3 cells"/>
  </map>
</sequence>


================================================
FILE: models/MazeTrail.xml
================================================
<one values="BRW" origin="True">
  <rule in="RBB" out="WWR"/>
  <rule in="R*W" out="W*R"/>
</one>

<!--
Also known as Aldous-Broder algorithm.

Like Wilson's algorithm, generates each maze with equal probability (samples mazes uniformly). Though very slowly.
-->


================================================
FILE: models/ModernHouse.xml
================================================
<sequence values="BD" symmetry="(xy)">
  <prl in="B" out="D" />
  <wfc tileset="Partition" values="BVL vSaOon" overlap="-3">
    <rule in="D" out="Nothing|I|T" />
    <prl>
      <rule in="LBBBL" out="*LSL*" />
      <rule in="V***/****/****/***B" out="****/****/****/***O" />
    </prl>
    <prl in="*****/*****/**V**/*****/*****" out="*****/*****/**v**/*****/*****" />
    <prl in="V*****v" out="******n" />
    <prl in="nBBBBBn" out="*aaaaa*" />
    <prl>
      <rule in="a**O**S" out="***o***" />
      <rule in="V***/****/****/***O" out="****/****/****/***o" />
    </prl>
    <prl in="anBBBBBV*" out="**aaaaa*a" />
    <prl>
      <rule in="a" out="L" />
      <rule in="n" out="V" />
      <rule in="v" out="V" />
      <rule in="VLLLLLV" out="***S***" />
      <rule in="VBBBBBV" out="***S***" />
    </prl>
    <map scale="1/3 1/3 1/3" values="BVSsto yORr CcaGP">
      <rule in="***/***/*** ***/*O*/*** ***/***/***" out="t" />
      <rule in="***/***/*** ***/*o*/*** ***/***/***" out="o" />
      <rule in="***/***/*** BBB/LSL/BBB ***/***/***" out="S" />
      <rule in="***/***/*** BBB/BSB/BBB ***/***/***" out="s" />
      <rule in="***/***/*** ***/*V*/*** ***/***/***" out="V" />
      <prl>
        <rule in="* t" out="* y" />
        <rule in="***/*S*/***" out="***/*C*/***" />
        <rule in="***/*s*/***" out="***/*c*/***" />
      </prl>
      <union symbol="." values="yr" />
      <markov>
        <all>
          <rule in="R*y" out="**r" />
          <rule in="r*y" out="**r" />
        </all>
        <one in="******* .*.*.*. .*y*.*." out="******* ******* **R****" /> - можно и ослабить это условие, но давайте пока так
      </markov>
      <prl>
        <rule in="r *" out="y *" />
        <rule in="* c" out="* P" />
        <rule in="* C" out="* G" />
      </prl>
      <prl in="P *" out="a *" />
      <wfc tileset="PartitionedEdges" values="BOaFXowSLsV JKkARrWhNYnxevDUZdQu" transparent="x">
        <rule in="t" out="Empty" />
        <rule in="o" out="o" />
        <rule in="r" out="Empty|Line|Turn|X|ContactUp" />
        <rule in="y" out="Empty|Line|Turn|X|ContactDown|ContactUp|Bridge" />
        <rule in="R" out="ContactUp" />
        <rule in="S" out="01" />
        <rule in="s" out="00" />
        <rule in="c" out="00|10" />
        <rule in="a" out="00|10|Down|Up0" />
        <rule in="P" out="00|10|Up0" />
        <rule in="C" out="01|11" />
        <rule in="G" out="01|11" /> Up1

        <rule in="V" out="Nothing|I|T|Cross" /><prl>
          <rule in="w" out="B" />
          <rule in="F" out="B" />
          <rule in="s" out="S" />
          <rule in="B" out="J" />
        </prl><prl>
          <rule in="S**O a***" out="***K ****" comment="mark nodes above stairs" />
          <rule in="a*** S**O" out="**** ***K" comment="mark nodes below stairs" />
          <rule in="J *" out="B *" />
        </prl><prl in="OBB*BBO" out="*aa*aa*" comment="fill the grid" /><prl in="Xaa*aaO" out="****A**" comment="mark nodes near stairs as gates" /><prl comment="cancel multi gates">
          <rule in="AaOaA" out="wwOww" />
          <rule in="AaO/**a/**A" out="wwO/**w/**w" />
        </prl><markov>
          <one>
            <rule in="WR" out="*F" />
            <rule in="WA" out="*N" />
          </one>
          <path from="A" to="R" on="aOS" color="W" longest="True" inertia="True" />
          <one in="A" out="R" />
        </markov><path from="R" to="W" on="aOS" color="h" inertia="True" comment="some gates could have been blocked, so connect them to the main path" /><prl>
          <rule in="hR" out="*W" />
          <rule in="aaXaa" out="WW*WW" />
          <rule in="a a" out="W W" />
          <rule in="h" out="W" />
          <rule in="F" out="W" />
          <rule in="N" out="W" />
          <rule in="w" out="W" />
          <rule in="WO" out="*Y" />
          <rule in="WS" out="*s" />
        </prl><all comment="repair markers on the path">
          <rule in="sWWW" out="***Y" />
          <rule in="YWWW" out="***s" />
        </all><one in="s J" out="x *" steps="1" /><markov comment="connect components">
          <one>
            <rule in="xWW*WWs" out="******x" />
            <rule in="x W W s" out="* * * x" />
            <rule in="s W W x" out="x * * *" />
            <rule in="xWWY" out="***n" />
            <rule in="sWWn" out="x***" />
          </one>
          <one>
            <rule in="nFFFFFF" out="******n" />
            <rule in="nFFFFFY" out="******n" />
          </one>
          <path from="n" to="Y" on="aOSs" color="F" inertia="True" />
        </markov><prl>
          <rule in="a" out="B" />
          <rule in="nFFFFFn" out="*WWxWW*" />
          <rule in="x" out="S" />
        </prl><prl in="LS" out="*s" /><union symbol="@" values="nOKX" /><one in="B n J" out="Y * *" steps="1" /><markov comment="propagate insides">
          <all>
            <rule in="Y*****B ***S**@" out="******Y *******" />
            <rule in="*******/Y*****B ******W/***s**@" out="*******/******Y *******/*******" />
            <rule in="Y******/*******/*******/*******/*******/*******/******B ***s***/*******/*******/s******/*******/*******/******n" out="*******/*******/*******/*******/*******/*******/******Y *******/*******/*******/*******/*******/*******/*******" />
          </all>
          <all>
            <rule in="Y*****B" out="******R" />
            <rule in="R*****B" out="******R" />
          </all>
          <one in="B*****B/*******/*******/*******/*******/*******/B*****B @W****@/*******/*******/*******/*******/*******/@*****@ *******/*******/*******/*******/*******/*******/******* Y*****Y/*******/*******/*******/*******/*******/Y*****Y" out="Y*****Y/*******/*******/*******/*******/*******/Y*****Y *******/*******/*******/*******/*******/*******/******* *******/*******/*******/*******/*******/*******/******* *******/*******/*******/*******/*******/*******/*******" />
          <one in="B* @W ** Y*" out="Y* ** ** **" />
          <one in="B* @W" out="Y* **" />
          <one in="B*****B/*******/*******/*******/*******/*******/B*****B @*****@/*******/*******/*******/*******/*******/@*****@ *******/*******/*******/*******/*******/*******/******* Y*****Y/*******/*******/*******/*******/*******/Y*****Y" out="Y*****Y/*******/*******/*******/*******/*******/Y*****Y *******/*******/*******/*******/*******/*******/******* *******/*******/*******/*******/*******/*******/******* *******/*******/*******/*******/*******/*******/*******" />
          <one in="B @ * Y" out="Y * * *" />
        </markov><prl>
          <rule in="R" out="B" />
          <rule in="*****/*****/**Y**/*****/***** BB*BB/BB*BB/*****/BB*BB/BB*BB" out="*****/*****/*****/*****/***** FF*FF/FF*FF/*****/FF*FF/FF*FF" />
        </prl><prl>
          <rule in="FLF" out="*B*" />
          <rule in="FLB" out="we*" />
          <rule in="eLV" out="*e*" />
          <rule in="Y O" out="* R" />
        </prl><prl>
          <rule in="wBw" out="*w*" />
          <rule in="wBB/eVB/Bew" out="*ww/**w/***" />
          <rule in="F" out="B" />
          <rule in="Y" out="B" />
          <rule in="s" out="S" />
          <rule in="L J" out="B *" />
          <rule in="o" out="O" />
        </prl><prl>
          <rule in="*****/*****/**S**/*****/*****" out="*****/*****/**s**/*****/*****" />
          <rule in="%B***B% JJJJJJJ" out="*FF*FF* *******" />
        </prl><prl in="S**O" out="***o" /><markov comment="make an entrance">
          <all>
            <rule in="N*****o" out="******N" />
            <rule in="nUUUUUU" out="*WWSWWn" />
            <rule in="nUUUUUoBBSB" out="*WWSWWNWW*W" />
          </all>
          <path from="o" to="n" on="FsOR" color="U" inertia="True" longest="True" />
        </markov><prl>
          <rule in="WN" out="*n" />
          <rule in="wFw" out="*w*" />
        </prl><prl>
          <rule in="F" out="B" />
          <rule in="N" out="O" />
          <rule in="s" out="S" />
        </prl><prl comment="fill contours with floors">
          <rule in="RBB*BBR" out="*aa*aa*" />
          <rule in="RBB*BBn" out="*aa*aa*" />
          <rule in="R" out="Y" />
        </prl><all in="BBBBBBB/aa*aaYB/BBBBBBB" out="*******/BB*BB**/*******" comment="retract dead ends" /><union symbol="#" values="hU" /><union symbol="$" values="sQ" /><union symbol="%" values="OnR" />
        === WALLS AND WINDOWS ===
        на существенные и несущественные стены нужно разделить еще до стягивания
        принцип такой: если окно проходит по контуру сверху или снизу, то оно существенное, остальные нет

        <prl in="B" out="x" /><prl in="* x" out="* B" /><prl in="S B B S" out="* h h *" /><prl in="888/8S8/888" out="***/*s*/***" /><prl in="1*****1/3**s**3/1*****1" out="*******/***S***/*******" /><prl in="s**2/***1" out="Q***/****" /><all comment="mark boundary walls as windows">
          <rule in="e* *h *h **" out="** *U *U **" />
          <rule in="** *h *h e*" out="** *U *U **" />
          <rule in="U $ h h" out="* * U U" />
          <rule in="h h $ U" out="U U * *" />
        </all><markov>
          <all comment="retract windows">
            <rule in="#* #* *W" out="r* r* **" comment="retract walls over the main path" />
            <rule in="U U s J" out="r r * *" />
            <rule in="x s # #" out="* * r r" />
            <rule in="U U $ r" out="r r * *" />
            <rule in="r $ U U" out="* * r r" />
            <rule in="# r" out="r *" />
            <rule in="h h s r" out="r r * *" />
            <rule in="r s h h" out="* * r r" />
          </all>
          <one in="***r*** Raa*aaY" out="******* nAA*AAR" comment="move through unobstructed edge" />
          <one in="***h*** Raa*aaY" out="***r*** nAA*AAR" comment="move through inner wall" />
          <one in="***r*** Raa*aaR" out="******* nAA*AAn" comment="connect through unobstructed edge" />
          <one in="***h*** Raa*aaR" out="***r*** nAA*AAn" comment="connect through inner wall" />
          <one in="***r*** Raa*aan" out="******* nAA*AA*" comment="loop through unobstructed edge" />
          <one in="***h*** Raa*aan" out="***r*** nAA*AA*" comment="loop through inner wall" />
          <one in="***r*** naa*aaY" out="******* *AA*AAR" comment="sprout through unobstructed edge" />
          <one in="***h*** naa*aaY" out="***r*** *AA*AAR" comment="sprout through inner wall" />
          <one in="***U*** Raa*aaY" out="***r*** nAA*AAR" comment="move through window" />
          <one in="***U*** Raa*aaR" out="***r*** nAA*AAn" comment="connect through window" />
          <one in="***U*** Raa*aan" out="***r*** nAA*AA*" comment="loop through window" />
          <one in="***U*** naa*aaY" out="***r*** *AA*AAR" comment="sprout through window" />
        </markov><prl>
          <rule in="x" out="B" />
          <rule in="r" out="B" />
          <rule in="R" out="n" />
          <rule in="s" out="S" />
          <rule in="Q" out="S" />
          <rule in="* * Y" out="* * O" />
        </prl><prl in="***B*** naa*aan" out="******* *AA*AA*" comment="make all dirs open in open areas" /><prl in="n" out="Y" /><prl in="WY" out="*n" />

        как раньше, нужно удалить окна, примыкающие к контурам снаружи
        альтернатива: окна как разграничители внешности и внутренности (когда-то хотел сделать внутренность как пересечение платформ!)
        кстати, можно усилить условие перехода вверх на этаж, чтобы платформы пересекались по большим кускам
        <union symbol="1" values="WaA" /><union symbol="2" values="nXY" /><union symbol="3" values="nY" /><union symbol="4" values="WA" /><union symbol="5" values="Bk" /><union symbol="6" values="BUR" /><union symbol="8" values="BL" /><union symbol="?" values="Qu" /><union symbol="," values="e" /> Be e
        <union symbol="^" values="Vu" /><union symbol="." values="BJX" />

        === COLUMNS ===
        <all comment="mark insides of the bottom floor">
          <rule in="wB JJ" out="*F **" />
          <rule in="FB" out="*F" />
          <rule in="F*B" out="**F" />
          <rule in="*44*44*/4*****4/4*****4/***V***/4*****4/4*****4/*44*44*" out="*******/*******/*******/***x***/*******/*******/*******" />
        </all><prl comment="mark vertices that can be a base of a column">
          <rule in="2*****2/*******/*******/***V***/*******/*******/2*****2" out="*******/*******/*******/***v***/*******/*******/*******" />
          <rule in="2*****2/*******/***w***/**eVe**" out="*******/*******/*******/***v***" />
          <rule in="2***/****/**we/**eV" out="****/****/****/***v" />
          <rule in="2*****2/*******/****w**/**eV***/***e***/*******/******2" out="*******/*******/*******/***v***/*******/*******/*******" />
          <rule in="VF JJ" out="v* **" />
          <rule in="V*/*w JJ/JJ" out="v*/** **/**" />
        </prl><all comment="drop columns">
          <rule in="v B B" out="* D D" />
          <rule in="D V B B" out="* * D D" />
          <rule in="x B B" out="* D D" />
        </all><all comment="retract columns">
          <rule in="D D V ." out="r r * *" />
          <rule in="D D V r" out="r r * *" />
          <rule in="D D x" out="r r *" />
        </all><prl in="O*****O/*BBBBB*/*BBBBB*/*BB*BB*/*BBBBB*/*BBBBB*/O*****O JJJJJJJ/JJJJJJJ/JJJJJJJ/JJJJJJJ/JJJJJJJ/JJJJJJJ/JJJJJJJ" out="*******/*RRRRR*/*RRRRR*/*RR*RR*/*RRRRR*/*RRRRR*/******* *******/*******/*******/*******/*******/*******/*******" comment="mark grass nodes" /><prl in="R*/*O JJ/JJ" out="**/** **/*X" /><prl>
          <rule in="r" out="B" />
          <rule in="F" out="B" />
          <rule in="v" out="V" />
          <rule in="x" out="V" />
          <rule in="R" out="B" />
        </prl><prl in="V*** B**h B**h" out="**** ***B ***B" comment="erase walls not bounded by columns" /><prl comment="expand walls and windows">
          <rule in="V*****V **BhB** **BhB**" out="******* **h*h** **h*h**" />
          <rule in="V*****V **BUB** **BUB**" out="******* **U*U** **U*U**" />
        </prl>

        === OVERHANGS ===
        <prl in="*****/*****/**L**/*****/*****" out="*****/*****/**Q**/*****/*****" /><prl in="L" out="B" /><prl in="Q" out="L" /><prl>
          <rule in="***/UUU/*** BBB/***/BBB ***/UUU/***" out="***/***/*** rrr/***/rrr ***/***/***" />
          <rule in="L*e/BBB" out="***/rrr" />
          <rule in="*e*/e*L/*LB" out="***/***/**r" />
          <rule in="n*/*B" out="**/*r" />
          <rule in="X*/*B" out="**/*r" />
          <rule in="LBBBBBL" out="*rrrrr*" comment="erase thin rectangles" />
        </prl><all in="rB" out="*r" /><prl in="eB/*L" out="*F/**" /><all in="FB" out="*F" /><prl>
          <rule in="rLr" out="*B*" />
          <rule in="rLB" out="*B*" />
          <rule in="BLB" out="*B*" />
        </prl><all>
          <rule in="r" out="B" />
          <rule in="LFFFFF/*LL*LL/LFFFFF" out="******/*FF*FF/******" />
          <rule in="FFFFFFF/F*LL*LL/FFFFFFF" out="*******/**FF*FF/*******" />
        </all><markov comment="select a disjoint subset of rectangles">
          <all>
            <rule in="NF" out="*N" />
            <rule in="LN/V*" out="**/Q*" />
            <rule in="NNN/NVN/NNN" out="***/*Q*/***" />
          </all>
          <all>
            <rule in="RF" out="*R" />
            <rule in="Q B B" out="* Z Z" />
            <rule in="B B Q" out="Z Z *" />
            <rule in="Z * B B" out="* * Z Z" />
            <rule in="B B * Z" out="Z Z * *" />
            <rule in="Z*/** **/*F" out="**/** **/*R" />
            <rule in="**/*F Z*/**" out="**/*R **/**" />
          </all>
          <one in="LF/VL" out="*N/Q*" />
        </markov><prl>
          <rule in="RLB" out="*B*" />
          <rule in="RLR" out="*B*" />
          <rule in="F" out="B" />
        </prl><prl>
          <rule in="R" out="B" />
          <rule in="Z" out="B" />
          <rule in="Q" out="V" />
          <rule in="N" out="B" />
          <rule in="o" out="B" />
          <rule in="K" out="B" />
        </prl>

        === MERGING ===
        <prl in="UUU*B" out="kkk**" comment="mark all composite windows" /><prl comment="merge elementary windows vertically">
          <rule in="***/UUU/*** BBB/BSB/BBB ***/UUU/***" out="***/***/*** ***/Q*Q/*** ***/***/***" />
          <rule in="UUU eSe UUU" out="*** u*u ***" />
        </prl><all comment="detect and propagate horizontal mismatches">
          5=Bk, ?=Qq
          <rule in="U***5 ?**** U***U" out="Z**** ***** Z***Z" /><rule in="U***U ?**** U***5" out="Z***Z ***** Z****" /><rule in="U Z" out="Z *" /><rule in="Z U" out="* Z" /><rule in="U * Z" out="Z * *" /><rule in="Z * U" out="* * Z" /><rule in="U***U/***** *****/**e** U***U/*****" out="Z***Z/***** *****/***** Z***Z/*****" comment="ban merges that cross contours" /><rule in="5***U ee*ee" out="****Z *****" comment="ban merges that create broken contours" /><rule in="U***U *w*ee" out="Z***Z *****" comment="ban merges that create broken contours" /><rule in="U***U/*****/**U**" out="Z***Z/*****/**Z**" comment="ban merges near triple points" /><rule in="h***U/*****/**U**" out="****Z/*****/**Z**" comment="ban merges near triple points" /><rule in="**5**/*****/5*D*U/*****/**5**" out="*****/*****/****Z/*****/*****" comment="ban merges near endpoints" />
        </all><prl in="U*D*U" out="F*x*F" comment="merge windows horizontally" /><all comment="mark windows for stylization">
          <rule in="*ee*ee*ee*ee* D*****x*****x D*****x*****x *ee*ee*ee*ee*" out="************* ******o*****o ******o*****o *************" />
          <rule in="*ee*ee*ee*ee* o*****x*****x o*****x*****x *ee*ee*ee*ee*" out="************* ******o*****o ******o*****o *************" />
        </all><all comment="burn odd style windows">
          <rule in="o*****x*****D o*****x*****D" out="R************ R************" />
          <rule in="o*****x*****o o*****x*****o" out="R***********R R***********R" />
          <rule in="R*****o R*****o" out="******R ******R" />
        </all><prl>
          <rule in="R" out="x" />
          <rule in="o**U**D" out="******K" />
        </prl><all>
          <rule in="**U/***/U*D ***/***/?** **5/***/U*D" out="**Z/***/Z** ***/***/*** ***/***/Z**" />
          <rule in="**5/***/U*D ***/***/?** **U/***/U*D" out="***/***/Z** ***/***/*** **Z/***/Z**" />
          <rule in="U Z" out="Z *" />
          <rule in="Z U" out="* Z" />
          <rule in="U * Z" out="Z * *" />
          <rule in="Z * U" out="* * Z" />
          <rule in="5*D*U ee**? 5*D*U" out="****Z ***** ****Z" comment="ban corner merges near hanging contours" />
        </all><prl in="**U**/*****/U*D*B/*****/**B**" out="**F**/*****/F*x**/*****/*****" /><prl>
          <rule in="Z" out="U" />
          <rule in="UUU u*u UUU" out="*** e*e ***" />
        </prl><prl in="x V x" out="* u *" /><prl comment="merge remaining elementary windows horizontally">
          <rule in=",***, U*D*U U*D*U B***B" out="***** N*x*N N*x*N *****" />
          <rule in=",***, U*D*U U*D*U e***e" out="***** N*x*N N*x*N *****" />
          <rule in="**,**/*****/****,/*****/***** **U**/*****/B*D*U/*****/**B** **U**/*****/B*D*U/*****/**B** **B**/*****/****B/*****/*****" out="*****/*****/*****/*****/***** **N**/*****/**x*N/*****/***** **N**/*****/**x*N/*****/***** *****/*****/*****/*****/*****" />
          <rule in="**,**/*****/****,/*****/***** **U**/*****/B*D*U/*****/**B** **U**/*****/B*D*U/*****/**B** **e**/*****/****e/*****/*****" out="*****/*****/*****/*****/***** **N**/*****/**x*N/*****/***** **N**/*****/**x*N/*****/***** *****/*****/*****/*****/*****" />
        </prl><prl>
          <rule in="F" out="U" />
          <rule in="N" out="U" />
          <rule in="K" out="D" />
        </prl><prl>
          <rule in="kB*Bk" out="*K*K*" />
          <rule in="kkB*/***B/***k/***k" out="**K*/***K/****/****" />
          <rule in="kBD" out="*K*" />
        </prl><all comment="mark bounded wood">
          <rule in="Bkkk" out="*RRR" />
          <rule in="Rk" out="*R" />
          <rule in="k*B*R" out="R****" />
          <rule in="R*B/***/B*k" out="***/***/**R" />
          <rule in="kkk kkk B*B RRR" out="RRR RRR *** ***" />
          <rule in="RRR B*B kkk kkk" out="*** *** RRR RRR" />
        </all><prl>
          <rule in="K" out="B" />
          <rule in="k*B*k" out="**x**" />
          <rule in="kk*B/****/***k/***k" out="***x/****/****/****" />
        </prl><prl in="k" out="U" /><prl in="R" out="k" /><all comment="burn solitary wood">
          <rule in="**6*****6**/***********/6***kkk***6/***********/**6*****6**" out="***********/***********/****RRR****/***********/***********" />
          <rule in="kkk kkk B*B RRR" out="RRR RRR *** ***" />
          <rule in="RRR B*B kkk kkk" out="*** *** RRR RRR" />
        </all><prl in="R" out="B" /><prl in="D*UUU*D" out="**hhh**" comment="convert solo windows to walls" /><prl in="h Q h" out="* B *" /><all comment="erase overhangs that touch merged windows">
          <rule in="uLL" out="*RR" />
          <rule in="R*LL" out="**RR" />
          <rule in="R**/*LL" out="***/*RR" />
        </all><prl in="R" out="B" /><prl>
          <rule in="BBB/BBB/BBB BBB/BVB/BBB .../.../..." out="***/***/*** ***/*B*/*** ***/***/***" />
          <rule in="BBB/BBB/BBB BBB/BSB/BBB .../.../..." out="***/***/*** ***/*B*/*** ***/***/***" />
          <rule in="BBB/BBB/BBB BBB/BsB/BBB .../.../..." out="***/***/*** ***/*B*/*** ***/***/***" />
          <rule in="BBB/BBB/BBB BBB/BOB/BBB BBB/BBB/BBB" out="***/***/*** ***/*B*/*** ***/***/***" />
          <rule in="BBB/BBB/BBB BBB/BOB/BBB JJJ/JJJ/JJJ" out="***/***/*** ***/*B*/*** ***/***/***" />
        </prl>
        <prl>
          <rule in="J" out="B" />
          <rule in="WWS** B*W** **W*B **SWW" out="***** F**** ****F *****" />
        </prl>
        <map scale="3/3 3/3 6/3" regular="False" values="BlWdUONgJoH faZEhLkFGCc XwMmTyKYR" outputValues="BlWdUONgJoH" transparent="T" folder="ModernHouse">
          29+1 values
          <rule in="BBB/BBB/BBB ***/*n*/*** BBB/BBB/BBB" fout="Node" legend="*fO" />
          <rule in="BBB/BBB/BBB ***/*Y*/*** BBB/BBB/BBB" fout="SecondaryNode" legend="*RlO" />
          <rule in="BBB/BBB/BBB ***/WXW/*** BBB/BBF/BBB" fout="ContactTop" legend="*aO" />
          <rule in="BBB/FBB/BBB ***/WXW/*** BBB/BBB/BBB" fout="ContactBottom" legend="*aO" />
          <rule in="BBB/FBB/BBB ***/WXW/*** BBB/BBF/BBB" fout="Bridge" legend="*aO" />
          <rule in="***/***/*** ***/*O*/*** ***/*X*/***" fout="Grass" legend="*g" />
          <rule in="***/***/*** ***/WSW/*** ***/***/***" fout="Dir" legend="*aO" />
          <rule in="***/***/*** ***/ASA/*** ***/***/***" fout="SecondaryDir" legend="*EO" />
          <rule in="***/***/*** ***/aSa/*** ***/***/***" fout="TertiaryDir" legend="*L" />
          <rule in="***/***/*** ***/WS*/*** ***/*W*/***" fout="Down" legend="a*O" />
          <rule in="***/*W*/*** ***/*SW/*** ***/***/***" fout="Up" legend="*aO" />
          <rule in="***/***/*** weB/wSB/weB ***/***/***" fout="Edge" legend="*dW" />
          <rule in="***/***/*** ***/*S*/*** *U*/*U*/*U*" fout="WindowTop" legend="*U" />
          <rule in="*U*/*U*/*U* ***/*S*/*** ***/***/***" fout="WindowBottom" legend="*U" />
          <rule in="***/***/*** *?*/*S*/*?* ***/***/***" fout="WindowMid" legend="*U" />
          <rule in="***/***/*** ***/*S*/*** *h*/*h*/*h*" fout="WallTop" legend="*h" />
          <rule in="*h*/*h*/*h* ***/*S*/*** ***/***/***" fout="WallBottom" legend="*h" />
          <rule in="***/***/*** ***/*S*/*** *k*/*k*/*k*" fout="WoodTop" legend="*k" />
          <rule in="*k*/*k*/*k* ***/*S*/*** ***/***/***" fout="WoodBottom" legend="*k" />
          <rule in="BBB/BBB/BBB BBB/LSL/BBB BBB/BBB/BBB" fout="FrameDir" legend="*N" />
          <rule in="***/***/*** weB/eV8/B8B ***/***/***" fout="Out" legend="*dWG" />
          <rule in="***/***/*** weB/wV8/weB ***/***/***" fout="Wall" legend="*dW" />
          <rule in="***/***/*** www/wVe/weB ***/***/***" fout="In" legend="*dW" />
          <rule in="***/***/*** ***/*V*/*** ***/*D*/***" fout="ColumnTop" legend="*Z" />
          <rule in="***/*D*/*** ***/*V*/*** ***/***/***" fout="ColumnBottom" legend="*Z" />
          <rule in="***/***/*** ***/*^*/*** ***/*x*/***" fout="GlassColumnTop" legend="*U" /> ^ = Vq
          <rule in="***/*x*/*** ***/*^*/*** ***/***/***" fout="GlassColumnBottom" legend="*U" />
          <rule in="***/*x*/*** ***/*u*/*** ***/*x*/***" fout="GlassColumnMid" legend="*U" />
          <rule in="BBB/BBB/BBB B8B/8VL/B8B BBB/BBB/BBB" fout="FrameVertex" legend="*F" />
          <rule in="***/***/*** ***/*V*/*** ***/*o*/***" fout="StyleTop" legend="*C" />
          <rule in="***/*o*/*** ***/*V*/*** ***/***/***" fout="StyleBottom" legend="*C" />

          <one in="R" out="Y" steps="9"/>
          <!--<prl in="R" out="Y" p="0.5" steps="1"/>-->
          <prl in="R" out="B"/>
          
          <prl steps="1">
            <rule in="B****/*fff*/*f*f*/*fff*/*****" out="fffff/f***f/f***f/f***f/fffff" />
            <rule in="B****/*lll*/*l*l*/*lll*/*****" out="lllll/l***l/l***l/l***l/lllll" />
            <rule in="NBF" out="*N*" />
          </prl>
          <prl steps="1">
            <rule in="BaOaB" out="a***a" />
            <rule in="WaOaW" out="a***a" />
            <rule in="BaOaW" out="a***a" />
            <rule in="daOad" out="a***a" />
            <rule in="BEOEB" out="E***E" />
            <rule in="BLLLB" out="L***L" />
          </prl><prl in="B" out="J" /><prl in="J * *" out="B * *" /><prl>
            <rule in="Z B Z" out="* Z *" />
            <rule in="Z B J" out="* Z *" />
          </prl><all>
            <rule in="d Z" out="* X" />
            <rule in="Z d" out="X *" />
            <rule in="G Z" out="* X" />
            <rule in="Z G" out="X *" />
            <rule in="X Z" out="* X" />
            <rule in="Z X" out="X *" />
          </all><prl>
            <rule in="Z*hhh*Z" out="**yyy**" />
            <rule in="Z*hhh*U" out="**yyy**" />
            <rule in="U*hhh*U" out="**yyy**" />
          </prl><prl>
            <rule in="J J" out="* o" />
            <rule in="f" out="a" />
            <rule in="E" out="l" />
            <rule in="OaaO" out="*OO*" />
            <rule in="OllO" out="*OO*" />
            <rule in="Z d Z" out="* Z *" />
            <rule in="Z d J" out="* Z *" />
            <rule in="Z G Z" out="* Z *" />
            <rule in="Z G J" out="* Z *" />
            <rule in="X d X" out="* X *" />
            <rule in="X d J" out="* X *" />
            <rule in="X G X" out="* X *" />
            <rule in="X G J" out="* X *" />
            <rule in="hB Ba" out="** h*" />
            <rule in="hB Bl" out="** h*" />
          </prl><union symbol="1" values="al" /><union symbol="." values="BJ" /><prl in="ByB/ByB/ByB ByB/ByB/ByB ByB/ByB/ByB ByB/ByB/ByB ByB/ByB/ByB BB1/BB1/BB1 .../.../..." out="*B*/*B*/*B* *B*/*B*/*B* *B*/*B*/*B* *B*/*B*/*B* *B*/*B*/*B* ***/***/*** ***/***/***" comment="erase some inner walls" /><prl>
            <rule in="yB Ba" out="** y*" />
            <rule in="yB Bl" out="** y*" />
          </prl><prl>
            <rule in="ZB" out="*H" />
            <rule in="Z*/*B" out="**/*H" />
            <rule in="XB" out="*w" />
            <rule in="X*/*B" out="**/*w" />
            <rule in="lll/lOl/lll" out="***/*l*/***" />
            <rule in="h B h" out="* h *" />
            <rule in="y B y" out="* y *" />
          </prl><prl>
            <rule in="hB" out="*M" />
            <rule in="h*/*B" out="**/*M" />
            <rule in="yB" out="*m" />
            <rule in="y*/*B" out="**/*m" />
            <rule in="FN/NB" out="**/*T" />
          </prl><all in="TB" out="*T" /><markov>
            <all>
              <rule in="NTNTTT" out="**N*N*" />
              <rule in="TTT/TNT" out="*N*/***" />
            </all>
            <one in="NTTTTT/NTTTTT/NTTTTT/WWWWWW" out="**N*N*/**N*N*/**N*N*/******" />
          </markov><prl>
            <rule in="NFN" out="*N*" />
            <rule in="T" out="B" />
          </prl><all in="F B" out="* F" comment="drop wooden columns" /><prl>
            <rule in="F" out="N" />
            <rule in="G" out="d" />
          </prl><prl>
            <rule in="gBBBBBg" out="**g*g**" comment="finalize grass" />
            <rule in="UBU" out="*U*" comment="finalize windows" />
            <rule in="L" out="l" />
            <rule in="a" out="l" />
          </prl><prl in="W**/***/**g" out="***/***/**B" comment="erase grass too close to the house" /><prl in="lll/lBl/lll" out="***/*l*/***" /><prl steps="1">
            <rule in="B g" out="g *" />
            <rule in="Uw" out="*d" />
          </prl><prl>
            <rule in="OOOOOOO/OlllllO/OlllllO/OlllllO/OlllllO/OlllllO/OOOOOOO" out="*******/*OOOOO*/*OOOOO*/*OOOOO*/*OOOOO*/*OOOOO*/*******" />
            <rule in="U l" out="* d" />
          </prl><prl in="O*/*l" out="**/*a" /><prl in="k*k*B" out="****K" /><prl>
            <rule in="K" out="k" />
            <rule in="k B k" out="* k *" />
            <rule in="k B J" out="* k *" />
          </prl><prl>
            <rule in="CBUUU" out="*CCCC" />
            <rule in="CBC" out="*C*" />
          </prl><all>
            <rule in="*****/WWWWW *CCCC/wBBBB" out="*****/***** ****c/****c" />
            <rule in="*****/WWWWW cCCCC/cBBBB" out="*****/***** ****c/****c" />
          </all><all in="cc CB" out="** cc" /><prl in="cBBB/cCCC cBBB/cCCC WWWW/****" out="*ccc/*ccc *ccc/*ccc ****/****" /><prl in="B W" out="W *" steps="1" comment="rise contours" /><prl in="UWB/WWB/BBB" out="*B*/BB*/***" comment="erase contours near windows" /><prl in="UWB" out="*B*" /><prl>
            <rule in="c" out="W" />
            <rule in="C" out="U" />
          </prl><prl>
            <rule in="w" out="W" /><rule in="M" out="W" /><rule in="m" out="H" /><rule in="a" out="l" /> O
            <rule in="UUW" out="**d" /><rule in="U U W" out="* * d" /><rule in="W B J" out="* W *" /><rule in="H B J" out="* H *" /><rule in="W B W" out="* W *" /><rule in="W l l W" out="* W W *" /><rule in="hW dB" out="** *W" />
          </prl><prl>
            <rule in="k" out="N" />
            <rule in="h" out="d" />
            <rule in="X" out="d" />
            <rule in="y" out="d" />
            <rule in="Z" out="d" />
          </prl>
        </map>
      </wfc>
    </map>
  </wfc>
</sequence>
<!--
Rendered outputs: https://twitter.com/ExUtumno/status/1141354217774428160
-->

================================================
FILE: models/MultiHeadedDungeon.xml
================================================
<sequence values="BRWGO" origin="True">
  <markov>
    <sequence>
      <one in="R***B" out="*WWWG" steps="3"/>
      <all in="R" out="O"/>
      <all in="G" out="R"/>
    </sequence>
  </markov>
  <all in="BBB/BOB" out="***/*R*"/>
  <all in="RBBBR" out="OWWWO"/>
  <all in="R" out="O"/>
  <all in="BBBBB/BOWWW/BBBBB" out="*****/*BBBB/*****"/>
  <all in="OWWWO/W***W/W***W/W***W/OBBBO" out="*****/*****/*****/*****/*WWW*"/>
  <all in="*******/*OWWWO*/*W***W*/*W*B*W*/*W***W*/*OWWWO*/*******" out="WWWWWWW/W*****W/W*WWW*W/W*WGW*W/W*WWW*W/W*****W/WWWWWWW"/>
  <all in="O" out="W"/>
  <prl in="GWWWG/WWWWW/WWWWW/WWWWW/GWWWG" out="BBBBB/BBBBB/BBBBB/BBBBB/BBBBB"/>
  <all in="G" out="W"/>
</sequence>


================================================
FILE: models/MultiHeadedWalk.xml
================================================
<sequence values="BRGW" origin="True">
  <sequence>
    <one in="RB" out="*G" steps="3"/>
    <all in="R" out="W"/>
    <all in="G" out="R"/>
  </sequence>
</sequence>


================================================
FILE: models/MultiHeadedWalkDungeon.xml
================================================
<sequence values="BRGW" origin="True">
  <markov>
    <sequence>
      <one in="RBB" out="*WG" steps="3"/>
      <all in="R" out="W"/>
      <all in="G" out="R"/>
    </sequence>
  </markov>
  <all in="BBB/BWB" out="***/*R*"/>
  <all in="RBR" out="WWW"/>
  <all in="R" out="W"/>
  <all in="BBB/BWB" out="***/*B*"/>
  <all in="WWW/WBW" out="***/*W*"/>
</sequence>


================================================
FILE: models/MultiSokoban8.xml
================================================
<sequence values="BRWI">
  <one in="BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB" out="BBBBBBBR/BWWBBBBR/BWBBBBBR/BWBBBBBB/BWBBBBBB/BWBBBBBB/BWWBIIII/BBBBIIII" symmetry="()"/>
  <all search="True" depthCoefficient="1.0">
    <rule in="RB" out="BR"/>
    <rule in="RWB" out="BRW"/>

    <observe value="I" from="B" to="W"/>
    <observe value="B" to="BR"/>
    <observe value="W" to="BR"/>
    <observe value="R" to="BR"/>
  </all>
</sequence>


================================================
FILE: models/MultiSokoban9.xml
================================================
<sequence values="BRWIA">
  <one in="BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB" out="BBBBBBBBB/BBBBBBBBB/BWWWWWBBR/BWBBBWBBR/BWBBBWBBR/BWBBBAIII/BWWWWAIII/BBBBBIIII/BBBBBIIII" symmetry="()"/>
  <all search="True" depthCoefficient="0.5">
    <rule in="RB" out="BR"/>
    <rule in="RWB" out="BRW"/>

    <observe value="I" from="B" to="W"/>
    <observe value="A" from="W" to="W"/>
    <observe value="B" to="BR"/>
    <observe value="W" to="BR"/>
    <observe value="R" to="BR"/>
  </all>
</sequence>


================================================
FILE: models/NestedGrowth.xml
================================================
<all values="BWAD" origin="True">
  <rule in="WB" out="WW"/>
  <rule in="WD" out="WW"/>
  <rule in="AW" out="AA"/>
  <rule in="DA" out="DD"/>
  <rule in="*WWW*/WWWWW/WWWWW/WWWWW/*WWW*" out="*WWW*/WWWWW/WWAWW/WWWWW/*WWW*"/>
  <rule in="*WWW*/WWWWW/WWWWW/WWWWW/*WWW*" out="*WWW*/WWWWW/WWWWW/WWWWW/*WWW*"/>

  <rule in="*AAA*/AAAAA/AAAAA/AAAAA/*AAA*" out="*AAA*/AAAAA/AADAA/AAAAA/*AAA*"/>
  <rule in="*AAA*/AAAAA/AAAAA/AAAAA/*AAA*" out="*AAA*/AAAAA/AAAAA/AAAAA/*AAA*"/>

  <rule in="*DDD*/DDDDD/DDDDD/DDDDD/*DDD*" out="*DDD*/DDDDD/DDWDD/DDDDD/*DDD*"/>
  <rule in="*DDD*/DDDDD/DDDDD/DDDDD/*DDD*" out="*DDD*/DDDDD/DDDDD/DDDDD/*DDD*"/>
</all>

<!--
From Imagegram: https://zaratustra.itch.io/imagegram
-->


================================================
FILE: models/NoDeadEnds.xml
================================================
<markov values="BRWA" origin="True">
  <one in="RBB" out="WAR"/>
  <one in="WBB" out="WAR"/>
  <all in="RBR" out="WAW"/>
  <all in="RBW" out="WAW"/>
</markov>

<!--
Generates a maze with loops and without dead ends.

Uses RegularSAWRestart model.

Used in ModernHouse in inner wall placement.
-->


================================================
FILE: models/Noise.xml
================================================
<sequence values="EWB">
  <prl in="E/*" out="W/*" symmetry="(x)"/>
  <prl in="*/W" out="*/B" symmetry="(x)"/>
  <one>
    <rule in="EB" out="EE"/>
    <rule in="WB" out="WW"/>
  </one>
</sequence>


================================================
FILE: models/NystromDungeon.xml
================================================
<sequence values="BPWRG" origin="True">
  <all in="PBB" out="**P" comment="draw a grid"/>
  <one in="PBPBPBPBP/BBBBBBBBB/PBPBPBPBP/BBBBBBBBB/PBPBPBPBP/BBBBBBBBB/PBPBPBPBP" out="WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW"/>
  <markov comment="generate corridors with MazeBacktracker">
    <one in="RBP" out="GGR"/>
    <one in="GGR" out="RWW"/>
    <one in="P" out="R"/>
  </markov>
  <one in="R" out="G" steps="1" comment="leave only one start"/>
  <all in="R" out="W" comment="forget other starts"/>
  <markov comment="connect components">
    <all in="GWW" out="**G"/>
    <one in="GBW" out="*WG"/>
  </markov>
  <one in="GBG" out="*W*" steps="5" comment="insert cycles"/>
  <!--<one in="WGBG/WW**" out="**W*/****" steps="5"/>-->
  <all in="G" out="W" comment="forget structure"/>
  <all in="BBB/BWB" out="BBB/BBB" comment="retract dead ends"/>
</sequence>

<!--
Generates a dungeon with rooms and corridors, containing a fixed amount of cycles.

Adaptation of http://journal.stuffwithstuff.com/2014/12/21/rooms-and-mazes/
Compare to implementations in conventional languages: https://github.com/munificent/rooms-and-mazes

For shorter versions that use connectivity patterns, see NystromKruskal and KruskalNystrom.
-->


================================================
FILE: models/OddScale.xml
================================================
<sequence values="BW" symmetry="()">
  <prl in="***/*B*/***" out="***/*W*/***"/>
  <prl in="W" out="B" p="0.5" steps="1"/>
  <map scale="2 2 1" values="BFA">
    <rule in="W" out="FAF/AAA/FAF"/>
  </map>
</sequence>

<!--
Notice that the scale doesn't coincide with the rule output size.

Useful for making rooms for regular dungeon generators.
-->


================================================
FILE: models/OddScale3D.xml
================================================
<sequence values="BW" symmetry="()">
  <prl in="***/***/*** ***/*B*/*** ***/***/***" out="***/***/*** ***/*W*/*** ***/***/***"/>
  <prl in="W" out="B" p="0.5" steps="1"/>
  <map scale="6 6 6" values="BADYWU" symmetry="()">
    <rule in="W" out="DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA/AAAAAAA DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD/AAAAAAA/DADADAD"/>
    <sequence symmetry="(xyz)" comment="">
      <all>
        <rule in="DB" out="Y*"/>
        <rule in="D*/*B" out="Y*/**"/>
      </all>
      <all in="D" out="A"/>
      <markov>
        <one in="WAY" out="WUW"/>
        <one in="Y" out="W"/>
      </markov>
      <all in="U" out="W"/>
    </sequence>
  </map>
</sequence>

<!--
After this scale you can run all kinds of algorithms on the surface. Used in SurfaceDungeon and CarmaTower.
-->


================================================
FILE: models/OpenCave.xml
================================================
<sequence values="DA">
  <prl in="***/*D*/***" out="***/*A*/***"/>
  <prl in="A" out="D" p="0.5" steps="1"/>
  <convolution neighborhood="Moore" periodic="True">
    <rule in="A" out="D" sum="5..8" values="D"/>
    <rule in="D" out="A" sum="5..8" values="A"/>
  </convolution>
</sequence>


================================================
FILE: models/OpenCave3D.xml
================================================
<sequence values="DA">
  <prl in="***/***/*** ***/*D*/*** ***/***/***" out="***/***/*** ***/*A*/*** ***/***/***"/>
  <prl in="A" out="D" p="0.5" steps="1"/>
  <convolution neighborhood="NoCorners">
    <rule in="A" out="D" sum="10..18" values="D"/>
    <rule in="D" out="A" sum="10..16" values="A"/>
  </convolution>
</sequence>


================================================
FILE: models/OrganicMechanic.xml
================================================
<sequence values="BGRKYEFUIP" origin="True">
  <one in="BB" out="KR" steps="12"/>
  <all>
    <rule in="KRB" out="BKR"/>
    <rule in="KR/*B" out="BK/*R"/>

    <rule in="GB" out="BG"/>
    <rule in="GI" out="BF"/>
    <rule in="F" out="Y"/>
    <rule in="YB" out="BY"/>
    <rule in="YU/B*" out="KR/E*"/>
    <rule in="E" out="G"/>
    <rule in="*B*/BRB/*B*" out="***/*U*/***"/>
    <rule in="*B*/BKB/*B*" out="***/*I*/***"/>

    <field for="G" on="B" to="I" recompute="True"/>
    <field for="Y" on="B" to="U" recompute="True"/>
    <field for="P" on="R" to="R" recompute="True"/>
  </all>
</sequence>

<!--
Standard crawlers wander around and break, but now there is a benevolent mechanic that repairs them.
-->


================================================
FILE: models/OrientedEscher.xml
================================================
<sequence values="BRW" origin="True">
  <prl in="B" out="W"/>
  <prl in="***/*W*/***" out="***/*B*/***"/>
  <wfc values="BODAWEU" tileset="OrientedEscher" periodic="True">
    <rule in="W" out="Empty"/>
    <rule in="R" out="T"/>
    <all>
      <rule in="O" out="B"/>
      <rule in="U" out="E"/>
    </all>
  </wfc>
</sequence>


================================================
FILE: models/PaintCompetition.xml
================================================
<sequence values="UYSN">
  <all>
    <rule in="U" out="S"/>
    <rule in="U" out="N"/>
  </all>
  <one in="S" out="U" steps="5"/>
  <one in="N" out="Y" steps="5"/>
  <all>
    <rule in="US" out="SU"/>
    <rule in="UN" out="SU"/>
    <rule in="YS" out="NY"/>
    <rule in="YN" out="NY"/>
    <field for="Y" to="S" on="N" recompute="True"/>
    <field for="U" to="N" on="S" recompute="True"/>
  </all>
</sequence>

<!--
Yellow creatures try to paint everything into yellow, blue try to paint everything into blue.
-->


================================================
FILE: models/ParallelGrowth.xml
================================================
<all values="BW" origin="True" in="WB" out="*W"/>


================================================
FILE: models/ParallelMazeGrowth.xml
================================================
<all values="BWA" origin="True" in="WBB" out="WAW"/>

<!--
Compare the generated mazes with the results of MazeGrowth.
-->


================================================
FILE: models/ParallelWalk.xml
================================================
<sequence values="BR">
  <one in="B" out="R" steps="24"/>
  <all in="RB" out="BR"/>
</sequence>


================================================
FILE: models/Partitioning.xml
================================================
<sequence values="BD" symmetry="(xy)">
  <all in="B" out="D"/>
  <wfc values="BCA" tileset="Partition">
    <rule in="D" out="Nothing|I|T"/>
    <sequence>
      <all in="AC" out="*A"/>
      <all in="C" out="B"/>
    </sequence>
  </wfc>
</sequence>


================================================
FILE: models/Percolation.xml
================================================
<sequence values="RUBDW">
  <prl in="*R" out="*U" symmetry="()"/>
  <prl in="U*" out="D*" symmetry="()"/>
  <prl in="D" out="B" p="0.4" steps="1"/>
  <path from="R" to="U" on="D" color="W"/>
</sequence>


================================================
FILE: models/PeriodicEscher.xml
================================================
<sequence values="BW">
  <all in="B" out="W"/>
  <all in="*****/*****/**W**/*****/*****" out="*****/*****/**B**/*****/*****"/>
  <wfc values="BWARGUI" tileset="Escher" periodic="True">
    <rule in="W" out="Empty"/>
    <sequence>
      <all>
        <rule in="ABA" out="*A*"/>
        <rule in="WBA" out="*A*"/>
      </all>
      <all symmetry="()">
        <rule in="RI" out="RB"/>
        <rule in="R/I" out="G/B"/>
        <rule in="R I" out="U B"/>
        <rule in="IR" out="BI"/>
        <rule in="I/R" out="B/I"/>
        <rule in="I R" out="B I"/>
      </all>
    </sequence>
  </wfc>
</sequence>


================================================
FILE: models/PillarsOfEternity.xml
================================================
<sequence values="BRW" symmetry="(xy)">
  <all in="B" out="W"/>
  <all in="***/*W*/***" out="***/*B*/***"/>
  <wfc values="BEAWDRF" outputValues="BWAE" tileset="OrientedStairs" periodic="True">
    <rule in="W" out="Empty"/>
    <all>
      <rule in="R" out="W"/>
      <rule in="A" out="W"/>
    </all>
    <all in="B" out="A"/>
    <all in="A *" out="B *"/>
    <all>
      <rule in="D B" out="D F"/>
      <rule in="F B" out="F F"/>
    </all>
    <all>
      <rule in="WF" out="*R"/>
      <rule in="F W" out="R *"/>
      <rule in="F A" out="R *"/>
      <rule in="F R" out="R B"/>
    </all>
    <all>
      <rule in="R" out="B"/>
      <rule in="A" out="B"/>
      <rule in="F" out="W"/>
      <rule in="D" out="W"/>
    </all>
  </wfc>
</sequence>


================================================
FILE: models/Push.xml
================================================
<sequence values="BWP">
  <one in="B" out="W" steps="120"/>
  <one in="B" out="P" steps="20"/>
  <all>
    <rule in="PB" out="BP"/>
    <rule in="PWB" out="BPW"/>
  </all>
</sequence>


================================================
FILE: models/PutColoredLs.xml
================================================
<markov values="BWRGU">
  <all>
    <rule in="RW" out="RR"/>
    <rule in="GW" out="GG"/>
    <rule in="UW" out="UU"/>
  </all>
  <!--<one in="W" out="R|G|U"/>-->
  <one>
    <rule in="W" out="R"/>
    <rule in="W" out="G"/>
    <rule in="W" out="U"/>
  </one>
  <one in="BBB*/BBB*/BBBB/BBBB/BBBB" out="BBB*/BWB*/BWBB/BWWB/BBBB"/>
</markov>


================================================
FILE: models/PutLs.xml
================================================
<all values="BW" in="BBB*/BBB*/BBBB/BBBB/BBBB" out="BBB*/BWB*/BWBB/BWWB/BBBB"/>


================================================
FILE: models/RainbowGrowth.xml
================================================
<one values="BROYGUIP" origin="True">
  <rule in="RB" out="RO"/>
  <rule in="OB" out="OY"/>
  <rule in="YB" out="YG"/>
  <rule in="GB" out="GU"/>
  <rule in="UB" out="UI"/>
  <rule in="IB" out="IP"/>
  <rule in="PB" out="PR"/>
</one>


================================================
FILE: models/RandomWalk.xml
================================================
<one values="BR" origin="True" in="RB" out="BR"/>


================================================
FILE: models/Rectangle.xml
================================================
<sequence values="BRW">
  <one in="B" out="R" steps="1"/>
  <one in="RB" out="WW"/>
  <one in="BBB/BWB" out="*W*/***" steps="5"/>
  <all>
    <rule in="WB" out="*W"/>
    <rule in="BB/WB" out="*W/**"/>
  </all>
</sequence>


================================================
FILE: models/RegularPath.xml
================================================
<sequence values="BAWRGY" origin="True">
  <all in="A*B" out="**A"/>
  <one in="A" out="R" steps="1"/>
  <one in="A" out="Y" steps="10"/>
  <all in="A" out="B"/>
  <markov>
    <one in="RBB" out="WWR">
      <observe value="G" from="B" to="R"/>
      <observe value="B" to="BW"/>
      <observe value="R" to="W"/>
    </one>
    <prl in="W" out="A"/>
    <one in="Y" out="G"/>
  </markov>
</sequence>


================================================
FILE: models/RegularSAW.xml
================================================
<one values="BRW" origin="True" in="RBB" out="WWR"/>

<!--
Compare the average length of the walk in 2d and 3d.
-->


================================================
FILE: models/RegularSAWRestart.xml
================================================
<markov values="BRWA" origin="True">
  <one in="RBB" out="WAR"/>
  <one in="WBB" out="WAR"/>
</markov>


================================================
FILE: models/River.xml
================================================
<sequence values="BWRUGE">
  <one in="B" out="W" steps="1"/>
  <one in="B" out="R" steps="1"/>
  <one>
    <rule in="RB" out="RR"/>
    <rule in="WB" out="WW"/>
  </one>
  <all in="RW" out="UU"/>
  <all>
    <rule in="W" out="B"/>
    <rule in="R" out="B"/>
  </all>
  <all in="UB" out="UU" steps="1"/>
  <all in="BU/UB" out="U*/**"/>
  <all in="UB" out="*G"/>
  <one in="B" out="E" steps="13"/>
  <one>
    <rule in="EB" out="*E"/>
    <rule in="GB" out="*G"/>
  </one>
</sequence>


================================================
FILE: models/Rosettes.xml
================================================
<sequence values="WBUKkAaNnOoYyI" origin="true">
    <prl in="***/*W*/***" out="***/*U*/***"/>
    <prl in="W" out="I"/>
    <prl in="U" out="W"/>
    <all in="WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW" out="WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWaWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW/WWWWWWWWW" steps="1"/>

    <!-- measure out some survey points as substitute for field max/min capping-->
    <all temperature="0" steps="10">
        <rule in="aW" out="aK"/>
        <rule in="KW" out="AK"/>
        <field for="K" from="a" on="WA" essential="False" recompute="True"/>
        <field for="A" from="a" on="KA" essential="False" recompute="True"/>
    </all>

    <all temperature="0" steps="1">
        <rule in="A" out="W"/>
        <rule in="K" out="A"/>
    </all>
    <markov>
        <!-- bootleg voronoi edges using field strengths, would need less handholding if W field could be given a static value -->
        <all steps="1">
            <rule in="W" out="K"/>
            <rule in="W" out="W"/>
            <field for="W" to="a" on="W" essential="False" recompute="True"/>
            <field for="K" to="BKUA" on="W" essential="False" recompute="True"/>
        </all>
        
        <!-- bootleg voronoi part two -->
        <convolution neighborhood="Moore" steps="2">
            <rule in="K" out="W" sum="1..8" values="a"/>
            <rule in="K" out="U" sum="1..8" values="W"/>
        </convolution>
        
        <!-- clean up the masking-->
        <all in="K" out="W" steps="1"/>
        <all in="K" out="W" steps="1"/>
        
        <all temperature="0" steps="1">
            <rule in="W" out="k"/>
            <rule in="k" out="W"/>
            <field for="k" to="a" on="Wk" essential="False" recompute="True"/>
            <field for="W" to="I" on="k" essential="False" recompute="True"/>
        </all>
        
        <all temperature="0" steps="2">
            <rule in="W" out="Y"/>
            <rule in="B" out="Y"/>
            <rule in="A" out="Y"/>
            <rule in="k" out="N"/>
            <rule in="a" out="N"/>
            <rule in="U" out="n"/>
        </all>
    </markov>
</sequence>


================================================
FILE: models/SAWRestart.xml
================================================
<markov values="BRW" origin="True">
  <one in="RB" out="WR"/>
  <one in="WB" out="WR"/>
</markov>

<!--
Saw it here: ....
-->


================================================
FILE: models/SeaVilla.xml
================================================
<sequence values="Bwy" symmetry="(xy)">
  <prl in="B" out="w"/>
  <prl in="w *" out="y *"/>
  <prl in="***/*y*/***" out="***/*B*/***"/>
  <wfc values="BaV OoYhSAWwRrlgvPpxbUuCcKkXGEFi" tileset="MarchingHills" overlap="-3">
    <rule in="w" out="Stone"/>
    <rule in="y" out="Empty"/>

    <prl in="BBBBB/BBBBB/BBBBB/BBBBB/BBBBB aBBBa/BBBBB/BBBBB/BBBBB/aBBBa" out="*****/*****/**Y**/*****/***** *****/*hah*/*aaa*/*hah*/*****"/>
    <prl in="BBBBB/BBBBB/BBBBB hBBBh/aBBBa/hBBBh" out="*****/**S**/***** *AAA*/*aaa*/*AAA*"/>
    <prl in="BBB/BBB/BBB hah/BBB/BBB" out="***/***/*S* ***/AaA/AaA"/>
    <prl in="aBBBa" out="*AaA*"/>
    <prl steps="1">
      <rule in="a B" out="* a"/>
      <rule in="h B" out="* a"/>
      <rule in="A B" out="* a"/>
    </prl>
    <prl comment="mark water">
      <rule in="Y * *" out="O * *"/>
      <rule in="S * *" out="W * *"/>
      <rule in="V * *" out="l * *"/>
    </prl>
    <prl>
      <rule in="Y" out="w"/>
      <rule in="S" out="w"/>
      <rule in="V" out="w"/>
    </prl>
    <prl>
      <rule in="O" out="Y"/>
      <rule in="W" out="S"/>
      <rule in="l" out="V"/>
    </prl>
    <prl in="***/*A*/***" out="***/*W*/***"/>
    <prl in="BwB/BBB ***/AaA" out="*u*/*** ***/***"/>
    <prl in="W" out="A"/>
    <markov comment="draw all possible bridges">
      <one in="YR/BB/*B/SB" out="*r/**/**/**" comment="cancel purposeless bridge"/>
      <one in="BYB/BRB/BBB/BSB BhB/BBB/BBB/AaA" out="***/*B*/***/*** ***/*a*/*a*/***" comment="connect"/>
      <one comment="continue">
        <rule in="BSB/BRB/BBB/BBB/BBB *a*/BBB/BBB/BBB/BBB" out="***/*B*/***/*Y*/*R* ***/*a*/*a*/*h*/***"/>
        <rule in="BYB/BRB/BBB/BBB/BBB *h*/BBB/BBB/BBB/BBB" out="***/*B*/***/*S*/*R* ***/*a*/*a*/*a*/***"/>
      </one>
      <one comment="retract">
        <rule in="BBB/BBB/BYB/BrB *a*/BaB/BhB/BBB" out="*r*/***/*B*/*B* *B*/*B*/*B*/***"/>
        <rule in="BBB/BBB/BSB/BrB *a*/BaB/BaB/BBB" out="*r*/***/*B*/*B* *B*/*B*/*B*/***"/>
      </one>
      <one in="R" out="r" comment="fail"/>
      <one in="BSB/BBB AaA/BBB" out="***/*R* ***/***" comment="start"/>
    </markov>
    <prl in="r" out="B"/>
    <all in="aaa/BBB BSB/BBB AaA/BaB" out="*r*/*** ***/*** ***/***" comment="ban stairs above bridges"/>
    <all in="YBBSBBY" out="*ii*ii*" comment="draw all possible paths"/>
    <all comment="draw stairs">
      <rule in="BBBBB YBBSB aaaaB aaaaB Y**Si" out="***** *ii** ***i* ***i* *****"/>
      <rule in="BBBBB YBBSB aaaaB aaaaB YBBSB aaaaB aaaaB Y**Si" out="***** *ii** ***i* ***i* ***** ***i* ***i* *****"/>
      <rule in="BBBBB YBBSB aaaaB aaaaB YBBSB aaaaB aaaaB YBBSB aaaaB aaaaB Y**Si" out="***** *ii** ***i* ***i* ***** ***i* ***i* ***** ***i* ***i* *****"/>
      <rule in="BBBBB YBBSB aaaaB aaaaB wBBw*" out="***** *ii** ***i* ***i* *****"/>
    </all>
    <all in="*BB* uBBw" out="**** ***u" comment="find external descents"/>
    <all comment="prepare endpoints for the big cycle">
      <rule in="iYi" out="*x*"/>
      <rule in="Yi/i*" out="x*/**"/>
    </all>
    <prl>
      <rule in="r" out="a"/>
      <rule in="Y" out="o"/>
      <rule in="S" out="o"/>
      <rule in="a i" out="* F"/>
      <rule in="a x" out="* b"/>
    </prl>
    <one in="x" out="R" steps="1"/>
    <one steps="1">
      <rule in="x" out="l"/>
      <field for="l" from="R" on="ioxFb"/> не уверен насчет Fb
    </one>
    <one in="R" out="x"/>
    <markov>
      <one in="lW" out="R*" symmetry="(xyz)"/>
      <path from="x" to="l" on="iox" color="W" longest="True"/>
    </markov>
    <one in="Wx" out="Wl" symmetry="(xyz)"/>
    <prl>
      <rule in="F" out="i"/>
      <rule in="b" out="x"/>
    </prl>
    <markov>
      <one in="Sl" out="SW" symmetry="(xyz)"/>
      <path from="R" to="l" on="iox" color="S"/>
    </markov>
    <all>
      <rule in="lB" out="*l"/>
      <rule in="lW" out="*l"/>
    </all>
    <prl>
      <rule in="S" out="W"/>
      <rule in="x" out="o"/>
    </prl>
    <one in="RWW*" out="xpPR" symmetry="(xyz)"/>
    <prl in="R" out="x"/>
    <all comment="remove stairs incompatible with paths">
      <rule in="iio aai aai **x" out="BB* **a **a ***"/>
      <rule in="iio aai aai BBo aai aai **x" out="BB* **a **a *** **a **a ***"/>
      <rule in="iio aai aai BBo aai aai BBo aai aai **x" out="BB* **a **a *** **a **a *** **a **a ***"/>
    </all>
    <path from="x" to="u" on="io" color="W" comment="connect to water"/>
    <one in="W" out="S" steps="1"/>
    <one in="SW" out="SS" symmetry="(xyz)"/>
    <all symmetry="(xyz)">
      <rule in="uWWW" out="*iio"/>
      <rule in="oWWW" out="*iio"/>
      <rule in="oWWx" out="*ii*"/>
      <rule in="uSSS" out="*Ppu"/>
      <rule in="uSSx" out="xPp*"/>
    </all>
    <prl in="u * *" out="x * *"/>
    <all comment="fail on wrong stair turn">
      <rule in="gB" out="*g"/>
      <rule in="xPp p** P** xpP" out="ggg ggg ggg ggg"/>
      <rule in="xpP P** p** xPp" out="ggg ggg ggg ggg"/>
      <rule in="xPp p** P** *** p** P** xpP" out="ggg ggg ggg ggg ggg ggg ggg"/>
      <rule in="xpP P** p** *** P** p** xPp" out="ggg ggg ggg ggg ggg ggg ggg"/>
      <rule in="xPp p** P** *** p** P** *** p** P** xpP" out="ggg ggg ggg ggg ggg ggg ggg ggg ggg ggg"/>
      <rule in="xpP P** p** *** P** p** *** P** p** xPp" out="ggg ggg ggg ggg ggg ggg ggg ggg ggg ggg"/>
    </all>
    <all comment="delete unused descents">
      <rule in="iio aai aai BBu" out="BB* **a **a ***"/>
      <rule in="iio aai aai BBw" out="BB* **a **a ***"/>
    </all>
    <prl>
      <rule in="BxB AaA" out="*b* ***"/>
      <rule in="BxB B*B" out="*b* ***"/>
      <rule in="***/*o*/*** hah/aaa/hah" out="***/*O*/*** ***/***/***"/>
      <rule in="o h" out="O *"/>
    </prl>
    <markov comment="build trees to prepare key placement">
      <one>
        <rule in="iYF" out="r**"/>
        <rule in="iY/*F" out="r*/**"/>
      </one>
      <one in="F" out="i"/>
      <one>
        <rule in="YiioiiO" out="*SS*SSY"/>
        <rule in="Yiio*** ***i*** ***i*** ***oiiO" out="*SS**** ***S*** ***S*** ****SSY"/>
        <rule in="***oiiO ***i*** ***i*** Yiio***" out="****SSY ***S*** ***S*** *SS****"/>
        <rule in="Yiio*** ***i*** ***i*** ***o*** ***i*** ***i*** ***oiiO" out="*SS**** ***S*** ***S*** ******* ***S*** ***S*** ****SSY"/>
        <rule in="***oiiO ***i*** ***i*** ***o*** ***i*** ***i*** Yiio***" out="****SSY ***S*** ***S*** ******* ***S*** ***S*** *SS****"/>
        <rule in="Yiio*** ***i*** ***i*** ***o*** ***i*** ***i*** ***o*** ***i*** ***i*** ***oiiO" out="*SS**** ***S*** ***S*** ******* ***S*** ***S*** ******* ***S*** ***S*** ****SSY"/>
        <rule in="***oiiO ***i*** ***i*** ***o*** ***i*** ***i*** ***o*** ***i*** ***i*** Yiio***" out="****SSY ***S*** ***S*** ******* ***S*** ***S*** ******* ***S*** ***S*** *SS****"/>
      </one>
      <one in="xPpbP/i****" out="Y**c*/F****"/>
    </markov>
    <all in="pY" out="*C"/>
    <path from="Y" to="C" on="SoCY" color="l" longest="True"/>
    <prl>
      <rule in="S" out="i"/>
      <rule in="r" out="i"/>
    </prl>
    <one in="Yl" out="K*" steps="1"/>
    <one in="Yl" out="X*" steps="1"/>
    <one in="Yl" out="R*" steps="1"/>
    <all symmetry="(xyz)">
      <rule in="Klll" out="***K"/>
      <rule in="KllC" out="***k"/>
      <rule in="Xlll" out="***X"/>
      <rule in="XllC" out="***G"/>
      <rule in="Rlll" out="***R"/>
      <rule in="RllC" out="***r"/>
      <rule in="Ylll" out="*iiY"/>
      <rule in="YllC" out="*ii*"/>
      <rule in="kPpc" out="o**k"/>
      <rule in="GPpc" out="o**G"/>
      <rule in="rPpc" out="o**r"/>
    </all>
    <all symmetry="(xyz)">
      <rule in="lKl" out="*o*"/>
      <rule in="lK/*l" out="*o/**"/>
      <rule in="lXl" out="*o*"/>
      <rule in="lX/*l" out="*o/**"/>
      <rule in="lRl" out="*o*"/>
      <rule in="lR/*l" out="*o/**"/>
    </all>
    <prl>
      <rule in="BPB BaB" out="*** *E*"/>
      <rule in="BpB BaB" out="*** *E*"/>
      <rule in="BbB BaB" out="*** *E*"/>
    </prl>
    <prl>
      <rule in="P" out="l"/>
      <rule in="p" out="l"/>
      <rule in="C" out="o"/>
      <rule in="c" out="o"/>
      <rule in="x" out="o"/>
      <rule in="b" out="o"/>
      <rule in="Y" out="o"/>
    </prl>
    <prl>
      <rule in="***/*o*/*** hah/aaa/hah" out="***/*Y*/*** ***/***/***"/>
      <rule in="o h" out="Y *"/>
    </prl>
    <all>
      <rule in="Ylll" out="***o"/>
      <rule in="olll" out="***Y"/>
      <rule in="o l l l" out="* * * o"/>
      <rule in="l l l o" out="o * * *"/>
    </all>
    <prl in="Yl" out="O*"/>
    <union symbol="6" values="PY"/>
    <markov comment="mark open areas">
      <all>
        <rule in="Piioii6" out="*SS*SSP"/>
        <rule in="Piio*** ***i*** ***i*** ***oii6" out="*SS**** ***S*** ***S*** ****SSP"/>
        <rule in="***oii6 ***i*** ***i*** Piio***" out="****SSP ***S*** ***S*** *SS****"/>
        <rule in="Piio*** ***i*** ***i*** ***o*** ***i*** ***i*** ***oii6" out="*SS**** ***S*** ***S*** ******* ***S*** ***S*** ****SSP"/>
        <rule in="***oii6 ***i*** ***i*** ***o*** ***i*** ***i*** Piio***" out="****SSP ***S*** ***S*** ******* ***S*** ***S*** *SS****"/>
        <rule in="Piio*** ***i*** ***i*** ***o*** ***i*** ***i*** ***o*** ***i*** ***i*** ***oii6" out="*SS**** ***S*** ***S*** ******* ***S*** ***S*** ******* ***S*** ***S*** ****SSP"/>
        <rule in="***oii6 ***i*** ***i*** ***o*** ***i*** ***i*** ***o*** ***i*** ***i*** Piio***" out="****SSP ***S*** ***S*** ******* ***S*** ***S*** ******* ***S*** ***S*** *SS****"/>
      </all>
      <all in="P" out="p"/>
      <one in="O" out="P"/>
    </markov>
    <prl>
      <rule in="p" out="o"/>
      <rule in="i" out="B"/>
    </prl>
    <all symmetry="(xyz)">
      <rule in="ullo" out="***O"/>
      <rule in="Ollo" out="***O"/>
      <rule in="OSSo" out="***O"/>
    </all>
    <one steps="1" comment="place the goal">
      <rule in="***/*o*/*** hah/aaa/hah" out="***/*U*/*** ***/***/***"/>
      <field for="U" from="u" on="UKXRkGrSaOol"/>
    </one>
    <one comment="detect trivial levels">
      <rule in="BBB/BUB/BBB" out="***/*Y*/***"/>
      <rule in="* Y" out="Y *"/>
      <rule in="Y*" out="*Y"/>
    </one>
    <prl in="O" out="o"/>
    <union symbol="?" values="aBhA"/>
    <all comment="retract dead ends">
      <rule in="????/????/???? ????/?oSS/???? ????/????/????" out="****/****/**** ****/*oBB/**** ****/****/****"/>
      <rule in="???/???/??? ???/?o?/??? ???/?S?/??? ???/?S?/???" out="***/***/*** ***/*o*/*** ***/*B*/*** ***/*B*/***"/>
      <rule in="???/?S?/??? ???/?S?/??? ???/?o?/??? ???/???/???" out="***/*B*/*** ***/*B*/*** ***/*o*/*** ***/***/***"/>
    </all>
    <all in="oSSoSSo/S*****S/S*****S/o**V**o/S*****S/S*****S/oSSoSSo" out="*******/*PPPPP*/*PPPPP*/*PPvPP*/*PPPPP*/*PPPPP*/*******" comment="detect rooms"/>
    <all comment="repair removed stairs">
      <rule in="ABA" out="*a*"/>
      <rule in="aBa" out="*a*"/>
    </all>
    <prl>
      <rule in="l" out="i"/>
      <rule in="S" out="i"/>
      <rule in="V" out="o"/>
      <rule in="u" out="w"/>
    </prl>
    <prl in="o i i o i i o i i o" out="O * * O * * O * * O" comment="mark triple ladders"/>
    <prl in="o i i o i i o" out="O * * O * * O" comment="mark double ladders"/>
    <all comment="delete unused bridges">
      <rule in="hB" out="a*"/>
      <rule in="BBB/BoB/BBB BBB/aaa/BBB" out="***/*B*/*** ***/BBB/***"/>
      <rule in="EaE" out="*E*"/>
    </all>

    <union symbol="!" values="Bi"/>
    <map scale="5/3 5/3 6/3" values="BaWUyogEpTCOYMAPeDFiKkXGRrwxb" folder="SeaVilla">
      <rule in="BBB/BBB/BBB BBB/BoB/BBB aaB/aaB/BBB" fout="TopOut" legend="Ea*g"/>
      <rule in="BBB/BBB/BBB BBB/BoB/BBB aaa/aaa/aaB" fout="TopIn" legend="Ea*g"/>
      <rule in="BBB/BBB/BBB BBB/BoB/BBB aaB/aaB/aaB" fout="TopWall" legend="Ea*g"/>
      <rule in="BBB/BBB/BBB BBB/BoB/BBB aaa/aaa/aaa" fout="TopStone" legend="E*g"/>

      <rule in="aaB/aaB/BBB BBB/BoB/BBB aaB/aaB/BBB" fout="Out" legend="E*a"/>
      <rule in="aaa/aaa/aaB BBB/BoB/BBB aaa/aaa/aaB" fout="In" legend="Ea*"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB aaB/aaB/aaB" fout="Wall" legend="E*a"/>
      <rule in="aaa/aaa/aaa BBB/BoB/BBB aaa/aaa/aaa" fout="Stone" legend="Ea*"/>

      <rule in="BBB/aaB/aaB BBB/BoB/BBB aaa/aaa/aaB" fout="OutIn" legend="Ea*"/>
      <rule in="aaB/aaB/BBB BBB/BoB/BBB aaB/aaB/aaB" fout="OutWall" legend="E*a"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB aaa/aaa/aaB" fout="OutIn" legend="Ea*"/>
      <rule in="aaa/aaa/aaB BBB/BoB/BBB aaa/aaa/aaa" fout="Stone" legend="Ea*"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB aaa/aaa/aaa" fout="Stone" legend="Ea*"/>
      <rule in="aaB/aaB/BBB BBB/BoB/BBB aaa/aaa/aaa" fout="Stone" legend="Ea*"/>

      <rule in="BBB/BBB/BBB BBB/BoB/BBB hah/aaa/hah" fout="TopCross" legend="Eg*"/>
      <rule in="aaa/aaa/aaa BBB/BoB/BBB hah/aaa/hah" fout="Cross" legend="P*"/>

      <rule in="BBB/BBB/BBB BBB/ioB/BBB AAB/aiB/AAB" fout="StairsTop" legend="*"/>
      <rule in="aaB/aiB/aaB BBB/Boi/BBB AAA/aaa/AAA" fout="StairsBottom" legend="EabW*e"/>
      <rule in="BBB/BBB/BBB BBB/iOB/BBB AAB/aiB/AAB" fout="LadderTop" legend="E*W"/>
      <rule in="aaB/aiB/aaB BBB/BOi/BBB AAA/aaa/AAA" fout="LadderBottom" legend="EaW*D"/>
      <rule in="aaB/aiB/aaB BBB/BOB/BBB AAB/aiB/AAB" fout="Ladder" legend="EaD*"/>
      <rule in="aaB/aiB/aaB BBB/BwB/BBB AAA/aaa/AAA" fout="Pier" legend="yUw*"/>

      <rule in="BBB/BBB/BBB BBB/BoB/BBB AAB/aaB/AAB" fout="TopEdge" legend="Ex*ag"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB AAB/aaB/AAB" fout="Edge" legend="E*"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB AAA/aaa/AAA" fout="Dir" legend="Ea*"/>
      <rule in="BBB/BBB/BBB BBB/BoB/BBB AAA/aaa/AAA" fout="TopDir" legend="E*g"/>
      <rule in="aaa/aaa/aaa BBB/BoB/BBB AAA/aaa/AAA" fout="Dir" legend="Ea*"/>

      <rule in="BBB/BBB/BBB BBB/BwB/BBB aaa/aaa/aaa" fout="Water" legend="yU*"/>
      <rule in="BBB/BBB/BBB BBB/BwB/BBB hah/aaa/hah" fout="Water" legend="yU*"/>
      <rule in="BBB/BBB/BBB BBB/BwB/BBB AAA/aaa/AAA" fout="Water" legend="yU*"/>
      <rule in="aaB/aaB/aaB BBB/BwB/BBB AAA/aaa/AAA" fout="Water" legend="yU*"/>
      <rule in="aaB/aaB/aaB BBB/BwB/BBB aaa/aaa/aaa" fout="WaterWall" legend="yaU*"/>
      <rule in="aaa/aaa/aaB BBB/BwB/BBB aaa/aaa/aaa" fout="WaterWall" legend="yaU*"/>
      <rule in="aaB/aaB/BBB BBB/BwB/BBB aaa/aaa/aaa" fout="WaterWall" legend="yaU*"/>
      <rule in="aaa/aaa/aaa BBB/BwB/BBB aaa/aaa/aaa" fout="WaterWall" legend="yaU*"/>
      <rule in="aaa/aaa/aaa BBB/BwB/BBB hah/aaa/hah" fout="Water" legend="yU*"/>
      <rule in="aaa/aaa/aaa BBB/BwB/BBB AAA/aaa/AAA" fout="Water" legend="yU*"/>

      <rule in="BBB/BBB/BBB BBB/ioi/BBB AAA/aaa/AAA" fout="Line" legend="EW*"/>
      <rule in="aaa/aaa/aaa BBB/ioi/BBB AAA/aaa/AAA" fout="Line" legend="EW*"/>
      <rule in="aaB/aaB/aaB BBB/ioi/BBB AAA/aaa/AAA" fout="Line" legend="EW*"/>
      <rule in="BBB/BBB/BBB B*B/io*/B*B hah/aaa/hah" fout="CrossX" legend="EW*"/>
      <rule in="aaa/aaa/aaa B*B/io*/B*B hah/aaa/hah" fout="CrossX" legend="EW*"/>

      <rule in="***/***/*** PPP/PvP/PPP aaa/aaa/aaa" fout="Room" legend="T*"/>
      <rule in="***/***/*** PiB/io!/B!B hah/aaa/hah" fout="RoomOut" legend="TaWE*"/>
      <rule in="***/***/*** PiP/ioi/PiB hah/aaa/hah" fout="RoomIn" legend="TaW*"/>
      <rule in="***/***/*** PiB/ioi/BiP hah/aaa/hah" fout="RoomDouble" legend="TaW*"/>
      <rule in="***/***/*** PiB/io!/PiB hah/aaa/hah" fout="RoomWall" legend="TaW*"/>
      <rule in="***/***/*** PiP/ioi/PiP hah/aaa/hah" fout="Room" legend="T*"/>
      <rule in="***/***/*** PiP/PoP/PiP AaA/AaA/AaA" fout="Room" legend="T*"/>
      <rule in="***/***/*** PiB/PoB/PiB AaA/AaA/AaA" fout="RoomWall" legend="TaW*"/>

      <rule in="BBB/BBB/BBB BBB/ioi/BBB BBB/aaa/BBB" fout="Line" legend="EW*"/>
      <rule in="BBB/BBB/BBB BBB/ioi/BBB BBB/EEE/BBB" fout="BridgeWood" legend="*o"/>
      <rule in="BBB/BBB/BBB BBB/ioi/BBB AAB/aaa/AAB" fout="Line" legend="EW*"/>
      <rule in="aaB/aaB/aaB BBB/ioi/BBB AAB/aaa/AAB" fout="Line" legend="EW*"/>
      <rule in="BBB/BBB/BBB BBB/BoB/BBB AAB/aaa/AAB" fout="TopEdge" legend="Ex*ag"/>
      <rule in="aaB/aaB/aaB BBB/BoB/BBB AAB/aaa/AAB" fout="Edge" legend="E*"/>
      <rule in="BBB/BBB/BBB BBB/ioi/BBB AAB/aaE/AAB" fout="TopContactWood" legend="Eo*W"/>
      <rule in="aaB/aaB/aaB BBB/ioi/BBB AAB/aaE/AAB" fout="ContactWood" legend="Eo*W"/>

      <rule in="***/***/*** ***/iU*/*** ***/***/***" fout="Goal" legend="EW*C"/>
      <rule in="***/***/*** BBB/BKi/BBB ***/***/***" fout="KeyK" legend="EW*KOM"/>
      <rule in="***/***/*** BBB/BXi/BBB ***/***/***" fout="KeyL" legend="EW*XOM"/>
      <rule in="***/***/*** BBB/BRi/BBB ***/***/***" fout="KeyR" legend="EW*ROM"/>
      <rule in="***/***/*** BBB/iki/BBB ***/***/***" fout="LockK" legend="EW*kY"/>
      <rule in="***/***/*** BBB/iGi/BBB ***/***/***" fout="LockL" legend="EW*GY"/>
      <rule in="***/***/*** BBB/iri/BBB ***/***/***" fout="LockR" legend="EW*rY"/>

        <one file="DrawPier" legend="BowaEW"/>
        <all comment="finalize pier">
          <rule in="o U" out="* o"/>
          <rule in="o y" out="* o"/>
        </all>
        <prl comment="complete roads">
          <rule in="WEW" out="*W*"/>
          <rule in="WEB BBW" out="*W* ***"/>
        </prl>
        <prl comment="fill some gaps">
          <rule in="aBa" out="*a*"/>
          <rule in="aEa" out="*a*"/>
          <rule in="DBa" out="*a*"/>
          <rule in="a B a" out="* a *"/>
          <rule in="a B E" out="* a *"/>
          <rule in="a E" out="* a"/>
          <rule in="EaE *B* *U*" out="*** *a* ***"/>
        </prl>
        <prl comment="fill stair gaps">
          <rule in="aBe" out="*a*"/>
          <rule in="aUe" out="*a*"/>
        </prl>
        <prl in="e" out="B" comment="finalize stairs"/>
        <all>
          <rule in="PE" out="*P" comment="mark redundant floors"/>
          <rule in="a U" out="* a"/>
          <rule in="a y" out="* a"/>
        </all>
        <prl in="P" out="B"/>
        <prl comment="remove redundant walls">
          <rule in="BBB BaB BaB BaB BaB BaB *a*" out="*** *B* *B* *B* *B* *B* *E*"/>
          <rule in="BaB BaB BaB BaB BaB BaB BBB" out="*B* *B* *B* *B* *B* *B* ***"/>
        </prl>
        <all comment="continue columns above rooms">
          <rule in="aaa/aaa/aaa BBB/BBB/BBB" out="***/***/*** aaa/aaa/aaa"/>
          <rule in="aaa/aaa/aaa TTT/TTT/TTT" out="***/***/*** aaa/aaa/aaa"/>
        </all>
        <union symbol="?" values="BaKXRkGr"/>
        <all in="??g??" out="**B**" comment="remove thin grass"/>
        <all in="BBYBYBYB" out="*Y*Y*Y*Y" comment="finalize doors"/>
        <prl in="Y E" out="* Y"/>
        <all>
          <rule in="YE" out="*a"/>
          <rule in="Y*/*E" out="**/*a"/>
        </all>
        <union symbol="@" values="aEW"/>
        <prl symmetry="(xyz)">
          <rule in="@B" out="*A"/>
          <rule in="@*/*B" out="**/*A"/>
        </prl>
        <markov>
          <one>
            <rule in="pK" out="*p"/>
            <rule in="pk" out="*p"/>
          </one>
          <path from="K" to="k" on="A" color="p" inertia="True"/>
        </markov>
        <markov>
          <one>
            <rule in="pX" out="*p"/>
            <rule in="pG" out="*p"/>
          </one>
          <path from="X" to="G" on="A" color="p" inertia="True"/>
        </markov>
        <markov>
          <one>
            <rule in="pR" out="*p"/>
            <rule in="pr" out="*p"/>
          </one>
          <path from="R" to="r" on="A" color="p" inertia="True"/>
        </markov>
        <prl>
          <rule in="A" out="B"/>
          <rule in="k" out="B"/>
          <rule in="G" out="B"/>
          <rule in="r" out="B"/>
          <rule in="O p" out="* O"/>
          <rule in="b a" out="* E"/>
          <rule in="aax aBB aBB" out="**a *aa *a*"/>
        </prl>
        <prl comment="final colors">
          <rule in="i" out="E"/>
          <rule in="F" out="a"/>
          <rule in="D" out="a"/>
          <rule in="b" out="a"/>
          <rule in="x" out="a"/>
        </prl>
    </map>

  </wfc>
</sequence>


================================================
FILE: models/SelectLargeCaves.xml
================================================
<sequence values="DARG">
  <prl in="***/*D*/***" out="***/*A*/***"/>
  <prl in="A" out="D" p="0.435" steps="1"/>
  <convolution neighborhood="Moore">
    <rule in="A" out="D" sum="5..8" values="D"/>
    <rule in="D" out="A" sum="6..8" values="A"/>
  </convolution>
  <all in="AD/DA" out="DD/DA"/>
  <markov>
    <sequence>
      <one in="A" out="R" steps="1"/>
      <one in="RA" out="*R" steps="200"/>
      <all in="RA" out="GG"/>
      <all>
        <rule in="GR" out="*G"/>
        <rule in="GA" out="*G"/>
      </all>
    </sequence>
  </markov>
</sequence>


================================================
FILE: models/SelectLongKnots.xml
================================================
<sequence values="BRW">
  <prl in="B" out="R"/>
  <prl in="***/***/*** ***/*R*/*** ***/***/***" out="***/***/*** ***/*W*/*** ***/***/***"/>
  <wfc values="BWYU" tileset="Knots3D" tiles="Knots3D/3">
    <rule in="R" out="Empty"/>
    <rule in="W" out="Line|Turn|Empty"/>
    <markov>
      <sequence>
        <one in="W" out="Y" steps="1"/>
        <all in="YW" out="YY" steps="60"/>
        <all>
          <rule in="YW" out="UU"/>
          <rule in="UY" out="UU"/>
          <rule in="UW" out="UU"/>
        </all>
      </sequence>
    </markov>
  </wfc>
</sequence>


================================================
FILE: models/SelfAvoidingWalk.xml
================================================
<one values="BRW" origin="True" in="RB" out="WR"/>

<!--
Compare the average length of the walk in 2d and 3d.
-->


================================================
FILE: models/SequentialSnake.xml
================================================
<sequence values="BWEPRUG" origin="True">
  <one in="WBB" out="PER"/>
  <one in="RBB" out="EER" steps="10"/>
  <markov>
    <one>
      <rule in="RBB" out="GGU"/>
      <rule in="EEG" out="GGG"/>
      <rule in="PEG" out="BBP"/>
    </one>
    <all>
      <rule in="G" out="E"/>
      <rule in="U" out="R"/>
    </all>
    <all>
      <rule in="R" out="P"/>
      <rule in="P" out="R"/>
    </all>
  </markov>
</sequence>

<!--
Looks like a hack at first, but then this is exactly how many real noodle-like organisms move! Because in MJ, like the real world, only local interactions are allowed.
-->


================================================
FILE: models/SequentialSokoban.xml
================================================
<sequence values="BRWIYAGD">
  <one in="B" out="R" steps="1"/>
  <one in="BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB" out="******/******/**II**/**II**/******/******" steps="1"/>
  <one in="BBB/BBB/BBB" out="***/*Y*/***" steps="4"/>
  <markov>
    <one search="True">
      <rule in="RB" out="BR"/>
      <rule in="RWB" out="BRW"/>
      <rule in="RWD" out="BRA"/>

      <observe value="B" to="BR"/>
      <observe value="R" to="BR"/>
      <observe value="W" to="BR"/>
      <observe value="G" from="D" to="A"/>
    </one>
    <one in="Y" out="W" steps="1"/>
    <one in="I" out="G" steps="1"/>
  </markov>
</sequence>


================================================
FILE: models/Sewers.xml
================================================
<sequence values="BC">
  <all in="***/*B*/***" out="***/*C*/***"/>
  <wfc sample="Sewers" n="3" values="BnyN">
    <rule in="B" out="B|y"/>
    <markov>
      <one in="Nn" out="*N"/>
      <path from="N" to="n" on="B" color="N" inertia="True"/>
      <path from="N" to="n" on="y" color="N" inertia="True"/>
      <one in="n" out="N"/>
    </markov>
  </wfc>
</sequence>


================================================
FILE: models/SmartSAW.xml
================================================
<sequence values="BRDYGWEUN" origin="True">
  <union symbol="?" values="BD"/>
  <union symbol="_" values="BN"/>
  <all>
    <rule in="RBB" out="**D"/>
    <rule in="DBB" out="**D"/>
  </all>
  <markov>
    <markov>
      <markov>
        <one in="Y_D" out="UEG"/>
        <one in="YWW" out="DNR"/>
      </markov>
      <all in="G_D" out="*EG"/>
      <markov>
        <one in="RBD" out="WWY"/>
        <one in="RWW" out="DNR"/>
      </markov>
      <sequence>
        <one in="**D/**_/WWU" out="***/***/RND"/>
        <all>
          <rule in="*_*/_G_" out="***/*D*"/>
          <rule in="*?*/?E?" out="***/*B*"/>
          <rule in="*_*/_U_" out="***/*R*"/>
        </all>
      </sequence>
    </markov>
    <prl in="N" out="B"/>
  </markov>
</sequence>

<!--
I was trying to implement depth-first search with early exit in MJ, and made this.

It goes much further than the naive self-avoiding walk.
-->


================================================
FILE: models/SmarterDigger.xml
================================================
<markov values="WRB" origin="True">
  <one in="RW" out="BR"/>
  <path from="R" to="W" on="B" color="W"/>
</markov>

<!--
For an alternative formulaion using fields, replace path block with this:

<one in="RB" out="BR">
  <field for="R" on="B" to="W" recompute="False"/>
</one>
-->


================================================
FILE: models/SmoothTrail.xml
================================================
<sequence values="BRW" origin="True">
  <one steps="3000">
    <rule in="RB" out="WR"/>
    <rule in="RW" out="WR"/>
  </one>
  <one in="R" out="W"/>
  <all>
    <rule in="WB/BW" out="WB/WW"/>
    <rule in="BBB/BWB" out="***/*B*"/>
  </all>
</sequence>


================================================
FILE: models/Snake.xml
================================================
<sequence values="BDRUGEPCW" origin="True">
  <all in="DBB" out="**D"/>
  <one in="BDB/BBB/BDB" out="***/PGR/***" steps="1"/>
  <!--<one in="BDB/BBB/BDB BBB/BBB/BBB BDB/BBB/BDB" out="***/***/*** ***/PGR/*** ***/***/***" steps="1" d="3"/>-->
  <markov>
    <one>
      <rule in="RDW" out="GGR"/>
      <rule in="RDD" out="EEU"/>
      <rule in="GGE" out="EEE"/>
      <rule in="PGE" out="BBC"/>
    </one>
    <all>
      <rule in="E" out="G"/>
      <rule in="U" out="R"/>
      <rule in="C" out="P"/>
    </all>
    <path from="R" to="W" on="B" color="D" inertia="True"/>
    <one in="DBD/BBB/DBD" out="***/*W*/***"/>
    <!--<one in="DBD/BBB/DBD BBB/BBB/BBB DBD/BBB/DBD" out="***/***/*** ***/*W*/*** ***/***/***" d="3"/>-->
  </markov>
</sequence>


================================================
FILE: models/SnellLaw.xml
================================================
<sequence values="BUGIAWSR" origin="True">
  <all in="UB" out="*U" symmetry="(x)"/>
  <prl in="U*" out="G*" symmetry="()"/>
  <prl in="*G" out="*I" symmetry="()"/>
  <all symmetry="(x)">
    <rule in="U/B" out="B/U"/>
    <rule in="B/G" out="G/B"/>
    <rule in="IB" out="*I"/>
  </all>
  <all in="I/B" out="*/I" symmetry="()"/>
  <one>
    <rule in="U**/**I" out="A**/**S"/>
    <rule in="S" out="U"/>
    <rule in="U**/**B" out="A**/**R"/>
    <rule in="R**/**B" out="W**/**R"/>

    <observe value="G" from="B" to="R"/>
    <observe value="U" to="A"/>
    <observe value="B" to="BW"/>
    <observe value="I" to="IA"/>
  </one>
  <one in="R" out="W"/>
</sequence>


================================================
FILE: models/SoftPath.xml
================================================
<sequence values="BADYUGRW" origin="True">
  <all>
    <rule in="ABB" out="**D"/>
    <rule in="DBB" out="**D"/>
  </all>
  <one in="D" out="Y" steps="1" temperature="20.0">
    <field for="Y" from="A" on="BD"/>
  </one>
  <one in="D" out="G" steps="1" temperature="20.0">
    <field for="G" from="Y" on="BD"/>
  </one>
  <prl>
    <rule in="D" out="B"/>
    <rule in="A" out="B"/>
  </prl>
  <one temperature="2.0">
    <rule in="YBB" out="UWR"/>
    <rule in="RBB" out="WWR"/>
    <rule in="RBG" out="WWG"/>
    <field for="R" to="G" on="BR"/>
  </one>
</sequence>

<!--
Similar endpoint initialization is used in SeaVilla for the main path.
-->


================================================
FILE: models/SokobanLevel1.xml
================================================
<sequence values="BRWDI">
  <one file="Sokoban1" legend="BDWIR" symmetry="()"/>
  <one search="True">
    <rule in="RB" out="BR"/>
    <rule in="RWB" out="BRW"/>

    <observe value="I" from="B" to="W"/>
    <observe value="B" to="BR"/>
    <observe value="W" to="BR"/>
    <observe value="R" to="BR"/>
  </one>
</sequence>


================================================
FILE: models/SokobanLevel2.xml
================================================
<sequence values="BRWDIA">
  <one file="Sokoban2" legend="BIWARD" symmetry="()"/>
  <one search="True" depthCoefficient="1.0">
    <rule in="RB" out="BR"/>
    <rule in="RWB" out="BRW"/>

    <observe value="I" from="B" to="W"/>
    <observe value="A" from="W" to="W"/>
    <observe value="B" to="BR"/>
    <observe value="W" to="BR"/>
    <observe value="R" to="BR"/>
  </one>
</sequence>

<!--
Try solving it yourself: https://www.sokobanonline.com/play/web-archive/razorflame/ionic-catalysts-xi/58022_ionic-catalysts-xi-452
-->


================================================
FILE: models/StableCrawlers.xml
================================================
<sequence values="BUR">
  <one in="BBB/BBB/BBB" out="BBB/URB/BBB" steps="20"/>
  <all>
    <rule in="**BB/URBB/**BB" out="**BB/BURB/**BB"/>
    <rule in="UR*/*B*/BBB" out="BU*/*R*/BBB"/>
  </all>
</sequence>


================================================
FILE: models/StairsPath.xml
================================================
<sequence values="BDROAGE" origin="True" symmetry="(xy)">
  <all in="D**B" out="***D" symmetry="(xyz)"/>
  <one in="DBBDBBD" out="B**GEBB" steps="1" comment="finish"/>
  <one in="DBBDBBD" out="RO*****" steps="1" comment="start"/>
  <prl in="D" out="B"/>
  <one>
    <rule in="ROBBB" out="DAARO" comment="forward"/>
    <rule in="ROBB/*BBB/***B/***B" out="DAAR/*BBO/****/****" comment="Turn"/>
    <rule in="ROBBB BBBBB BBBBB BBBBB" out="DAADB BBBAB BBBAB DBBRO" comment="stairs down"/>
    <rule in="BBBBB BBBBB BBBBB ROBBB" out="DBBRO BBBAB BBBAB DAADB" comment="stairs up"/>

    <observe value="G" from="B" to="R"/>
    <observe value="E" from="B" to="O"/>
    <observe value="R" to="D"/>
    <observe value="O" to="A"/>
    <observe value="B" to="BDA"/>
  </one>
  <one in="ROBB" out="DAAD"/>
  <map scale="5/3 5/3 5/3" values="BWAR" folder="Stairs">
    <rule in="BBB/BBB/BBB BBB/ADA/BBB BBB/BBB/BBB" fout="Line" legend="BAW"/>
    <rule in="BBB/BBB/BBB BBB/BDA/BAB BBB/BBB/BBB" fout="Turn" legend="BAW"/>
    <rule in="BBB/BBB/BBB BBB/ADB/BBB BBB/BAB/BBB" fout="Down" legend="BAW"/>
    <rule in="BBB/BAB/BBB BBB/BDA/BBB BBB/BBB/BBB" fout="Up" legend="BAW"/>
    <rule in="BBB/BBB/BBB BBB/ADB/BBB BBB/BBB/BBB" fout="End" legend="BAWR"/>
  </map>
</sequence>

<!--
Connects 2 given points with the shortest path with stairs.
-->


================================================
FILE: models/StochasticVoronoi.xml
================================================
<sequence values="BYE">
  <one in="B" out="E" steps="10"/>
  <one in="B" out="Y" steps="10"/>
  <one>
    <rule in="EB" out="EE"/>
    <rule in="YB" out="YY"/>
  </one>
</sequence>


================================================
FILE: models/StormySnellLaw.xml
================================================
<sequence values="WUGIABSR" origin="True">
  <all in="UW" out="*U" symmetry="(x)"/>
  <prl in="U*" out="G*" symmetry="()"/>
  <prl in="*G" out="*A" symmetry="()"/>
  <all symmetry="(x)">
    <rule in="U/W" out="W/U"/>
    <rule in="W/G" out="G/W"/>
    <rule in="AW" out="*A"/>
  </all>
  <all in="A/W" out="*/A" symmetry="()"/>
  <one in="W" out="B" steps="8"/>
  <one in="A" out="I" steps="8"/>
  <prl in="W" out="A"/>
  <one>
    <rule in="BA" out="BB"/>
    <rule in="IA" out="II"/>
  </one>
  <one>
    <rule in="U**/**I" out="A**/**S"/>
    <rule in="S" out="U"/>
    <rule in="U**/**B" out="A**/**R"/>
    <rule in="R**/**B" out="W**/**R"/>

    <observe value="G" from="B" to="R"/>
    <observe value="U" to="A"/>
    <observe value="B" to="BW"/>
    <observe value="I" to="IA"/>
  </one>
  <one in="R" out="W"/>
</sequence>


================================================
FILE: models/StrangeDungeon.xml
================================================
<sequence values="BWE">
  <prl in="B" out="E"/>
  <prl in="***/*E*/***" out="***/*B*/***" d="2"/>
  <prl in="***/***/*** ***/*E*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***" d="3"/>
  <one in="B" out="W" steps="100"/>
  <all>
    <rule in="BBB/BWB" out="BWB/BWB"/>
    <rule in="WB/BW" out="WW/BW"/>
    <rule in="WBW" out="WWW"/>
  </all>
  <all in="E" out="B"/>
  <all in="BBB/BWB" out="***/*B*"/>
</sequence>


================================================
FILE: models/StrangeGrowth.xml
================================================
<one values="BW" in="**B/WB*/**B" out="***/*W*/***" origin="True"/>


================================================
FILE: models/StrangeNoise.xml
================================================
<sequence values="BW">
  <one in="B" out="W" steps="1"/>
  <one temperature="2.0" periodic="False">
    <rule in="B" out="W"/>
    <field for="W" to="W" on="B" recompute="True"/>
  </one>
</sequence>


================================================
FILE: models/SubmergedKnots.xml
================================================
<sequence values="BW">
  <all in="B" out="W"/>
  <all in="***/***/*** ***/*W*/*** ***/***/***" out="***/***/*** ***/*B*/*** ***/***/***"/>
  <wfc values="BWU" tileset="Knots3D" tiles="Knots3D/4">
    <rule in="W" out="Empty"/>
    <sequence>
      <all in="B" out="U"/>
      <all in="U *" out="B *" symmetry="()"/>
      <one in="UB" out="UU" steps="42000"/>
    </sequence>
  </wfc>
</sequence>


================================================
FILE: models/Surface.xml
================================================
<sequence values="B">
  <wfc values="BW" tileset="Surface"/>
</sequence>


================================================
FILE: models/Tetris.xml
================================================
<sequence values="CIBWRAO" symmetry="(x)">
  <union symbol="?" values="ICB"/>
  <prl in="*/C" out="*/I"/>
  <prl in="*/*/*/*/I" out="*/*/*/*/W"/>
  <prl in="W/*" out="B/*"/>
  <markov>
    <one in="IB" out="*I"/>
    <one in="AR" out="AA" symmetry="(xy)"/>
    <one in="R/W" out="A/W"/>
    <prl>
      <rule in="R/B" out="*/R"/>
      <rule in="R/I" out="*/R"/>
      <rule in="?/R" out="*/B"/>
    </prl>
    <one in="A" out="W"/>
    <one symmetry="(xy)">
      <rule in="III/III" out="*R*/RRR"/>
      <rule in="III/III" out="RR*/*RR"/>
      <rule in="III/III" out="R**/RRR"/>
      <rule in="III/III" out="RR*/RR*"/>
    </one>
  </markov>
  <all in="WI" out="O*"/>
  <all symmetry="(xy)">
    <rule in="O*" out="OO"/>
    <rule in="OO" out="BB"/>
  </all>
</sequence>


================================================
FILE: models/Texture.xml
================================================
<sequence values="BIURW">
  <one in="BB*/BBB/*B*" out="***/*I*/***"/>
  <all in="*I*/IBI" out="***/*I*"/>
  <all in="*B*/BIB/*B*" out="***/*W*/***"/>
  <markov>
    <all>
      <rule in="UI" out="*U"/>
      <rule in="RI" out="*R"/>
    </all>
    <one>
      <rule in="I" out="U"/>
      <rule in="I" out="R"/>
    </one>
  </markov>
</sequence>


================================================
FILE: models/TileDungeon.xml
================================================
<sequence values="PB">
  <all in="***/*P*/***" out="***/*B*/***"/>
  <wfc tileset="Dungeon" values="ABW">
    <rule in="P" out="Stone"/>
    <markov>
      <all in="WA" out="*W"/>
      <path from="A" to="W" on="B" color="W"/>
      <one in="A" out="W"/>
    </markov>
  </wfc>
</sequence>


================================================
FILE: models/TilePath.xml
================================================
<sequence values="BAR">
  <all in="***/*B*/***" out="***/*A*/***" comment="color all inner cells gray"/>
  <one in="BBB/BAA/BAA" out="***/***/**R" symmetry="()" comment="color 2 cells near opposite corners red"/>
  <one in="AAB/AAB/BBB" out="R**/***/***" symmetry="()"/>
  <wfc tileset="Knots2D" values="EUIR">
    <rule in="B" out="Empty"/>
    <rule in="A" out="Empty|Line|Turn"/>
    <rule in="R" out="End"/>

    <one in="EEE/EUE" out="***/*I*" comment="color river endpoints indigo"/>
    <all in="IU" out="*I" comment="color the whole path indigo"/>
    <one in="EEE/EIE" out="***/*R*" comment="color endpoints red"/>
  </wfc>
</sequence>


================================================
FILE: models/Trail.xml
================================================
<one values="BRW" origin="True">
  <rule in="RB" out="WR"/>
  <rule in="RW" out="WR"/>
</one>


================================================
FILE: models/Voronoi.xml
================================================
<sequence values="BYE">
  <one in="B" out="E" steps="10"/>
  <one in="B" out="Y" steps="10"/>
  <all>
    <rule in="EB" out="*E"/>
    <rule in="YB" out="*Y"/>
  </all>
</sequence>


================================================
FILE: models/WaveBrickWall.xml
================================================
<sequence values="B" symmetry="()">
  <wfc sample="BrickWall" values="bNn" n="3" periodic="True" shannon="True">
    <rule in="B" out="b|N|n"/>
  </wfc>
</sequence>


================================================
FILE: models/WaveDungeon.xml
================================================
<sequence values="BWDG">
  <all in="***/*B*/***" out="***/*D*/***"/>
  <one in="DDDD/DDDD/DDDD" out="WWWW/WWWW/WWWW" steps="5"/>
  <markov>
    <all in="GW" out="*G"/>
    <path from="G" to="W" on="D" color="W" inertia="True"/>
    <one in="W" out="G"/>
  </markov>
  <all in="G" out="W"/>
  <wfc sample="Dungeon" values="BWP" n="3">
    <rule in="B" out="B"/>
    <rule in="W" out="W"/>

    <one in="W" out="P" steps="1"/>
    <all in="PW" out="*P"/>
    <all in="W" out="B"/>
  </wfc>
</sequence>

<!--<sequence values="PB">
  <all in="***/*P*/***" out="***/*B*/***"/>
  <wfc sample="Skew2" n="3" values="BWE" shannon="True">
    <rule in="P" out="B"/>
    <markov>
      <all in="EW" out="*E"/>
      <path from="E" to="W" on="B" color="W"/>
      <one in="W" out="E"/>
    </markov>
  </wfc>
</sequence>-->


================================================
FILE: models/WaveFlowers.xml
================================================
<sequence values="BW" symmetry="(x)">
  <all in="B/*/*" out="W/*/*"/>
  <wfc sample="Flowers" values="zYgN" n="3" periodic="True" shannon="True">
    <rule in="B" out="N|g"/>
    <rule in="W" out="z|g|Y"/>
  </wfc>
</sequence>


================================================
FILE: models/Wilson.xml
================================================
<sequence values="BWIRKGYU" origin="True">
  <all>
    <rule in="WBB" out="**I"/>
    <rule in="IBB" out="**I"/>
  </all>
  <markov>
    <one>
      <rule in="RBI" out="KKR"/>
      <rule in="RBK" out="GKY"/>
      <rule in="RBW" out="WWW"/>

      <rule in="WKK" out="WWW"/>

      <rule in="YKG" out="YBU"/>
      <rule in="UKK" out="IBU"/>
      <rule in="UKY" out="IBR"/>
    </one>
    <one in="I" out="R"/>
  </markov>
</sequence>

<!--
Generates a random maze, in a way that each maze has the same probability of appearing.

Compare to an implementation in a conventional language: https://bl.ocks.org/mbostock/11357811
-->


================================================
FILE: models/WolfBasedApproach.xml
================================================
<sequence values="DEIWRSA">
  <prl in="***/*D*/***" out="***/*E*/***"/>
  <one in="E" out="W" steps="15"/>
  <one in="E" out="R" steps="1"/>
  <all>
    <rule in="RI" out="IR"/>
    <rule in="RE" out="SR"/>
    <rule in="WI" out="IW"/>
    <rule in="WE" out="IW"/>
    <rule in="RW" out="RR"/>
    <rule in="R*/*W" out="R*/*R"/>

    <field for="W" to="E" on="I" recompute="True"/>
    <field for="R" to="W" on="EI" recompute="True" essential="True"/>
  </all>
  <prl>
    <rule in="E" out="D"/>
    <rule in="S" out="A"/>
    <rule in="R" out="A"/>
    <rule in="I" out="A"/>
  </prl>
  <all>
    <rule in="DA/AD" out="**/*A"/>
    <rule in="AAA/ADA/AAA" out="***/*A*/***"/>
  </all>
  <all in="DDD/DAD" out="***/*D*"/>
</sequence>

<!--
1. Sheep eat grass.
2. Wolves chase sheep.
3. Wolves eat sheep and multiply.
4. Wolves mark their territory with a trail, no other wolf can cross it.
5. We just generated a dungeon.
-->


================================================
FILE: models.xml
================================================
<models>
  <model name="Apartemazements" size="8" d="3" amount="4"/>
  <model name="Apartemazements" size="8" d="3" iso="True" pixelsize="6" gui="150"/>
  <model name="CarmaTower" length="12" width="12" height="18"/>
  <model name="CarmaTower" length="12" width="12" height="18" iso="True" amount="1"/>
  <model name="ModernHouse" length="9" width="9" height="4" amount="4"/>
  <model name="ModernHouse" length="9" width="9" height="4" iso="True"/>
  <model name="SeaVilla" length="10" width="10" height="4" amount="4"/>
  <model name="SeaVilla" length="10" width="10" height="4" iso="True"/>
  <model name="Island" size="800" steps="-1" pixelsize="1">
    <color symbol="I" value="abcbe8" comment="sea"/>
    <color symbol="U" value="cee6f9" comment="coast and lakes"/>
    <color symbol="T" value="2b8aa9" comment="rivers"/>
    <color symbol="Y" value="f1ebc2" comment="sand"/>
    <color symbol="G" value="a8d1a5" comment="grass"/>
    <color symbol="E" value="93c08d" comment="forest"/>
    <color symbol="S" value="d0d8ac" comment="slopes"/>
    <color symbol="s" value="e9e0b2" comment="hills"/>
  </model>
  
  <model name="Backtracker" size="89"/>
  <model name="BacktrackerCycle" size="59"/>
  <model name="Basic" size="60" steps="1000"/>
  <model name="BasicBrickWall" size="30"/>
  <model name="BasicDijkstraDungeon" size="60"/>
  <model name="BasicDijkstraFill" size="60"/>
  <model name="BasicDungeonGrowth" size="59"/>
  <model name="BasicPartitioning" size="60" steps="1000"/>
  <model name="BernoulliPercolation" size="359"/>
  <model name="BiasedGrowth" size="120" steps="1000"/>
  <model name="BiasedGrowthContraction" size="120" steps="5000"/>
  <model name="BiasedMazeGrowth" size="117" steps="400"/>
  <model name="BiasedVoronoi" size="80" steps="1000"/>
  <model name="BishopParity" size="60"/>
  <model name="BlueNoise" size="80" steps="500"/>
  <model name="Cave" size="60"/>
  <model name="CaveContour" size="80"/>
  <model name="CentralCrawlers" size="60" steps="300"/>
  <model name="CentralSAW" size="59"/>
  <model name="ChainDungeon" size="60"/>
  <model name="ChainDungeonMaze" size="60"/>
  <model name="ChainMaze" size="60"/>
  <model name="Circuit" size="59" steps="1200"/>
  <model name="ClosedSurface" size="12" d="3"/>
  <model name="ColoredKnots" size="12" d="3"/>
  <model name="CompleteSAW" size="19"/>
  <model name="CompleteSAWSmart" size="23"/>
  <model name="ConnectedCaves" size="60"/>
  <model name="ConstrainedCaves" size="60"/>
  <model name="Counting" size="8" d="3"/>
  <model name="Coupling" size="80"/>
  <model name="CrawlersChase" size="60" steps="200"/>
  <model name="CrossCountry" size="80"/>
  <model name="Cycles" size="59"/>
  <model name="DenseSAW" size="59" amount="4"/>
  <model name="DiagonalPath" size="80"/>
  <model name="Digger" size="359" steps="50000"/>
  <model name="DijkstraDungeon" size="40" amount="4"/>
  <model name="Division" size="75"/>
  <model name="DualRetraction" size="59"/>
  <model name="DualRetraction3D" size="27" d="3"/>
  <model name="DungeonGrowth" size="79" amount="4"/>
  <model name="Dwarves" size="20" steps="85"/>
  <model name="Escher" size="8" d="3"/>
  <model name="EscherSurface" size="8" d="3"/>
  <model name="EuclideanPath" size="80"/>
  <model name="FindLongCycle" size="27" pixelsize="10"/>
  <model name="FireNoise" size="300"/>
  <model name="Flowers" size="60"/>
  <model name="Forest" size="240"/>
  <
Download .txt
gitextract_hx1ombn3/

├── .github/
│   └── FUNDING.yml
├── .gitignore
├── CITATION.cff
├── LICENSE
├── MarkovJunior.csproj
├── README.md
├── models/
│   ├── Apartemazements.xml
│   ├── Backtracker.xml
│   ├── BacktrackerCycle.xml
│   ├── Basic.xml
│   ├── BasicBrickWall.xml
│   ├── BasicDijkstraDungeon.xml
│   ├── BasicDijkstraFill.xml
│   ├── BasicDungeonGrowth.xml
│   ├── BasicKeys.xml
│   ├── BasicPartitioning.xml
│   ├── BasicSkyline.xml
│   ├── BasicSnake.xml
│   ├── BernoulliPercolation.xml
│   ├── BiasedGrowth.xml
│   ├── BiasedGrowthContraction.xml
│   ├── BiasedMazeGrowth.xml
│   ├── BiasedVoronoi.xml
│   ├── BishopParity.xml
│   ├── BlueNoise.xml
│   ├── CarmaTower.xml
│   ├── Cave.xml
│   ├── CaveContour.xml
│   ├── CentralCrawlers.xml
│   ├── CentralSAW.xml
│   ├── ChainDungeon.xml
│   ├── ChainDungeonMaze.xml
│   ├── ChainMaze.xml
│   ├── Chase.xml
│   ├── Circuit.xml
│   ├── ClosedSurface.xml
│   ├── ColoredKnots.xml
│   ├── CompleteSAW.xml
│   ├── CompleteSAWSmart.xml
│   ├── ConnectedCaves.xml
│   ├── ConstrainedCaves.xml
│   ├── Counting.xml
│   ├── Coupling.xml
│   ├── Crawlers.xml
│   ├── CrawlersChase.xml
│   ├── CrossCountry.xml
│   ├── Cycles.xml
│   ├── DenseSAW.xml
│   ├── DiagonalPath.xml
│   ├── Digger.xml
│   ├── DijkstraDungeon.xml
│   ├── Division.xml
│   ├── DualRetraction.xml
│   ├── DualRetraction3D.xml
│   ├── DungeonGrowth.xml
│   ├── DwarfPath.xml
│   ├── Dwarves.xml
│   ├── Escher.xml
│   ├── EscherSurface.xml
│   ├── EuclideanPath.xml
│   ├── FindLongCycle.xml
│   ├── FireNoise.xml
│   ├── Flowers.xml
│   ├── Forest.xml
│   ├── ForestFire.xml
│   ├── ForestFireCA.xml
│   ├── GameOfLife.xml
│   ├── GoTo.xml
│   ├── GoToGradient.xml
│   ├── GrowTo.xml
│   ├── Growth.xml
│   ├── GrowthCompetition.xml
│   ├── GrowthContraction.xml
│   ├── GrowthWalk.xml
│   ├── HamiltonianPath.xml
│   ├── HamiltonianPaths.xml
│   ├── Hills.xml
│   ├── IrregularMazeGrowth.xml
│   ├── IrregularSAW.xml
│   ├── Island.xml
│   ├── Keys.xml
│   ├── KnightPatrol.xml
│   ├── Knots2D.xml
│   ├── Knots3D.xml
│   ├── Laplace.xml
│   ├── Lightning.xml
│   ├── LoopErasedWalk.xml
│   ├── LoopGrowth.xml
│   ├── LostCity.xml
│   ├── MarchingSquares.xml
│   ├── MazeBacktracker.xml
│   ├── MazeGrowth.xml
│   ├── MazeMap.xml
│   ├── MazeTrail.xml
│   ├── ModernHouse.xml
│   ├── MultiHeadedDungeon.xml
│   ├── MultiHeadedWalk.xml
│   ├── MultiHeadedWalkDungeon.xml
│   ├── MultiSokoban8.xml
│   ├── MultiSokoban9.xml
│   ├── NestedGrowth.xml
│   ├── NoDeadEnds.xml
│   ├── Noise.xml
│   ├── NystromDungeon.xml
│   ├── OddScale.xml
│   ├── OddScale3D.xml
│   ├── OpenCave.xml
│   ├── OpenCave3D.xml
│   ├── OrganicMechanic.xml
│   ├── OrientedEscher.xml
│   ├── PaintCompetition.xml
│   ├── ParallelGrowth.xml
│   ├── ParallelMazeGrowth.xml
│   ├── ParallelWalk.xml
│   ├── Partitioning.xml
│   ├── Percolation.xml
│   ├── PeriodicEscher.xml
│   ├── PillarsOfEternity.xml
│   ├── Push.xml
│   ├── PutColoredLs.xml
│   ├── PutLs.xml
│   ├── RainbowGrowth.xml
│   ├── RandomWalk.xml
│   ├── Rectangle.xml
│   ├── RegularPath.xml
│   ├── RegularSAW.xml
│   ├── RegularSAWRestart.xml
│   ├── River.xml
│   ├── Rosettes.xml
│   ├── SAWRestart.xml
│   ├── SeaVilla.xml
│   ├── SelectLargeCaves.xml
│   ├── SelectLongKnots.xml
│   ├── SelfAvoidingWalk.xml
│   ├── SequentialSnake.xml
│   ├── SequentialSokoban.xml
│   ├── Sewers.xml
│   ├── SmartSAW.xml
│   ├── SmarterDigger.xml
│   ├── SmoothTrail.xml
│   ├── Snake.xml
│   ├── SnellLaw.xml
│   ├── SoftPath.xml
│   ├── SokobanLevel1.xml
│   ├── SokobanLevel2.xml
│   ├── StableCrawlers.xml
│   ├── StairsPath.xml
│   ├── StochasticVoronoi.xml
│   ├── StormySnellLaw.xml
│   ├── StrangeDungeon.xml
│   ├── StrangeGrowth.xml
│   ├── StrangeNoise.xml
│   ├── SubmergedKnots.xml
│   ├── Surface.xml
│   ├── Tetris.xml
│   ├── Texture.xml
│   ├── TileDungeon.xml
│   ├── TilePath.xml
│   ├── Trail.xml
│   ├── Voronoi.xml
│   ├── WaveBrickWall.xml
│   ├── WaveDungeon.xml
│   ├── WaveFlowers.xml
│   ├── Wilson.xml
│   └── WolfBasedApproach.xml
├── models.xml
├── resources/
│   ├── palette.xml
│   ├── rules/
│   │   ├── BasicDijkstraRoom.vox
│   │   ├── CarmaTower/
│   │   │   ├── block_1_5x3.vox
│   │   │   ├── block_2_4x3.vox
│   │   │   ├── bracing_h_1.vox
│   │   │   ├── bracing_h_2.vox
│   │   │   ├── bracing_h_3.vox
│   │   │   ├── bracing_v_1.vox
│   │   │   ├── bracing_v_2.vox
│   │   │   ├── bracing_v_3.vox
│   │   │   ├── cut_1.vox
│   │   │   ├── cut_2.vox
│   │   │   ├── holes_2.vox
│   │   │   ├── holes_4.vox
│   │   │   ├── holes_h_4.vox
│   │   │   ├── holes_v_3.vox
│   │   │   ├── roof_3x5.vox
│   │   │   ├── roof_5x9.vox
│   │   │   ├── roof_7x11.vox
│   │   │   ├── roof_7x7.vox
│   │   │   ├── roof_thing_1.vox
│   │   │   ├── roof_thing_2.vox
│   │   │   ├── roof_thing_5x9.vox
│   │   │   ├── roof_thing_7x11.vox
│   │   │   ├── side_11x7.vox
│   │   │   ├── side_13x5.vox
│   │   │   ├── side_3x5.vox
│   │   │   ├── side_3x5_fake.vox
│   │   │   ├── side_5x13.vox
│   │   │   ├── side_5x3.vox
│   │   │   ├── side_5x3_fake.vox
│   │   │   ├── side_7x11.vox
│   │   │   ├── small_windows_2.vox
│   │   │   ├── small_windows_3.vox
│   │   │   ├── window_1.vox
│   │   │   ├── window_2.vox
│   │   │   └── window_3.vox
│   │   ├── DualRetraction/
│   │   │   ├── Room1.vox
│   │   │   └── Room2.vox
│   │   ├── ModernHouse/
│   │   │   ├── Bridge.vox
│   │   │   ├── ColumnBottom.vox
│   │   │   ├── ColumnTop.vox
│   │   │   ├── ContactBottom.vox
│   │   │   ├── ContactTop.vox
│   │   │   ├── Dir.vox
│   │   │   ├── Down.vox
│   │   │   ├── Edge.vox
│   │   │   ├── FrameDir.vox
│   │   │   ├── FrameVertex.vox
│   │   │   ├── GlassColumnBottom.vox
│   │   │   ├── GlassColumnMid.vox
│   │   │   ├── GlassColumnTop.vox
│   │   │   ├── Grass.vox
│   │   │   ├── In.vox
│   │   │   ├── Node.vox
│   │   │   ├── Out.vox
│   │   │   ├── SecondaryDir.vox
│   │   │   ├── SecondaryNode.vox
│   │   │   ├── StyleBottom.vox
│   │   │   ├── StyleTop.vox
│   │   │   ├── TertiaryDir.vox
│   │   │   ├── Up.vox
│   │   │   ├── Wall.vox
│   │   │   ├── WallBottom.vox
│   │   │   ├── WallTop.vox
│   │   │   ├── WindowBottom.vox
│   │   │   ├── WindowMid.vox
│   │   │   ├── WindowTop.vox
│   │   │   ├── WoodBottom.vox
│   │   │   └── WoodTop.vox
│   │   ├── SeaVilla/
│   │   │   ├── BridgeWood.vox
│   │   │   ├── ContactWood.vox
│   │   │   ├── Cross.vox
│   │   │   ├── CrossX.vox
│   │   │   ├── Dir.vox
│   │   │   ├── DrawPier.vox
│   │   │   ├── Edge.vox
│   │   │   ├── Goal.vox
│   │   │   ├── In.vox
│   │   │   ├── KeyK.vox
│   │   │   ├── KeyL.vox
│   │   │   ├── KeyR.vox
│   │   │   ├── Ladder.vox
│   │   │   ├── LadderBottom.vox
│   │   │   ├── LadderTop.vox
│   │   │   ├── Line.vox
│   │   │   ├── LockK.vox
│   │   │   ├── LockL.vox
│   │   │   ├── LockR.vox
│   │   │   ├── Out.vox
│   │   │   ├── OutIn.vox
│   │   │   ├── OutWall.vox
│   │   │   ├── Pier.vox
│   │   │   ├── Room.vox
│   │   │   ├── RoomDouble.vox
│   │   │   ├── RoomIn.vox
│   │   │   ├── RoomOut.vox
│   │   │   ├── RoomWall.vox
│   │   │   ├── StairsBottom.vox
│   │   │   ├── StairsTop.vox
│   │   │   ├── Stone.vox
│   │   │   ├── TopContactWood.vox
│   │   │   ├── TopCross.vox
│   │   │   ├── TopDir.vox
│   │   │   ├── TopEdge.vox
│   │   │   ├── TopIn.vox
│   │   │   ├── TopOut.vox
│   │   │   ├── TopStone.vox
│   │   │   ├── TopWall.vox
│   │   │   ├── Wall.vox
│   │   │   ├── Water.vox
│   │   │   └── WaterWall.vox
│   │   └── Stairs/
│   │       ├── Down.vox
│   │       ├── End.vox
│   │       ├── Line.vox
│   │       ├── Turn.vox
│   │       └── Up.vox
│   ├── settings.xml
│   └── tilesets/
│       ├── Dungeon/
│       │   ├── Door.vox
│       │   ├── Empty.vox
│       │   ├── In.vox
│       │   ├── Line.vox
│       │   ├── Out.vox
│       │   ├── Stone.vox
│       │   ├── T.vox
│       │   ├── Turn.vox
│       │   └── Wall.vox
│       ├── Dungeon.xml
│       ├── Escher/
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Stairs.vox
│       │   ├── Turn.vox
│       │   └── X.vox
│       ├── Escher.xml
│       ├── EscherSurface/
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Stairs.vox
│       │   ├── Turn.vox
│       │   └── X.vox
│       ├── EscherSurface.xml
│       ├── Knots2D/
│       │   ├── Cross.vox
│       │   ├── Empty.vox
│       │   ├── End.vox
│       │   ├── Line.vox
│       │   └── Turn.vox
│       ├── Knots2D.xml
│       ├── Knots3D/
│       │   ├── 3/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   ├── 4/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   ├── 5/
│       │   │   ├── Empty.vox
│       │   │   ├── Line.vox
│       │   │   └── Turn.vox
│       │   └── Tubes/
│       │       ├── Empty.vox
│       │       ├── Line.vox
│       │       └── Turn.vox
│       ├── Knots3D.xml
│       ├── MarchingHills/
│       │   ├── Empty.vox
│       │   ├── In.vox
│       │   ├── Out.vox
│       │   ├── Stone.vox
│       │   └── Wall.vox
│       ├── MarchingHills.xml
│       ├── OrientedEscher/
│       │   ├── Cube.vox
│       │   ├── Empty.vox
│       │   ├── Stairs.vox
│       │   ├── T.vox
│       │   └── Turn.vox
│       ├── OrientedEscher.xml
│       ├── OrientedStairs/
│       │   ├── Cube.vox
│       │   ├── Empty.vox
│       │   ├── StairsB.vox
│       │   ├── StairsT.vox
│       │   ├── T1.vox
│       │   ├── T2.vox
│       │   └── Turn.vox
│       ├── OrientedStairs.xml
│       ├── Partition/
│       │   ├── I.vox
│       │   ├── Nothing.vox
│       │   └── T.vox
│       ├── Partition.xml
│       ├── PartitionedEdges/
│       │   ├── 00.vox
│       │   ├── 01.vox
│       │   ├── 10.vox
│       │   ├── 11.vox
│       │   ├── Bridge.vox
│       │   ├── ContactDown.vox
│       │   ├── ContactUp.vox
│       │   ├── Cross.vox
│       │   ├── Down.vox
│       │   ├── Empty.vox
│       │   ├── I.vox
│       │   ├── Line.vox
│       │   ├── Nothing.vox
│       │   ├── T.vox
│       │   ├── Turn.vox
│       │   ├── Up0.vox
│       │   ├── Up1.vox
│       │   ├── X.vox
│       │   └── o.vox
│       ├── PartitionedEdges.xml
│       ├── Paths/
│       │   ├── Down.vox
│       │   ├── Empty.vox
│       │   ├── Line.vox
│       │   ├── Turn.vox
│       │   ├── Up.vox
│       │   └── X.vox
│       ├── Paths.xml
│       ├── Surface/
│       │   ├── Angle.vox
│       │   ├── Concave.vox
│       │   ├── Corner.vox
│       │   ├── Empty.vox
│       │   └── Plane.vox
│       └── Surface.xml
├── source/
│   ├── AllNode.cs
│   ├── ArrayHelper.cs
│   ├── ConvChain.cs
│   ├── Convolution.cs
│   ├── Field.cs
│   ├── GUI.cs
│   ├── Graphics.cs
│   ├── Grid.cs
│   ├── Helper.cs
│   ├── Interpreter.cs
│   ├── Map.cs
│   ├── Node.cs
│   ├── Observation.cs
│   ├── OneNode.cs
│   ├── OverlapModel.cs
│   ├── ParallelNode.cs
│   ├── Path.cs
│   ├── Program.cs
│   ├── Rule.cs
│   ├── RuleNode.cs
│   ├── Search.cs
│   ├── SymmetryHelper.cs
│   ├── TileModel.cs
│   ├── VoxHelper.cs
│   ├── WaveFunctionCollapse.cs
│   └── XMLHelper.cs
└── syntax.md
Download .txt
SYMBOL INDEX (188 symbols across 26 files)

FILE: source/AllNode.cs
  class AllNode (line 8) | class AllNode : RuleNode
    method Load (line 10) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Fit (line 18) | void Fit(int r, int x, int y, int z, bool[] newstate, int MX, int MY)
    method Go (line 41) | override public bool Go()

FILE: source/ArrayHelper.cs
  class AH (line 5) | static class AH
    method Array3D (line 7) | public static T[][][] Array3D<T>(int MX, int MY, int MZ, T value)
    method Array2D (line 23) | public static T[][] Array2D<T>(int MX, int MY, T value)
    method Array1D (line 34) | public static T[] Array1D<T>(int length, Func<int, T> f)
    method Array1D (line 40) | public static T[] Array1D<T>(int length, T value)
    method FlatArray3D (line 47) | public static T[] FlatArray3D<T>(int MX, int MY, int MZ, Func<int, int...
    method Set2D (line 54) | public static void Set2D<T>(this T[][] a, T value) { for (int y = 0; y...
    method Same (line 56) | public static bool Same(byte[] t1, byte[] t2) => t1.AsSpan().SequenceE...

FILE: source/ConvChain.cs
  class ConvChainNode (line 6) | class ConvChainNode : Node
    method Load (line 20) | override protected bool Load(XElement xelem, bool[] symmetry, Grid grid)
    method Toggle (line 61) | void Toggle(byte[] state, int i) => state[i] = state[i] == c0 ? c1 : c0;
    method Go (line 62) | override public bool Go()
    method Reset (line 121) | override public void Reset()

FILE: source/Convolution.cs
  class ConvolutionNode (line 7) | class ConvolutionNode : Node
    method Load (line 27) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Reset (line 47) | override public void Reset()
    method Go (line 52) | override public bool Go()
    class ConvolutionRule (line 139) | class ConvolutionRule
      method Load (line 146) | public bool Load(XElement xelem, Grid grid)

FILE: source/Field.cs
  class Field (line 7) | class Field
    method Field (line 12) | public Field(XElement xelem, Grid grid)
    method Compute (line 25) | public bool Compute(int[] potential, Grid grid)
    method Neighbors (line 70) | static List<(int, int, int)> Neighbors(int x, int y, int z, int MX, in...
    method DeltaPointwise (line 84) | public static int? DeltaPointwise(byte[] state, Rule rule, int x, int ...

FILE: source/GUI.cs
  class GUI (line 8) | static class GUI
    method GUI (line 19) | static GUI()
    method Draw (line 55) | public static void Draw(string name, Branch root, Branch current, int[...
    method IsActive (line 319) | static bool IsActive(RuleNode node, int index)

FILE: source/Graphics.cs
  class Graphics (line 9) | static class Graphics
    method LoadBitmap (line 11) | public static (int[], int, int, int) LoadBitmap(string filename)
    method SaveBitmap (line 24) | unsafe public static void SaveBitmap(int[] data, int width, int height...
    method Render (line 37) | public static (int[], int, int) Render(byte[] state, int MX, int MY, i...
    method BitmapRender (line 39) | public static (int[], int, int) BitmapRender(byte[] state, int MX, int...
    method IsometricRender (line 66) | public static (int[], int, int) IsometricRender(byte[] state, int MX, ...
    method Int (line 158) | static int Int(byte r, byte g, byte b) => (0xff << 24) + (r << 16) + (...
    method RGB (line 159) | static (byte, byte, byte) RGB(int i)
  class Sprite (line 168) | class Sprite
    method Sprite (line 176) | public Sprite(int size)
  type Voxel (line 209) | struct Voxel
    method Voxel (line 215) | public Voxel(int color, int x, int y, int z)

FILE: source/Grid.cs
  class Grid (line 8) | class Grid
    method Load (line 23) | public static Grid Load(XElement xelem, int MX, int MY, int MZ)
    method Clear (line 83) | public void Clear()
    method Wave (line 88) | public int Wave(string values)
    method Matches (line 123) | public bool Matches(Rule rule, int x, int y, int z)

FILE: source/Helper.cs
  class Helper (line 6) | static class Helper
    method Ords (line 8) | public static (byte[], int) Ords(this int[] data, List<int> uniques = ...
    method Split (line 26) | public static string[][] Split(this string s, char S1, char S2)
    method Power (line 34) | public static int Power(int a, int n)
    method Index (line 41) | public static int Index(this bool[] array)
    method Index (line 47) | public static long Index(this byte[] p, int C)
    method NonZeroPositions (line 54) | public static byte[] NonZeroPositions(int w)
    method MaxPositiveIndex (line 68) | public static int MaxPositiveIndex(this int[] amounts)
    method Pattern (line 83) | public static T[] Pattern<T>(Func<int, int, T> f, int N)
    method Rotated (line 89) | public static T[] Rotated<T>(T[] p, int N) => Pattern((x, y) => p[N - ...
    method Reflected (line 90) | public static T[] Reflected<T>(T[] p, int N) => Pattern((x, y) => p[N ...
  class RandomHelper (line 93) | static class RandomHelper
    method Random (line 95) | public static T Random<T>(this List<T> list, Random random) => list[ra...
    method Random (line 97) | public static int Random(this double[] weights, double r)
    method Shuffle (line 112) | public static void Shuffle(this int[] array, Random random)

FILE: source/Interpreter.cs
  class Interpreter (line 7) | class Interpreter
    method Interpreter (line 22) | Interpreter() { }
    method Load (line 23) | public static Interpreter Load(XElement xelem, int MX, int MY, int MZ)
    method Run (line 52) | public IEnumerable<(byte[], char[], int, int, int)> Run(int seed, int ...
    method WriteLine (line 84) | public static void WriteLine(string s) => Console.WriteLine(s);
    method Write (line 85) | public static void Write(string s) => Console.Write(s);

FILE: source/Map.cs
  class MapNode (line 6) | class MapNode : Branch
    method Load (line 12) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Matches (line 59) | static bool Matches(Rule rule, int x, int y, int z, byte[] state, int ...
    method Apply (line 78) | static void Apply(Rule rule, int x, int y, int z, byte[] state, int MX...
    method Go (line 95) | override public bool Go()
    method Reset (line 110) | override public void Reset()

FILE: source/Node.cs
  class Node (line 7) | abstract class Node
    method Load (line 9) | abstract protected bool Load(XElement xelem, bool[] symmetry, Grid grid);
    method Reset (line 10) | abstract public void Reset();
    method Go (line 11) | abstract public bool Go();
    method Factory (line 16) | public static Node Factory(XElement xelem, bool[] symmetry, Interprete...
  class Branch (line 51) | abstract class Branch : Node
    method Load (line 57) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Go (line 79) | override public bool Go()
    method Reset (line 92) | override public void Reset()
  class SequenceNode (line 99) | class SequenceNode : Branch { }
  class MarkovNode (line 100) | class MarkovNode : Branch
    method MarkovNode (line 102) | public MarkovNode() { }
    method MarkovNode (line 103) | public MarkovNode(Node child, Interpreter ip) { nodes = new Node[] { c...
    method Go (line 105) | public override bool Go()

FILE: source/Observation.cs
  class Observation (line 6) | class Observation
    method Observation (line 11) | public Observation(char from, string to, Grid grid)
    method ComputeFutureSetPresent (line 17) | public static bool ComputeFutureSetPresent(int[] future, byte[] state,...
    method ComputeForwardPotentials (line 43) | public static void ComputeForwardPotentials(int[][] potentials, byte[]...
    method ComputeBackwardPotentials (line 49) | public static void ComputeBackwardPotentials(int[][] potentials, int[]...
    method ComputePotentials (line 59) | static void ComputePotentials(int[][] potentials, int MX, int MY, int ...
    method ForwardMatches (line 98) | static bool ForwardMatches(Rule rule, int x, int y, int z, int[][] pot...
    method ApplyForward (line 120) | static void ApplyForward(Rule rule, int x, int y, int z, int[][] poten...
    method IsGoalReached (line 145) | public static bool IsGoalReached(byte[] present, int[] future)
    method ForwardPointwise (line 151) | public static int ForwardPointwise(int[][] potentials, int[] future)
    method BackwardPointwise (line 173) | public static int BackwardPointwise(int[][] potentials, byte[] present)

FILE: source/OneNode.cs
  class OneNode (line 7) | class OneNode : RuleNode
    method Load (line 9) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Reset (line 17) | override public void Reset()
    method Apply (line 27) | void Apply(Rule rule, int x, int y, int z)
    method Go (line 51) | override public bool Go()
    method RandomMatch (line 75) | (int r, int x, int y, int z) RandomMatch(Random random)

FILE: source/OverlapModel.cs
  class OverlapNode (line 8) | class OverlapNode : WFCNode
    method Load (line 12) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method UpdateState (line 136) | protected override void UpdateState()

FILE: source/ParallelNode.cs
  class ParallelNode (line 5) | class ParallelNode : RuleNode
    method Load (line 9) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Add (line 16) | override protected void Add(int r, int x, int y, int z, bool[] maskr)
    method Go (line 36) | public override bool Go()

FILE: source/Path.cs
  class PathNode (line 8) | class PathNode : Node
    method Load (line 14) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Reset (line 28) | public override void Reset() { }
    method Go (line 29) | public override bool Go()
    method Direction (line 113) | (int, int, int) Direction(int x, int y, int z, int dx, int dy, int dz,...
    method Directions (line 168) | static List<(int x, int y, int z)> Directions(int x, int y, int z, int...

FILE: source/Program.cs
  class Program (line 9) | static class Program
    method Main (line 11) | static void Main()

FILE: source/Rule.cs
  class Rule (line 7) | class Rule
    method Rule (line 18) | public Rule(int[] input, int IMX, int IMY, int IMZ, byte[] output, int...
    method ZRotated (line 63) | public Rule ZRotated()
    method YRotated (line 76) | public Rule YRotated()
    method Reflected (line 89) | public Rule Reflected()
    method Same (line 102) | public static bool Same(Rule a1, Rule a2)
    method Symmetries (line 110) | public IEnumerable<Rule> Symmetries(bool[] symmetry, bool d2)
    method LoadResource (line 116) | public static (char[] data, int MX, int MY, int MZ) LoadResource(strin...
    method Parse (line 138) | static (char[], int, int, int) Parse(string s)
    method Load (line 169) | public static Rule Load(XElement xelem, Grid gin, Grid gout)

FILE: source/RuleNode.cs
  class RuleNode (line 8) | abstract class RuleNode : Node
    method Load (line 31) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Reset (line 105) | override public void Reset()
    method Add (line 114) | protected virtual void Add(int r, int x, int y, int z, bool[] maskr)
    method Go (line 124) | public override bool Go()

FILE: source/Search.cs
  class Search (line 7) | static class Search
    method Run (line 9) | public static byte[][] Run(byte[] present, int[] future, Rule[] rules,...
    method OneChildStates (line 114) | static List<byte[]> OneChildStates(this byte[] state, int MX, int MY, ...
    method Matches (line 123) | static bool Matches(this Rule rule, int x, int y, byte[] state, int MX...
    method Applied (line 137) | static byte[] Applied(Rule rule, int x, int y, byte[] state, int MX)
    method Print (line 149) | static void Print(this byte[] state, int MX, int MY)
    method IsInside (line 159) | public static bool IsInside(this (int x, int y) p, Rule rule, int x, i...
    method Overlap (line 161) | public static bool Overlap(Rule rule0, int x0, int y0, Rule rule1, int...
    method AllChildStates (line 168) | public static List<byte[]> AllChildStates(this byte[] state, int MX, i...
    method Enumerate (line 194) | static void Enumerate(List<byte[]> children, List<(Rule, int)> solutio...
    method Hide (line 230) | static void Hide(int l, bool unhide, (Rule, int)[] tiles, int[] amount...
    method Apply (line 239) | static void Apply(this Rule rule, int x, int y, byte[] state, int MX)
    method Apply (line 243) | static byte[] Apply(this byte[] state, List<(Rule, int)> solution, int...
  class Board (line 252) | class Board
    method Board (line 257) | public Board(byte[] state, int parentIndex, int depth, int backwardEst...
    method Rank (line 266) | public double Rank(Random random, double depthCoefficient)
    method Trajectory (line 272) | public static List<Board> Trajectory(int index, List<Board> database)
  class StateComparer (line 280) | class StateComparer : IEqualityComparer<byte[]>
    method Equals (line 282) | public bool Equals(byte[] a, byte[] b)
    method GetHashCode (line 288) | public int GetHashCode(byte[] a)

FILE: source/SymmetryHelper.cs
  class SymmetryHelper (line 7) | static class SymmetryHelper
    method SquareSymmetries (line 19) | public static IEnumerable<T> SquareSymmetries<T>(T thing, Func<T, T> r...
    method CubeSymmetries (line 48) | public static IEnumerable<T> CubeSymmetries<T>(T thing, Func<T, T> a, ...
    method GetSymmetry (line 106) | public static bool[] GetSymmetry(bool d2, string s, bool[] dflt)

FILE: source/TileModel.cs
  class TileNode (line 8) | class TileNode : WFCNode
    method Load (line 15) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method UpdateState (line 290) | protected override void UpdateState()

FILE: source/VoxHelper.cs
  class VoxHelper (line 8) | static class VoxHelper
    method LoadVox (line 10) | public static (int[], int, int, int) LoadVox(string filename)
    method WriteString (line 72) | static void WriteString(this BinaryWriter stream, string s) { foreach ...
    method SaveVox (line 73) | public static void SaveVox(byte[] state, byte MX, byte MY, byte MZ, in...

FILE: source/WaveFunctionCollapse.cs
  class WFCNode (line 7) | abstract class WFCNode : Branch
    method Load (line 31) | override protected bool Load(XElement xelem, bool[] parentSymmetry, Gr...
    method Reset (line 60) | override public void Reset()
    method Go (line 69) | public override bool Go()
    method GoodSeed (line 121) | int? GoodSeed()
    method NextUnobservedNode (line 157) | int NextUnobservedNode(Random random)
    method Observe (line 181) | void Observe(int node, Random random)
    method Propagate (line 189) | bool Propagate()
    method Ban (line 231) | void Ban(int i, int t)
    method UpdateState (line 254) | protected abstract void UpdateState();
  class Wave (line 261) | class Wave
    method Wave (line 269) | public Wave(int length, int P, int D, bool shannon)
    method Init (line 283) | public void Init(int[][][] propagator, double sumOfWeights, double sum...
    method CopyFrom (line 304) | public void CopyFrom(Wave wave, int D, bool shannon)

FILE: source/XMLHelper.cs
  class XMLHelper (line 9) | static class XMLHelper
    method Get (line 11) | public static T Get<T>(this XElement xelem, string attribute)
    method Get (line 18) | public static T Get<T>(this XElement xelem, string attribute, T dflt)
    method LineNumber (line 24) | public static int LineNumber(this XElement xelem) => ((System.Xml.IXml...
    method Elements (line 26) | public static IEnumerable<XElement> Elements(this XElement xelement, p...
    method MyDescendants (line 27) | public static IEnumerable<XElement> MyDescendants(this XElement xelem,...
Condensed preview — 409 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (433K chars).
[
  {
    "path": ".github/FUNDING.yml",
    "chars": 16,
    "preview": "github: [mxgmn]\n"
  },
  {
    "path": ".gitignore",
    "chars": 66,
    "preview": ".idea/\n.vscode/\n.vs/\n\nbin/\nobj/\ndoc/\n\n*.user\n\noutput/\nsource/old/\n"
  },
  {
    "path": "CITATION.cff",
    "chars": 395,
    "preview": "cff-version: 1.1.0\nmessage: \"citation\"\nauthors:\n  - family-names: Gumin\n    given-names: Maxim\ntitle: MarkovJunior, a pr"
  },
  {
    "path": "LICENSE",
    "chars": 1068,
    "preview": "MIT License\n\nCopyright (c) 2022 Maxim Gumin\n\nPermission is hereby granted, free of charge, to any person obtaining a cop"
  },
  {
    "path": "MarkovJunior.csproj",
    "chars": 884,
    "preview": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <OutputType>Exe</OutputType>\n    <TargetFramework>net10.0</Tar"
  },
  {
    "path": "README.md",
    "chars": 30618,
    "preview": "# MarkovJunior\nMarkovJunior is a probabilistic programming language where programs are combinations of rewrite rules and"
  },
  {
    "path": "models/Apartemazements.xml",
    "chars": 2397,
    "preview": "<sequence values=\"BWN\" symmetry=\"(xy)\">\n  <prl in=\"B\" out=\"W\"/>\n  <prl in=\"***/***/*** ***/*W*/*** ***/***/***\" out=\"***"
  },
  {
    "path": "models/Backtracker.xml",
    "chars": 154,
    "preview": "<markov values=\"BRWU\" origin=\"True\">\n  <one in=\"RB\" out=\"WR\"/>\n  <one in=\"RW\" out=\"UR\"/>\n</markov>\n\n<!--\nGenerates conne"
  },
  {
    "path": "models/BacktrackerCycle.xml",
    "chars": 327,
    "preview": "<sequence values=\"BRGWA\" origin=\"True\">\n  <union symbol=\"?\" values=\"WA\"/>\n  <markov>\n    <one in=\"RBB\" out=\"GGR\"/>\n    <"
  },
  {
    "path": "models/Basic.xml",
    "chars": 34,
    "preview": "<one values=\"BW\" in=\"B\" out=\"W\"/>\n"
  },
  {
    "path": "models/BasicBrickWall.xml",
    "chars": 519,
    "preview": "<sequence values=\"BWO\" symmetry=\"(x)\">\n  <all in=\"B/*\" out=\"O/*\"/>\n  <all in=\"O/*/*\" out=\"W/*/*\"/>\n  <markov>\n    <all i"
  },
  {
    "path": "models/BasicDijkstraDungeon.xml",
    "chars": 275,
    "preview": "<sequence values=\"BGW\">\n  <one file=\"BasicDijkstraRoom\" legend=\"BW\" steps=\"1\"/>\n  <all in=\"W\" out=\"G\"/>\n  <markov>\n    <"
  },
  {
    "path": "models/BasicDijkstraFill.xml",
    "chars": 219,
    "preview": "<sequence values=\"BWG\">\n  <all file=\"BasicDijkstraRoom\" legend=\"BW\"/>\n  <markov>\n    <all in=\"GW\" out=\"GG\"/>\n    <path f"
  },
  {
    "path": "models/BasicDungeonGrowth.xml",
    "chars": 388,
    "preview": "<sequence values=\"BRACDG\" origin=\"True\">\n  <union symbol=\"?\" values=\"BR\"/>\n  <one in=\"**?**/*BBB*/*BBB?/*BBB*/**R**\" out"
  },
  {
    "path": "models/BasicKeys.xml",
    "chars": 999,
    "preview": "<sequence values=\"BDIRGYNOKPFCU\" origin=\"True\">\n  <all in=\"DB*\" out=\"*ID\" comment=\"draw a grid\"/>\n  <one in=\"D\" out=\"G\" "
  },
  {
    "path": "models/BasicPartitioning.xml",
    "chars": 178,
    "preview": "<sequence values=\"BW\">\n  <all in=\"***/*B*/***\" out=\"***/*W*/***\"/>\n  <markov>\n    <one in=\"WWW/WBW\" out=\"WBW/WBW\"/>\n    "
  },
  {
    "path": "models/BasicSkyline.xml",
    "chars": 177,
    "preview": "<sequence values=\"BEC\" symmetry=\"(x)\">\n  <one in=\"B\" out=\"E\" steps=\"7\"/>\n  <one in=\"EB\" out=\"EE\" steps=\"100\"/>\n  <all in"
  },
  {
    "path": "models/BasicSnake.xml",
    "chars": 373,
    "preview": "<sequence values=\"BWDPGR\" origin=\"True\">\n  <all>\n    <rule in=\"WBB\" out=\"**D\"/>\n    <rule in=\"DBB\" out=\"**D\"/>\n  </all>\n"
  },
  {
    "path": "models/BernoulliPercolation.xml",
    "chars": 272,
    "preview": "<sequence values=\"RDAUBW\" origin=\"True\">\n  <prl in=\"*R\" out=\"*U\" symmetry=\"()\"/>\n  <prl in=\"U*\" out=\"B*\" symmetry=\"()\"/>"
  },
  {
    "path": "models/BiasedGrowth.xml",
    "chars": 253,
    "preview": "<sequence values=\"NWSB\" origin=\"True\">\n  <prl in=\"N/*\" out=\"S/*\" symmetry=\"()\"/>\n  <prl in=\"*/S\" out=\"*/B\" symmetry=\"()\""
  },
  {
    "path": "models/BiasedGrowthContraction.xml",
    "chars": 392,
    "preview": "<sequence values=\"NWSB\" origin=\"True\">\n  <prl in=\"N/*\" out=\"S/*\" symmetry=\"()\"/>\n  <prl in=\"*/S\" out=\"*/B\" symmetry=\"()\""
  },
  {
    "path": "models/BiasedMazeGrowth.xml",
    "chars": 256,
    "preview": "<sequence values=\"NWAUB\" origin=\"True\">\n  <prl in=\"N/*\" out=\"U/*\" symmetry=\"()\"/>\n  <prl in=\"*/U\" out=\"*/B\" symmetry=\"()"
  },
  {
    "path": "models/BiasedVoronoi.xml",
    "chars": 286,
    "preview": "<sequence values=\"BOS\">\n  <one in=\"B\" out=\"O\" steps=\"1\"/>\n  <one in=\"B\" out=\"S\" steps=\"1\"/>\n  <one>\n    <rule in=\"OB\" ou"
  },
  {
    "path": "models/BishopParity.xml",
    "chars": 660,
    "preview": "<sequence values=\"BRGUW\">\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <one in=\"B\" out=\"G\" steps=\"1\" temperature=\"10.0\">\n    <fie"
  },
  {
    "path": "models/BlueNoise.xml",
    "chars": 134,
    "preview": "<one values=\"BW\" origin=\"True\" temperature=\"0.3\">\n  <rule in=\"B\" out=\"W\"/>\n  <field for=\"W\" from=\"W\" on=\"B\" recompute=\"T"
  },
  {
    "path": "models/CarmaTower.xml",
    "chars": 16747,
    "preview": "<sequence values=\"BtTRL\" origin=\"True\" symmetry=\"(xy)\" folder=\"CarmaTower\">\n  <one in=\"B t\" out=\"t B\" />\n  <one in=\"BB/"
  },
  {
    "path": "models/Cave.xml",
    "chars": 307,
    "preview": "<sequence values=\"DA\">\n  <prl in=\"***/*D*/***\" out=\"***/*A*/***\"/>\n  <prl in=\"A\" out=\"D\" p=\"0.435\" steps=\"1\"/>\n  <convol"
  },
  {
    "path": "models/CaveContour.xml",
    "chars": 580,
    "preview": "<sequence values=\"EFDA\">\n  <prl in=\"***/*E*/***\" out=\"***/*F*/***\"/>\n  <prl in=\"F\" out=\"E\" p=\"0.5\" steps=\"1\"/>\n  <convol"
  },
  {
    "path": "models/CentralCrawlers.xml",
    "chars": 269,
    "preview": "<sequence values=\"BWUR\" origin=\"True\">\n  <one in=\"BB\" out=\"UR\" steps=\"10\"/>\n  <all temperature=\"5.0\">\n    <rule in=\"URB\""
  },
  {
    "path": "models/CentralSAW.xml",
    "chars": 128,
    "preview": "<one values=\"BRW\" origin=\"True\" in=\"RBB\" out=\"WWR\" temperature=\"0.1\">\n  <field for=\"W\" to=\"R\" on=\"B\" recompute=\"False\"/>"
  },
  {
    "path": "models/ChainDungeon.xml",
    "chars": 585,
    "preview": "<sequence values=\"DABWO\">\n  <all in=\"***/*D*/***\" out=\"***/*B*/***\"/>\n  <one in=\"BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBB"
  },
  {
    "path": "models/ChainDungeonMaze.xml",
    "chars": 587,
    "preview": "<sequence values=\"DABWO\">\n  <all in=\"***/*D*/***\" out=\"***/*B*/***\"/>\n  <one in=\"BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBB"
  },
  {
    "path": "models/ChainMaze.xml",
    "chars": 141,
    "preview": "<sequence values=\"BDA\">\n  <convchain sample=\"Maze\" on=\"B\" black=\"D\" white=\"A\" n=\"2\" steps=\"10\"/>\n  <all in=\"AD/DA\" out=\""
  },
  {
    "path": "models/Chase.xml",
    "chars": 564,
    "preview": "<sequence values=\"BRW\" periodic=\"True\">\n  <one in=\"B\" out=\"R\" steps=\"20\"/>\n  <one in=\"B\" out=\"W\" steps=\"20\"/>\n  <all tem"
  },
  {
    "path": "models/Circuit.xml",
    "chars": 1009,
    "preview": "<sequence values=\"BtEDGANYOWU\" origin=\"True\">\n  <prl in=\"***/*B*/***\" out=\"***/*E*/***\"/>\n  <all in=\"tEE\" out=\"**t\"/>\n  "
  },
  {
    "path": "models/ClosedSurface.xml",
    "chars": 229,
    "preview": "<sequence values=\"BW\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"***/***/*** ***/*W*/*** ***/***/***\" out=\"***/***/*** ***/*B*/"
  },
  {
    "path": "models/ColoredKnots.xml",
    "chars": 1423,
    "preview": "<sequence values=\"BRW\">\n  <all in=\"B\" out=\"R\"/>\n  <all in=\"***/***/*** ***/*R*/*** ***/***/***\" out=\"***/***/*** ***/*W*"
  },
  {
    "path": "models/CompleteSAW.xml",
    "chars": 324,
    "preview": "<sequence values=\"BRWD\" origin=\"True\">\n  <all>\n    <rule in=\"R*B\" out=\"**D\"/>\n    <rule in=\"D*B\" out=\"**D\"/>\n  </all>\n  "
  },
  {
    "path": "models/CompleteSAWSmart.xml",
    "chars": 631,
    "preview": "<sequence values=\"BDIORGW\" origin=\"True\">\n  <all>\n    <rule in=\"I*B\" out=\"**D\"/>\n    <rule in=\"D*B\" out=\"**I\"/>\n  </all>"
  },
  {
    "path": "models/ConnectedCaves.xml",
    "chars": 412,
    "preview": "<sequence values=\"DAW\">\n  <prl in=\"***/*D*/***\" out=\"***/*A*/***\"/>\n  <prl in=\"A\" out=\"D\" p=\"0.5\" steps=\"1\"/>\n  <convolu"
  },
  {
    "path": "models/ConstrainedCaves.xml",
    "chars": 500,
    "preview": "<sequence values=\"DABWOP\">\n  <prl in=\"***/*D*/***\" out=\"***/*B*/***\"/>\n  <one file=\"ConstrainedRoom\" legend=\"BDWO*\" step"
  },
  {
    "path": "models/Counting.xml",
    "chars": 246,
    "preview": "<convolution values=\"BRGUY\" neighborhood=\"VonNeumann\">\n  <rule in=\"B\" out=\"R\" sum=\"3\" values=\"B\"/>\n  <rule in=\"B\" out=\"G"
  },
  {
    "path": "models/Coupling.xml",
    "chars": 355,
    "preview": "<sequence values=\"EYUD\">\n  <one in=\"E\" out=\"Y\" steps=\"30\"/>\n  <one in=\"E\" out=\"U\" steps=\"30\"/>\n  <all>\n    <rule in=\"YE\""
  },
  {
    "path": "models/Crawlers.xml",
    "chars": 156,
    "preview": "<sequence values=\"BUR\">\n  <one in=\"BB\" out=\"UR\" steps=\"12\"/>\n  <all>\n    <rule in=\"URB\" out=\"BUR\"/>\n    <rule in=\"UR/*B\""
  },
  {
    "path": "models/CrawlersChase.xml",
    "chars": 586,
    "preview": "<sequence values=\"BWRUGE\">\n  <one in=\"BB\" out=\"UR\" steps=\"12\"/>\n  <markov>\n    <all>\n      <rule in=\"URB\" out=\"BUR\"/>\n  "
  },
  {
    "path": "models/CrossCountry.xml",
    "chars": 1010,
    "preview": "<sequence values=\"FUOZGWNR\">\n  <prl in=\"***/*F*/***\" out=\"***/*U*/***\"/>\n  <prl in=\"U\" out=\"F\" p=\"0.435\" steps=\"1\"/>\n  <"
  },
  {
    "path": "models/Cycles.xml",
    "chars": 176,
    "preview": "<sequence values=\"BWA\" origin=\"True\">\n  <one in=\"WBB\" out=\"WAW\"/>\n  <one in=\"WBW\" out=\"*W*\" steps=\"2\"/>\n  <all in=\"A\" ou"
  },
  {
    "path": "models/DenseSAW.xml",
    "chars": 194,
    "preview": "<sequence values=\"BRW\" origin=\"True\">\n  <one in=\"RBB\" out=\"WWR\" steps=\"1\"/>\n  <one in=\"RBB\" out=\"WWR\" temperature=\"0.3\">"
  },
  {
    "path": "models/DiagonalPath.xml",
    "chars": 357,
    "preview": "<sequence values=\"BRGW\">\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <one in=\"B\" out=\"G\" temperature=\"4.0\" steps=\"1\">\n    <field"
  },
  {
    "path": "models/Digger.xml",
    "chars": 98,
    "preview": "<markov values=\"BRW\" origin=\"True\">\n  <one in=\"RB\" out=\"WR\"/>\n  <one in=\"RW\" out=\"WR\"/>\n</markov>\n"
  },
  {
    "path": "models/DijkstraDungeon.xml",
    "chars": 431,
    "preview": "<sequence values=\"BGWRDU\">\n  <union symbol=\"?\" values=\"BD\"/>\n  <one file=\"DijkstraRoom\" legend=\"?DW*BR\" steps=\"1\"/>\n  <a"
  },
  {
    "path": "models/Division.xml",
    "chars": 2174,
    "preview": "<sequence values=\"WBUuAaI\" origin=\"true\">\n    <prl in=\"***/*W*/***\" out=\"***/*U*/***\"/>\n    <prl in=\"W\" out=\"I\"/>\n    <p"
  },
  {
    "path": "models/DualRetraction.xml",
    "chars": 444,
    "preview": "<sequence values=\"BRUW\" origin=\"True\">\n  <one>\n    <rule in=\"BB*BB/BBBBB/BBBBR/BBBBB/BB*BB\" out=\"**R**/*WWW*/*WWWU/*WWW*"
  },
  {
    "path": "models/DualRetraction3D.xml",
    "chars": 482,
    "preview": "<sequence values=\"BRUWG\" origin=\"True\" folder=\"DualRetraction\">\n  <one>\n    <rule file=\"Room1\" legend=\"B*RUW\"/>\n    <rul"
  },
  {
    "path": "models/DungeonGrowth.xml",
    "chars": 1860,
    "preview": "<sequence values=\"WRBUPY\" origin=\"True\" folder=\"DungeonGrowth\">\n  <union symbol=\"?\" values=\"BR\"/>\n  <!--<prl in=\"***/*W*"
  },
  {
    "path": "models/DwarfPath.xml",
    "chars": 546,
    "preview": "<sequence values=\"BRWAPGEY\">\n  <one in=\"BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB\" out=\"******/*AAAA*/*A**A*/*A**A*/*AAA"
  },
  {
    "path": "models/Dwarves.xml",
    "chars": 527,
    "preview": "<sequence values=\"BRWGNAEP\">\n  <one in=\"BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB\" out=\"******/*NNNN*/*N**N*/*N**N*/*NNN"
  },
  {
    "path": "models/Escher.xml",
    "chars": 318,
    "preview": "<sequence values=\"BR\">\n  <all in=\"B\" out=\"R\"/>\n  <all in=\"***/***/*** ***/*R*/*** ***/***/***\" out=\"***/***/*** ***/*B*/"
  },
  {
    "path": "models/EscherSurface.xml",
    "chars": 357,
    "preview": "<sequence values=\"BW\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"***/***/*** ***/*W*/*** ***/***/***\" out=\"***/***/*** ***/*B*/"
  },
  {
    "path": "models/EuclideanPath.xml",
    "chars": 613,
    "preview": "<sequence values=\"BRGWOAD\">\n  <one in=\"BBB/BBB/BBB\" out=\"***/*D*/***\" steps=\"8\"/>\n  <one in=\"D\" out=\"A\" steps=\"1\"/>\n  <o"
  },
  {
    "path": "models/FindLongCycle.xml",
    "chars": 791,
    "preview": "<sequence values=\"BWARDEU\" origin=\"True\">\n  <union symbol=\"?\" values=\"BDE\"/>\n  <one in=\"WBB\" out=\"WAW\"/>\n  <markov>\n    "
  },
  {
    "path": "models/FireNoise.xml",
    "chars": 1076,
    "preview": "<sequence values=\"BGOERK\">\n  <prl steps=\"75\">\n    <rule in=\"OG\" out=\"*O\"/>\n    <rule in=\"O*/*G\" out=\"**/*O\"/>\n    <rule "
  },
  {
    "path": "models/Flowers.xml",
    "chars": 556,
    "preview": "<sequence values=\"NGUEPY\" symmetry=\"(x)\">\n  <all in=\"N/*/*/*\" out=\"G/*/*/*\"/>\n  <all in=\"G/*/*/*/*\" out=\"U/*/*/*/*\"/>\n  "
  },
  {
    "path": "models/Forest.xml",
    "chars": 383,
    "preview": "<sequence values=\"BIEW\">\n  <one in=\"BB*/BBB/*B*\" out=\"***/*I*/***\"/>\n  <all in=\"*I*/IBI\" out=\"***/*I*\"/>\n  <all in=\"*B*/"
  },
  {
    "path": "models/ForestFire.xml",
    "chars": 239,
    "preview": "<prl values=\"BGR\">\n  <rule in=\"RG\" out=\"*R\"/>\n  <rule in=\"R*/*G\" out=\"**/*R\"/>\n  <rule in=\"B\" out=\"G\" p=\"0.01\"/>\n  <rule"
  },
  {
    "path": "models/ForestFireCA.xml",
    "chars": 205,
    "preview": "<convolution values=\"BGR\" neighborhood=\"Moore\">\n  <rule in=\"G\" out=\"R\" sum=\"1..8\" values=\"R\"/>\n  <rule in=\"R\" out=\"B\"/>\n"
  },
  {
    "path": "models/GameOfLife.xml",
    "chars": 246,
    "preview": "<sequence values=\"DA\">\n  <prl in=\"D\" out=\"A\" p=\"0.5\" steps=\"1\"/>\n  <convolution neighborhood=\"Moore\" periodic=\"True\">\n  "
  },
  {
    "path": "models/GoTo.xml",
    "chars": 189,
    "preview": "<markov values=\"BRWD\" origin=\"True\">\n  <one>\n    <rule in=\"RW\" out=\"BR\"/>\n    <rule in=\"RD\" out=\"BR\"/>\n  </one>\n  <path "
  },
  {
    "path": "models/GoToGradient.xml",
    "chars": 229,
    "preview": "<markov values=\"BRW\" origin=\"True\">\n  <one in=\"RW\" out=\"BR\"/>\n  <one temperature=\"1.0\">\n    <rule in=\"RB\" out=\"BR\"/>\n   "
  },
  {
    "path": "models/GrowTo.xml",
    "chars": 210,
    "preview": "<sequence values=\"BUN\">\n  <one in=\"B\" out=\"U\" steps=\"1\"/>\n  <one in=\"B\" out=\"N\" steps=\"1\"/>\n  <one in=\"NB\" out=\"NN\" temp"
  },
  {
    "path": "models/Growth.xml",
    "chars": 50,
    "preview": "<one values=\"BW\" origin=\"True\" in=\"WB\" out=\"WW\"/>\n"
  },
  {
    "path": "models/GrowthCompetition.xml",
    "chars": 253,
    "preview": "<sequence values=\"BEY\" periodic=\"True\">\n  <one in=\"B\" out=\"E\" steps=\"5\"/>\n  <one in=\"B\" out=\"Y\" steps=\"5\"/>\n  <one>\n    "
  },
  {
    "path": "models/GrowthContraction.xml",
    "chars": 95,
    "preview": "<one values=\"BW\" origin=\"True\">\n  <rule in=\"WB\" out=\"WW\"/>\n  <rule in=\"BWW\" out=\"BBW\"/>\n</one>\n"
  },
  {
    "path": "models/GrowthWalk.xml",
    "chars": 93,
    "preview": "<one values=\"BW\" origin=\"True\">\n  <rule in=\"WB\" out=\"BW\"/>\n  <rule in=\"WB\" out=\"WW\"/>\n</one>\n"
  },
  {
    "path": "models/HamiltonianPath.xml",
    "chars": 938,
    "preview": "<sequence values=\"BRWGU\" origin=\"True\">\n  <one symmetry=\"()\">\n    <rule in=\"B/B/R\" out=\"R/B/B\"/>\n    <rule in=\"BBR\" out="
  },
  {
    "path": "models/HamiltonianPaths.xml",
    "chars": 567,
    "preview": "<sequence values=\"BRWG\" origin=\"True\">\n  <one in=\"RBB\" out=\"WWR\" steps=\"1\"/>\n  <one in=\"R*B/***/W**\" out=\"WWR/***/***\" s"
  },
  {
    "path": "models/Hills.xml",
    "chars": 316,
    "preview": "<sequence values=\"BA\">\n  <prl in=\"B\" out=\"A\"/>\n  <prl in=\"A *\" out=\"B *\" symmetry=\"()\"/>\n  <one in=\"AB\" out=\"AA\" steps=\""
  },
  {
    "path": "models/IrregularMazeGrowth.xml",
    "chars": 68,
    "preview": "<one values=\"BW\" origin=\"True\" in=\"*BB/WBB/*BB\" out=\"***/WW*/***\"/>\n"
  },
  {
    "path": "models/IrregularSAW.xml",
    "chars": 69,
    "preview": "<one values=\"BRW\" origin=\"True\" in=\"*BB/RBB/*BB\" out=\"***/WR*/***\"/>\n"
  },
  {
    "path": "models/Island.xml",
    "chars": 5726,
    "preview": "<sequence values=\"UWBRGEYINSOTus\" origin=\"True\">\n  <prl in=\"***/*U*/***\" out=\"***/*Y*/***\"/>\n\n  <one in=\"WY\" out=\"WW\" st"
  },
  {
    "path": "models/Keys.xml",
    "chars": 764,
    "preview": "<sequence values=\"BADGRIFYUP\" origin=\"True\">\n  <prl in=\"ABB*\" out=\"*DDA\"/>\n  <one in=\"A\" out=\"G\" steps=\"1\"/>\n  <one step"
  },
  {
    "path": "models/KnightPatrol.xml",
    "chars": 246,
    "preview": "<markov values=\"BRGWA\" origin=\"True\">\n  <one in=\"R**/**B\" out=\"W**/**R\">\n    <observe value=\"G\" from=\"B\" to=\"R\"/>\n    <o"
  },
  {
    "path": "models/Knots2D.xml",
    "chars": 204,
    "preview": "<sequence values=\"DB\">\n  <all in=\"***/*D*/***\" out=\"***/*B*/***\"/>\n  <wfc tileset=\"Knots2D\" values=\"IE\">\n    <rule in=\"D"
  },
  {
    "path": "models/Knots3D.xml",
    "chars": 252,
    "preview": "<sequence values=\"BW\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"***/***/*** ***/*W*/*** ***/***/***\" out=\"***/***/*** ***/*B*/"
  },
  {
    "path": "models/Laplace.xml",
    "chars": 134,
    "preview": "<one values=\"BW\" origin=\"True\" temperature=\"12.0\">\n  <rule in=\"B\" out=\"W\"/>\n  <field for=\"W\" to=\"W\" on=\"B\" recompute=\"Fa"
  },
  {
    "path": "models/Lightning.xml",
    "chars": 468,
    "preview": "<sequence values=\"NBRGUW\">\n  <all in=\"***/*N*/***\" out=\"***/*B*/***\"/>\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <markov>\n    "
  },
  {
    "path": "models/LoopErasedWalk.xml",
    "chars": 188,
    "preview": "<one values=\"BRWGOU\" origin=\"True\">\n  <rule in=\"RBB\" out=\"WWR\"/>\n  <rule in=\"RBW\" out=\"GWO\"/>\n  <rule in=\"OWG\" out=\"OBU\""
  },
  {
    "path": "models/LoopGrowth.xml",
    "chars": 162,
    "preview": "<sequence values=\"BAW\" origin=\"True\">\n  <one in=\"BBB/BAB/BBB\" out=\"WAW/ABA/WAW\"/>\n  <one in=\"BBB/BBB/WAW\" out=\"WAW/ABA/W"
  },
  {
    "path": "models/LostCity.xml",
    "chars": 1172,
    "preview": "<sequence values=\"BWRDIE\">\n  <one in=\"B\" out=\"I\" steps=\"4\" comment=\"make a few lakes by random growth\"/>\n  <one in=\"IB\" "
  },
  {
    "path": "models/MarchingSquares.xml",
    "chars": 366,
    "preview": "<sequence values=\"BW\">\n  <prl in=\"B\" out=\"W\" p=\"0.5\" steps=\"1\"/>\n  <map scale=\"3 3 1\" values=\"DA\">\n    <rule in=\"BB/BB\" "
  },
  {
    "path": "models/MazeBacktracker.xml",
    "chars": 103,
    "preview": "<markov values=\"BRGW\" origin=\"True\">\n  <one in=\"RBB\" out=\"GGR\"/>\n  <one in=\"RGG\" out=\"WWR\"/>\n</markov>\n"
  },
  {
    "path": "models/MazeGrowth.xml",
    "chars": 327,
    "preview": "<one values=\"BWA\" in=\"WBB\" out=\"WAW\" origin=\"True\"/>\n\n<!--\nCompare to an implementation in a conventional language: http"
  },
  {
    "path": "models/MazeMap.xml",
    "chars": 435,
    "preview": "<sequence symmetry=\"()\" values=\"BOEIN\">\n  <all>\n    <rule in=\"B\" out=\"O\"/>\n    <rule in=\"B\" out=\"E\"/>\n    <rule in=\"B\" o"
  },
  {
    "path": "models/MazeTrail.xml",
    "chars": 263,
    "preview": "<one values=\"BRW\" origin=\"True\">\n  <rule in=\"RBB\" out=\"WWR\"/>\n  <rule in=\"R*W\" out=\"W*R\"/>\n</one>\n\n<!--\nAlso known as Al"
  },
  {
    "path": "models/ModernHouse.xml",
    "chars": 30223,
    "preview": "<sequence values=\"BD\" symmetry=\"(xy)\">\n  <prl in=\"B\" out=\"D\" />\n  <wfc tileset=\"Partition\" values=\"BVL vSaOon\" overlap="
  },
  {
    "path": "models/MultiHeadedDungeon.xml",
    "chars": 696,
    "preview": "<sequence values=\"BRWGO\" origin=\"True\">\n  <markov>\n    <sequence>\n      <one in=\"R***B\" out=\"*WWWG\" steps=\"3\"/>\n      <a"
  },
  {
    "path": "models/MultiHeadedWalk.xml",
    "chars": 168,
    "preview": "<sequence values=\"BRGW\" origin=\"True\">\n  <sequence>\n    <one in=\"RB\" out=\"*G\" steps=\"3\"/>\n    <all in=\"R\" out=\"W\"/>\n    "
  },
  {
    "path": "models/MultiHeadedWalkDungeon.xml",
    "chars": 363,
    "preview": "<sequence values=\"BRGW\" origin=\"True\">\n  <markov>\n    <sequence>\n      <one in=\"RBB\" out=\"*WG\" steps=\"3\"/>\n      <all in"
  },
  {
    "path": "models/MultiSokoban8.xml",
    "chars": 470,
    "preview": "<sequence values=\"BRWI\">\n  <one in=\"BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB/BBBBBBBB\" out=\"BBBBBB"
  },
  {
    "path": "models/MultiSokoban9.xml",
    "chars": 548,
    "preview": "<sequence values=\"BRWIA\">\n  <one in=\"BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBBBBBBBB/BBB"
  },
  {
    "path": "models/NestedGrowth.xml",
    "chars": 700,
    "preview": "<all values=\"BWAD\" origin=\"True\">\n  <rule in=\"WB\" out=\"WW\"/>\n  <rule in=\"WD\" out=\"WW\"/>\n  <rule in=\"AW\" out=\"AA\"/>\n  <ru"
  },
  {
    "path": "models/NoDeadEnds.xml",
    "chars": 297,
    "preview": "<markov values=\"BRWA\" origin=\"True\">\n  <one in=\"RBB\" out=\"WAR\"/>\n  <one in=\"WBB\" out=\"WAR\"/>\n  <all in=\"RBR\" out=\"WAW\"/>"
  },
  {
    "path": "models/Noise.xml",
    "chars": 197,
    "preview": "<sequence values=\"EWB\">\n  <prl in=\"E/*\" out=\"W/*\" symmetry=\"(x)\"/>\n  <prl in=\"*/W\" out=\"*/B\" symmetry=\"(x)\"/>\n  <one>\n  "
  },
  {
    "path": "models/NystromDungeon.xml",
    "chars": 1249,
    "preview": "<sequence values=\"BPWRG\" origin=\"True\">\n  <all in=\"PBB\" out=\"**P\" comment=\"draw a grid\"/>\n  <one in=\"PBPBPBPBP/BBBBBBBBB"
  },
  {
    "path": "models/OddScale.xml",
    "chars": 349,
    "preview": "<sequence values=\"BW\" symmetry=\"()\">\n  <prl in=\"***/*B*/***\" out=\"***/*W*/***\"/>\n  <prl in=\"W\" out=\"B\" p=\"0.5\" steps=\"1\""
  },
  {
    "path": "models/OddScale3D.xml",
    "chars": 1086,
    "preview": "<sequence values=\"BW\" symmetry=\"()\">\n  <prl in=\"***/***/*** ***/*B*/*** ***/***/***\" out=\"***/***/*** ***/*W*/*** ***/**"
  },
  {
    "path": "models/OpenCave.xml",
    "chars": 289,
    "preview": "<sequence values=\"DA\">\n  <prl in=\"***/*D*/***\" out=\"***/*A*/***\"/>\n  <prl in=\"A\" out=\"D\" p=\"0.5\" steps=\"1\"/>\n  <convolut"
  },
  {
    "path": "models/OpenCave3D.xml",
    "chars": 329,
    "preview": "<sequence values=\"DA\">\n  <prl in=\"***/***/*** ***/*D*/*** ***/***/***\" out=\"***/***/*** ***/*A*/*** ***/***/***\"/>\n  <pr"
  },
  {
    "path": "models/OrganicMechanic.xml",
    "chars": 716,
    "preview": "<sequence values=\"BGRKYEFUIP\" origin=\"True\">\n  <one in=\"BB\" out=\"KR\" steps=\"12\"/>\n  <all>\n    <rule in=\"KRB\" out=\"BKR\"/>"
  },
  {
    "path": "models/OrientedEscher.xml",
    "chars": 330,
    "preview": "<sequence values=\"BRW\" origin=\"True\">\n  <prl in=\"B\" out=\"W\"/>\n  <prl in=\"***/*W*/***\" out=\"***/*B*/***\"/>\n  <wfc values="
  },
  {
    "path": "models/PaintCompetition.xml",
    "chars": 517,
    "preview": "<sequence values=\"UYSN\">\n  <all>\n    <rule in=\"U\" out=\"S\"/>\n    <rule in=\"U\" out=\"N\"/>\n  </all>\n  <one in=\"S\" out=\"U\" st"
  },
  {
    "path": "models/ParallelGrowth.xml",
    "chars": 50,
    "preview": "<all values=\"BW\" origin=\"True\" in=\"WB\" out=\"*W\"/>\n"
  },
  {
    "path": "models/ParallelMazeGrowth.xml",
    "chars": 123,
    "preview": "<all values=\"BWA\" origin=\"True\" in=\"WBB\" out=\"WAW\"/>\n\n<!--\nCompare the generated mazes with the results of MazeGrowth.\n-"
  },
  {
    "path": "models/ParallelWalk.xml",
    "chars": 96,
    "preview": "<sequence values=\"BR\">\n  <one in=\"B\" out=\"R\" steps=\"24\"/>\n  <all in=\"RB\" out=\"BR\"/>\n</sequence>\n"
  },
  {
    "path": "models/Partitioning.xml",
    "chars": 251,
    "preview": "<sequence values=\"BD\" symmetry=\"(xy)\">\n  <all in=\"B\" out=\"D\"/>\n  <wfc values=\"BCA\" tileset=\"Partition\">\n    <rule in=\"D\""
  },
  {
    "path": "models/Percolation.xml",
    "chars": 203,
    "preview": "<sequence values=\"RUBDW\">\n  <prl in=\"*R\" out=\"*U\" symmetry=\"()\"/>\n  <prl in=\"U*\" out=\"D*\" symmetry=\"()\"/>\n  <prl in=\"D\" "
  },
  {
    "path": "models/PeriodicEscher.xml",
    "chars": 608,
    "preview": "<sequence values=\"BW\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"*****/*****/**W**/*****/*****\" out=\"*****/*****/**B**/*****/**"
  },
  {
    "path": "models/PillarsOfEternity.xml",
    "chars": 756,
    "preview": "<sequence values=\"BRW\" symmetry=\"(xy)\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"***/*W*/***\" out=\"***/*B*/***\"/>\n  <wfc value"
  },
  {
    "path": "models/Push.xml",
    "chars": 184,
    "preview": "<sequence values=\"BWP\">\n  <one in=\"B\" out=\"W\" steps=\"120\"/>\n  <one in=\"B\" out=\"P\" steps=\"20\"/>\n  <all>\n    <rule in=\"PB\""
  },
  {
    "path": "models/PutColoredLs.xml",
    "chars": 341,
    "preview": "<markov values=\"BWRGU\">\n  <all>\n    <rule in=\"RW\" out=\"RR\"/>\n    <rule in=\"GW\" out=\"GG\"/>\n    <rule in=\"UW\" out=\"UU\"/>\n "
  },
  {
    "path": "models/PutLs.xml",
    "chars": 80,
    "preview": "<all values=\"BW\" in=\"BBB*/BBB*/BBBB/BBBB/BBBB\" out=\"BBB*/BWB*/BWBB/BWWB/BBBB\"/>\n"
  },
  {
    "path": "models/RainbowGrowth.xml",
    "chars": 234,
    "preview": "<one values=\"BROYGUIP\" origin=\"True\">\n  <rule in=\"RB\" out=\"RO\"/>\n  <rule in=\"OB\" out=\"OY\"/>\n  <rule in=\"YB\" out=\"YG\"/>\n "
  },
  {
    "path": "models/RandomWalk.xml",
    "chars": 50,
    "preview": "<one values=\"BR\" origin=\"True\" in=\"RB\" out=\"BR\"/>\n"
  },
  {
    "path": "models/Rectangle.xml",
    "chars": 223,
    "preview": "<sequence values=\"BRW\">\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <one in=\"RB\" out=\"WW\"/>\n  <one in=\"BBB/BWB\" out=\"*W*/***\" st"
  },
  {
    "path": "models/RegularPath.xml",
    "chars": 401,
    "preview": "<sequence values=\"BAWRGY\" origin=\"True\">\n  <all in=\"A*B\" out=\"**A\"/>\n  <one in=\"A\" out=\"R\" steps=\"1\"/>\n  <one in=\"A\" out"
  },
  {
    "path": "models/RegularSAW.xml",
    "chars": 116,
    "preview": "<one values=\"BRW\" origin=\"True\" in=\"RBB\" out=\"WWR\"/>\n\n<!--\nCompare the average length of the walk in 2d and 3d.\n-->\n"
  },
  {
    "path": "models/RegularSAWRestart.xml",
    "chars": 103,
    "preview": "<markov values=\"BRWA\" origin=\"True\">\n  <one in=\"RBB\" out=\"WAR\"/>\n  <one in=\"WBB\" out=\"WAR\"/>\n</markov>\n"
  },
  {
    "path": "models/River.xml",
    "chars": 483,
    "preview": "<sequence values=\"BWRUGE\">\n  <one in=\"B\" out=\"W\" steps=\"1\"/>\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <one>\n    <rule in=\"RB\""
  },
  {
    "path": "models/Rosettes.xml",
    "chars": 2191,
    "preview": "<sequence values=\"WBUKkAaNnOoYyI\" origin=\"true\">\n    <prl in=\"***/*W*/***\" out=\"***/*U*/***\"/>\n    <prl in=\"W\" out=\"I\"/>"
  },
  {
    "path": "models/SAWRestart.xml",
    "chars": 126,
    "preview": "<markov values=\"BRW\" origin=\"True\">\n  <one in=\"RB\" out=\"WR\"/>\n  <one in=\"WB\" out=\"WR\"/>\n</markov>\n\n<!--\nSaw it here: ..."
  },
  {
    "path": "models/SeaVilla.xml",
    "chars": 19943,
    "preview": "<sequence values=\"Bwy\" symmetry=\"(xy)\">\n  <prl in=\"B\" out=\"w\"/>\n  <prl in=\"w *\" out=\"y *\"/>\n  <prl in=\"***/*y*/***\" out"
  },
  {
    "path": "models/SelectLargeCaves.xml",
    "chars": 564,
    "preview": "<sequence values=\"DARG\">\n  <prl in=\"***/*D*/***\" out=\"***/*A*/***\"/>\n  <prl in=\"A\" out=\"D\" p=\"0.435\" steps=\"1\"/>\n  <conv"
  },
  {
    "path": "models/SelectLongKnots.xml",
    "chars": 570,
    "preview": "<sequence values=\"BRW\">\n  <prl in=\"B\" out=\"R\"/>\n  <prl in=\"***/***/*** ***/*R*/*** ***/***/***\" out=\"***/***/*** ***/*W*"
  },
  {
    "path": "models/SelfAvoidingWalk.xml",
    "chars": 114,
    "preview": "<one values=\"BRW\" origin=\"True\" in=\"RB\" out=\"WR\"/>\n\n<!--\nCompare the average length of the walk in 2d and 3d.\n-->\n"
  },
  {
    "path": "models/SequentialSnake.xml",
    "chars": 600,
    "preview": "<sequence values=\"BWEPRUG\" origin=\"True\">\n  <one in=\"WBB\" out=\"PER\"/>\n  <one in=\"RBB\" out=\"EER\" steps=\"10\"/>\n  <markov>\n"
  },
  {
    "path": "models/SequentialSokoban.xml",
    "chars": 619,
    "preview": "<sequence values=\"BRWIYAGD\">\n  <one in=\"B\" out=\"R\" steps=\"1\"/>\n  <one in=\"BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB/BBBBBB\" out"
  },
  {
    "path": "models/Sewers.xml",
    "chars": 370,
    "preview": "<sequence values=\"BC\">\n  <all in=\"***/*B*/***\" out=\"***/*C*/***\"/>\n  <wfc sample=\"Sewers\" n=\"3\" values=\"BnyN\">\n    <rule"
  },
  {
    "path": "models/SmartSAW.xml",
    "chars": 908,
    "preview": "<sequence values=\"BRDYGWEUN\" origin=\"True\">\n  <union symbol=\"?\" values=\"BD\"/>\n  <union symbol=\"_\" values=\"BN\"/>\n  <all>\n"
  },
  {
    "path": "models/SmarterDigger.xml",
    "chars": 281,
    "preview": "<markov values=\"WRB\" origin=\"True\">\n  <one in=\"RW\" out=\"BR\"/>\n  <path from=\"R\" to=\"W\" on=\"B\" color=\"W\"/>\n</markov>\n\n<!--"
  },
  {
    "path": "models/SmoothTrail.xml",
    "chars": 253,
    "preview": "<sequence values=\"BRW\" origin=\"True\">\n  <one steps=\"3000\">\n    <rule in=\"RB\" out=\"WR\"/>\n    <rule in=\"RW\" out=\"WR\"/>\n  <"
  },
  {
    "path": "models/Snake.xml",
    "chars": 750,
    "preview": "<sequence values=\"BDRUGEPCW\" origin=\"True\">\n  <all in=\"DBB\" out=\"**D\"/>\n  <one in=\"BDB/BBB/BDB\" out=\"***/PGR/***\" steps="
  },
  {
    "path": "models/SnellLaw.xml",
    "chars": 666,
    "preview": "<sequence values=\"BUGIAWSR\" origin=\"True\">\n  <all in=\"UB\" out=\"*U\" symmetry=\"(x)\"/>\n  <prl in=\"U*\" out=\"G*\" symmetry=\"()"
  },
  {
    "path": "models/SoftPath.xml",
    "chars": 648,
    "preview": "<sequence values=\"BADYUGRW\" origin=\"True\">\n  <all>\n    <rule in=\"ABB\" out=\"**D\"/>\n    <rule in=\"DBB\" out=\"**D\"/>\n  </all"
  },
  {
    "path": "models/SokobanLevel1.xml",
    "chars": 324,
    "preview": "<sequence values=\"BRWDI\">\n  <one file=\"Sokoban1\" legend=\"BDWIR\" symmetry=\"()\"/>\n  <one search=\"True\">\n    <rule in=\"RB\" "
  },
  {
    "path": "models/SokobanLevel2.xml",
    "chars": 531,
    "preview": "<sequence values=\"BRWDIA\">\n  <one file=\"Sokoban2\" legend=\"BIWARD\" symmetry=\"()\"/>\n  <one search=\"True\" depthCoefficient="
  },
  {
    "path": "models/StableCrawlers.xml",
    "chars": 208,
    "preview": "<sequence values=\"BUR\">\n  <one in=\"BBB/BBB/BBB\" out=\"BBB/URB/BBB\" steps=\"20\"/>\n  <all>\n    <rule in=\"**BB/URBB/**BB\" out"
  },
  {
    "path": "models/StairsPath.xml",
    "chars": 1334,
    "preview": "<sequence values=\"BDROAGE\" origin=\"True\" symmetry=\"(xy)\">\n  <all in=\"D**B\" out=\"***D\" symmetry=\"(xyz)\"/>\n  <one in=\"DBBD"
  },
  {
    "path": "models/StochasticVoronoi.xml",
    "chars": 181,
    "preview": "<sequence values=\"BYE\">\n  <one in=\"B\" out=\"E\" steps=\"10\"/>\n  <one in=\"B\" out=\"Y\" steps=\"10\"/>\n  <one>\n    <rule in=\"EB\" "
  },
  {
    "path": "models/StormySnellLaw.xml",
    "chars": 833,
    "preview": "<sequence values=\"WUGIABSR\" origin=\"True\">\n  <all in=\"UW\" out=\"*U\" symmetry=\"(x)\"/>\n  <prl in=\"U*\" out=\"G*\" symmetry=\"()"
  },
  {
    "path": "models/StrangeDungeon.xml",
    "chars": 426,
    "preview": "<sequence values=\"BWE\">\n  <prl in=\"B\" out=\"E\"/>\n  <prl in=\"***/*E*/***\" out=\"***/*B*/***\" d=\"2\"/>\n  <prl in=\"***/***/***"
  },
  {
    "path": "models/StrangeGrowth.xml",
    "chars": 68,
    "preview": "<one values=\"BW\" in=\"**B/WB*/**B\" out=\"***/*W*/***\" origin=\"True\"/>\n"
  },
  {
    "path": "models/StrangeNoise.xml",
    "chars": 200,
    "preview": "<sequence values=\"BW\">\n  <one in=\"B\" out=\"W\" steps=\"1\"/>\n  <one temperature=\"2.0\" periodic=\"False\">\n    <rule in=\"B\" out"
  },
  {
    "path": "models/SubmergedKnots.xml",
    "chars": 397,
    "preview": "<sequence values=\"BW\">\n  <all in=\"B\" out=\"W\"/>\n  <all in=\"***/***/*** ***/*W*/*** ***/***/***\" out=\"***/***/*** ***/*B*/"
  },
  {
    "path": "models/Surface.xml",
    "chars": 73,
    "preview": "<sequence values=\"B\">\n  <wfc values=\"BW\" tileset=\"Surface\"/>\n</sequence>\n"
  },
  {
    "path": "models/Tetris.xml",
    "chars": 775,
    "preview": "<sequence values=\"CIBWRAO\" symmetry=\"(x)\">\n  <union symbol=\"?\" values=\"ICB\"/>\n  <prl in=\"*/C\" out=\"*/I\"/>\n  <prl in=\"*/*"
  },
  {
    "path": "models/Texture.xml",
    "chars": 347,
    "preview": "<sequence values=\"BIURW\">\n  <one in=\"BB*/BBB/*B*\" out=\"***/*I*/***\"/>\n  <all in=\"*I*/IBI\" out=\"***/*I*\"/>\n  <all in=\"*B*"
  },
  {
    "path": "models/TileDungeon.xml",
    "chars": 290,
    "preview": "<sequence values=\"PB\">\n  <all in=\"***/*P*/***\" out=\"***/*B*/***\"/>\n  <wfc tileset=\"Dungeon\" values=\"ABW\">\n    <rule in=\""
  },
  {
    "path": "models/TilePath.xml",
    "chars": 645,
    "preview": "<sequence values=\"BAR\">\n  <all in=\"***/*B*/***\" out=\"***/*A*/***\" comment=\"color all inner cells gray\"/>\n  <one in=\"BBB/"
  },
  {
    "path": "models/Trail.xml",
    "chars": 94,
    "preview": "<one values=\"BRW\" origin=\"True\">\n  <rule in=\"RB\" out=\"WR\"/>\n  <rule in=\"RW\" out=\"WR\"/>\n</one>\n"
  },
  {
    "path": "models/Voronoi.xml",
    "chars": 181,
    "preview": "<sequence values=\"BYE\">\n  <one in=\"B\" out=\"E\" steps=\"10\"/>\n  <one in=\"B\" out=\"Y\" steps=\"10\"/>\n  <all>\n    <rule in=\"EB\" "
  },
  {
    "path": "models/WaveBrickWall.xml",
    "chars": 165,
    "preview": "<sequence values=\"B\" symmetry=\"()\">\n  <wfc sample=\"BrickWall\" values=\"bNn\" n=\"3\" periodic=\"True\" shannon=\"True\">\n    <ru"
  },
  {
    "path": "models/WaveDungeon.xml",
    "chars": 812,
    "preview": "<sequence values=\"BWDG\">\n  <all in=\"***/*B*/***\" out=\"***/*D*/***\"/>\n  <one in=\"DDDD/DDDD/DDDD\" out=\"WWWW/WWWW/WWWW\" ste"
  },
  {
    "path": "models/WaveFlowers.xml",
    "chars": 227,
    "preview": "<sequence values=\"BW\" symmetry=\"(x)\">\n  <all in=\"B/*/*\" out=\"W/*/*\"/>\n  <wfc sample=\"Flowers\" values=\"zYgN\" n=\"3\" period"
  },
  {
    "path": "models/Wilson.xml",
    "chars": 631,
    "preview": "<sequence values=\"BWIRKGYU\" origin=\"True\">\n  <all>\n    <rule in=\"WBB\" out=\"**I\"/>\n    <rule in=\"IBB\" out=\"**I\"/>\n  </all"
  },
  {
    "path": "models/WolfBasedApproach.xml",
    "chars": 925,
    "preview": "<sequence values=\"DEIWRSA\">\n  <prl in=\"***/*D*/***\" out=\"***/*E*/***\"/>\n  <one in=\"E\" out=\"W\" steps=\"15\"/>\n  <one in=\"E\""
  },
  {
    "path": "models.xml",
    "chars": 8938,
    "preview": "<models>\n  <model name=\"Apartemazements\" size=\"8\" d=\"3\" amount=\"4\"/>\n  <model name=\"Apartemazements\" size=\"8\" d=\"3\" iso="
  },
  {
    "path": "resources/palette.xml",
    "chars": 2790,
    "preview": "<colors>\n  <color symbol=\"B\" value=\"000000\" comment=\"Black\"/>\n  <color symbol=\"I\" value=\"1D2B53\" comment=\"Indigo\"/>\n  <"
  },
  {
    "path": "resources/settings.xml",
    "chars": 258,
    "preview": "<settings\n  squareSize=\"7\" smallSquareSize=\"3\" maxwidth=\"10\" zshift=\"2\"\n  hindent=\"30\" hgap=\"2\" harrow=\"10\" hline=\"14\"\n "
  },
  {
    "path": "resources/tilesets/Dungeon.xml",
    "chars": 3017,
    "preview": "<tileset>\n\t<tiles checksum=\"28\">\n    <tile name=\"Empty\"/>\n    <tile name=\"Out\" weight=\"0.5\"/>\n\t\t<tile name=\"In\" weight=\""
  },
  {
    "path": "resources/tilesets/Escher.xml",
    "chars": 3741,
    "preview": "<tileset fullSymmetry=\"True\">\n\t<tiles>\n\t\t<tile name=\"Empty\"/>\n\t\t<tile name=\"X\" weight=\"0.1\"/>\n\t\t<tile name=\"Line\"/>\n\t\t<t"
  },
  {
    "path": "resources/tilesets/EscherSurface.xml",
    "chars": 5773,
    "preview": "<tileset fullSymmetry=\"True\">\n\t<tiles>\n\t\t<tile name=\"Empty\"/>\n\t\t<tile name=\"Line\"/>\n\t\t<tile name=\"Turn\"/>\n\t\t<!--tile nam"
  },
  {
    "path": "resources/tilesets/Knots2D.xml",
    "chars": 1603,
    "preview": "<tileset>\n  <tiles checksum=\"13\">\n    <tile name=\"Empty\"/>\n    <tile name=\"Line\"/>\n    <tile name=\"Turn\"/>\n    <tile nam"
  },
  {
    "path": "resources/tilesets/Knots3D.xml",
    "chars": 1133,
    "preview": "<tileset fullSymmetry=\"True\">\n  <tiles>\n    <tile name=\"Empty\"/>\n    <tile name=\"Line\"/>\n    <tile name=\"Turn\"/>\n  </til"
  },
  {
    "path": "resources/tilesets/MarchingHills.xml",
    "chars": 1559,
    "preview": "<tileset>\n  <tiles>\n    <tile name=\"Empty\" weight=\"2.3\"/>\n    <tile name=\"Stone\" weight=\"1.7\"/>\n    <tile name=\"Wall\" we"
  },
  {
    "path": "resources/tilesets/OrientedEscher.xml",
    "chars": 3411,
    "preview": "<tileset fullSymmetry=\"True\">\n\t<tiles>\n\t\t<tile name=\"Empty\"/>\n\t\t<tile name=\"Turn\"/>\n\t\t<tile name=\"Stairs\"/>\n\t\t<tile name"
  },
  {
    "path": "resources/tilesets/OrientedStairs.xml",
    "chars": 3620,
    "preview": "<tileset>\n  <tiles>\n    <tile name=\"Empty\"/>\n    <tile name=\"Cube\" weight=\"0.5\"/>\n    <tile name=\"StairsT\"/>\n    <tile n"
  },
  {
    "path": "resources/tilesets/Partition.xml",
    "chars": 757,
    "preview": "<tileset>\n  <tiles>\n    <tile name=\"Nothing\" weight=\"2.0\"/>\n    <tile name=\"I\"/>\n    <tile name=\"T\"/>\n  </tiles>\n  <neig"
  },
  {
    "path": "resources/tilesets/PartitionedEdges.xml",
    "chars": 8030,
    "preview": "<tileset>\n  <tiles>\n    <tile name=\"Empty\"/> 1\n    <tile name=\"Line\"/> 2\n    <tile name=\"Turn\"/> 4\n    <tile name=\"X\" we"
  },
  {
    "path": "resources/tilesets/Paths.xml",
    "chars": 3412,
    "preview": "<tileset>\n  <tiles>\n    <tile name=\"Empty\" weight=\"2.0\"/>\n    <tile name=\"Line\"/>\n    <tile name=\"Turn\"/>\n    <tile name"
  },
  {
    "path": "resources/tilesets/Surface.xml",
    "chars": 2463,
    "preview": "<tileset fullSymmetry=\"True\">\n  <tiles>\n    <tile name=\"Empty\"/> 1\n    <tile name=\"Plane\"/> 3\n    <tile name=\"Angle\"/> 1"
  },
  {
    "path": "source/AllNode.cs",
    "chars": 3955,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/ArrayHelper.cs",
    "chars": 1711,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\n\nstatic class AH\n{\n    public static T[][][] Ar"
  },
  {
    "path": "source/ConvChain.cs",
    "chars": 4199,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Xml.Linq;\n\nclass ConvChainNode : N"
  },
  {
    "path": "source/Convolution.cs",
    "chars": 7027,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Linq;\nusing System.Xml.Linq;\nusing System.Collec"
  },
  {
    "path": "source/Field.cs",
    "chars": 3764,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Linq;\nusing System.Xml.Linq;\nusing System.Collec"
  },
  {
    "path": "source/GUI.cs",
    "chars": 15691,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/Graphics.cs",
    "chars": 9669,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Collections.Generic;\nusing System."
  },
  {
    "path": "source/Grid.cs",
    "chars": 4335,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/Helper.cs",
    "chars": 3507,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Collections.Generic;\n\nstatic class"
  },
  {
    "path": "source/Interpreter.cs",
    "chars": 2493,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Xml.Linq;\nusing System.Collections"
  },
  {
    "path": "source/Map.cs",
    "chars": 3977,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Xml.Linq;\nusing System.Collections.Generic;\n\ncla"
  },
  {
    "path": "source/Node.cs",
    "chars": 3328,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\n\nabst"
  },
  {
    "path": "source/Observation.cs",
    "chars": 6513,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Linq;\nusing System.Collections.Generic;\n\nclass O"
  },
  {
    "path": "source/OneNode.cs",
    "chars": 4485,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Xml.Linq;\nusing System.Collections"
  },
  {
    "path": "source/OverlapModel.cs",
    "chars": 6295,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/ParallelNode.cs",
    "chars": 1557,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Xml.Linq;\n\nclass ParallelNode : RuleNode\n{\n    b"
  },
  {
    "path": "source/Path.cs",
    "chars": 8396,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/Program.cs",
    "chars": 3607,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  },
  {
    "path": "source/Rule.cs",
    "chars": 10979,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System.Linq;\nusing System.Xml.Linq;\nusing System.Collec"
  },
  {
    "path": "source/RuleNode.cs",
    "chars": 8154,
    "preview": "// Copyright (C) 2022 Maxim Gumin, The MIT License (MIT)\n\nusing System;\nusing System.Linq;\nusing System.Xml.Linq;\nusing"
  }
]

// ... and 209 more files (download for full content)

About this extraction

This page contains the full source code of the mxgmn/MarkovJunior GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 409 files (384.9 KB), approximately 128.8k tokens, and a symbol index with 188 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!