Skip to content

Commit

Permalink
MultiHeaded models
Browse files Browse the repository at this point in the history
  • Loading branch information
mxgmn committed Jun 17, 2022
1 parent 5cd4019 commit 213b3f1
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ Sources of examples:
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).

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).

Expand Down
3 changes: 3 additions & 0 deletions models.xml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<model name="MazeMap" size="30"/>
<model name="MazeTrail" size="59" steps="1000"/>
<model name="MazeTrail" size="27" d="3" steps="1000"/>
<model name="MultiHeadedDungeon" size="55"/>
<model name="MultiHeadedWalk" size="99"/>
<model name="MultiHeadedWalkDungeon" size="59"/>
<model name="NestedGrowth" size="80" steps="100"/>
<model name="NoDeadEnds" size="39"/>
<model name="NoDeadEnds" size="19" d="3"/>
Expand Down
18 changes: 18 additions & 0 deletions models/MultiHeadedDungeon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<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>
7 changes: 7 additions & 0 deletions models/MultiHeadedWalk.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<markov values="BRGW" origin="True">
<sequence>
<one in="RB" out="*G" steps="3"/>
<all in="R" out="W"/>
<all in="G" out="R"/>
</sequence>
</markov>
14 changes: 14 additions & 0 deletions models/MultiHeadedWalkDungeon.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<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>
7 changes: 2 additions & 5 deletions syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ See examples of union use in [DungeonGrowth](models/DungeonGrowth.xml).
## Inference
Inference in MarkovJunior allows to impose constraints on the future state, and generate only those runs that lead to the constrained future. Inference is triggered by putting `observe` elements inside rulenodes (inside `one` or `all` nodes, to be precise). Observe elements have 3 attributes: `value`, `from`, `to`.

For example, `<observe value="W" to="BR"/>` means that squares that are currently white should become black or red after a chain of rule applications.

`<observe value="I" from="B" to="W"/>` means that squares that are currently indigo are turned black immediately, and then should become white after a chain of rule applications.
For example, `<observe value="W" to="BR"/>` means that squares that are currently white should become black or red after a chain of rule applications. `<observe value="I" from="B" to="W"/>` means that squares that are currently indigo are turned black immediately, and then should become white after a chain of rule applications.

In [SokobanLevel1](models/SokobanLevel1.xml) we say that the goal `I`-squares should become white - this would mean that the puzzle is solved. We also help the inference engine by explicitly saying that the current black, white and red squares should *not* be white in the end. Since we don't have `I` in the ruleset, we say that current indigo squares should be treated as black by setting `from="B"`.

Expand Down Expand Up @@ -92,6 +90,5 @@ See examples of `convchain` node use in [ChainMaze](models/ChainMaze.xml), [Chai


## Questions and Answers
**Q:** How to make a loop? How to make a sequence repeat?

**Q:** How to make a loop? How to make a sequence repeat?<br/>
**A:** To make a sequence repeat, put a `sequence` node inside a `markov` node. Examples of this: [HamiltonianPath](models/HamiltonianPath.xml), [SelectLargeCaves](models/SelectLargeCaves.xml), [SelectLongKnots](models/SelectLongKnots.xml), [FireNoise](models/FireNoise.xml), [SmartSAW](models/SmartSAW.xml), [FindLongCycle](models/FindLongCycle.xml). Counters in markov/sequence nodes are not supported right now. Instead, you may want to repeat the sequence until some node is matched.

0 comments on commit 213b3f1

Please sign in to comment.