Spill

Spill is a brand new live coding language that doesn’t exist yet.

In spill, there’s a big 100 by 100 grid of cells. By default they’re all black.

Cells

You can define a cell. Give it a one letter name.

$: cell("P")

Cells can have colours.

$: cell("P")
.color("pink")

You can choose colours in many ways.

$: cell("P")
.rgb(255,0,255)

I like to use splash colours.

$: cell("P")
.splash(909)

Rules

You can define a rule.

$: rule()

You can change all cells to a colour you’ve defined. This rule changes every cell to pink.

$: cell("P").splash(909)

$: rule().to("P")

You can make it so only specific cells turn into your chosen colour. This rule turns all pink cells to blue.

$: cell("P").splash("909")
$: cell("B").splash("009")

$: rule().from("P").to("B")

You can apply a rule to a specific part of the grid. This turns all cells on the top row into pink.

$: cell("P").splash(909)

$: rule().y(0).to("P")

You can make a rule happen only a certain percentage of the time. This makes the rule only happen 20% of the time.

$: cell("P").splash(909)

$: rule().y(0).to("P").chance(.2)

You can make a specific pattern of cells turn into a pattern of other cells. This rule replaces ‘pink over black’ with ‘black over pink’.

$: cell("P").splash(909)
$: cell("B").splash(0)

$: rule()
.from(`
  P
  B
`).to(`
  B
  P
`)

You might find it easier to use the diagram format for this kind of thing.

$: cell("P").splash(909)
$: cell("B").splash(0)

$: rule()
.diagram(`
  P => B
  B    P
`)

Diagrams can be any shape.

$: cell("P").splash(909)
$: cell("B").splash(0)

$: rule()
.diagram(`
  P  => B
   B     P
`)

You can give a rule symmetry to make it apply in various directions or rotations.

$: cell("P").splash(909)
$: cell("B").splash(0)

$: rule()
.diagram(`
  P  => B
   B     P
`).symmetry("x")

Congratulations! You’ve now made pink sand.

$: cell("P").splash(909)
$: cell("B").splash(0)

$: rule().y(0).to("P").chance(.2)

$: rule()
.diagram(`
  P => B
  B    P
`)

$: rule()
.diagram(`
  P  => B
   B     P
`).symmetry("x")

back to the spill