Skip to content

Latest commit

 

History

History

examples

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Examples of using Soffit

Building a chain of nodes

A simple example that just adds nodes in a line.

chain example

source

Tree

A branching structure, demonstrating the use of Graphviz attributes as tags.

tree example

source

Tracery

Translation of a Tracery grammar into Soffit:

tracery example

source

Grid

Building a grid

grid example

source -- notes

Fixed-sized binary trees

Demonstration of using a countdown timer to terminate the growth of the binary tree after a given number of nodes have been added. Three examples from the same grammar are shown.

1 2 3
binary tree example binary tree example binary tree example

source

Rule 30 Cellular Automaton

This grammar creates a fixed-sized grid using the techniques from the previous two examples, then implements a 1-d ceullar automaton on the result.

The "cursor" tag moves across the row adding one "x" at a time:

   eXe
  SXC

   eXe
  SXXC

   eXe
  SXXXC

At the end of a row, a rule caps it with an end marker and starts a new row below the "S", if there are any "row" tags left to consume.

   eXe
  eXXXe
 SXC

This rule is illustrated below:

left graph right graph
left right

The example here has been run through three different rule sets to apply styles to the edges (still present, but colored white so they don't show) and to the nodes.

rule 30 example

source

edge styling

node styling

Command line:

python -m soffit.application -i 3000 doc/examples/1d-cellular-rule30.json \
   doc/examples/1d-celluar-display-edges.json \
   doc/examples/1d-cellular-display.json

Cyclic Generation

In "Procedural Generation in Game Design" (Tanya X. Short and Tarn Adams, editors), Dr. Joris Dormans gives a simple example of a set of graph generation rules on page 88 that implement a lock-and-key puzzle.

I don't have "embedded" nodes like his example shows, and instead used a separate node for the lock and key, with tagged edges showing the relationship.

Dormans example

source code

Random Pentominos

A pentomino can be viewed as either a chain 1-2-3-4-5 or a forked chain 1-2-3-4 3-5. (Some shapes can be represented both ways.) So we can generate random pentominos on a grid by matching these two patterns with previously-unmatched squares. Without wildcarding, it's difficult to generate a lot of different colors.

Three pentominos on a 5x5 grid

source code

Graphs with Euler Circuits

This rule enerates a graph and its euler circuit simultaneously. See "What is an example problem of an Eulerian circuit with an answer" on Quora.

The graph is encoded with nodes tagged "node" and edges tagged "edge", so it would require an additional set of transformations to display normally.

A nine-node graph with an Euler Cycle

source code

Gists

These gists can be loaded directly into Soffit's online environemnt.