purlhaps Early prototype

Knit the swatch in your browser before you knit it for real.

purlhaps is a knitting simulator. You write a stitch pattern in a small text language, it works out how each loop pulls through the one below, and it shows you the fabric in 3D.

pattern brioche
  cast on 16
  row setup: *sl1yo, k1*
  row 1: *sl1yo, brk*
  work setup
  work 1 x 23

# Two slips in time: each column
# is slipped on two rows running.
pattern brioche-held-2 from brioche
  row 1: *sl1yo, brk*
  row 2: *p, sl1yo*
  row 3: *brp, sl1yo*
  row 4: *sl1yo, k*
  work setup
  work 1 2 3 4 x 6
Every pattern reads cleanly
Brioche rib rendered in 3D: tall, plump knit columns standing out from recessed purl columns.
brioche
The held variant rendered in 3D: the columns break up into a lattice of crossing loops.
brioche-held-2from brioche

Change one line, look again

The point is to answer "what if" questions cheaply. What if brioche, but with two slips? What if the float goes in front? What happens when I forget the decrease? You change the pattern and look at the result instead of casting on again.

The swatches above are both brioche. The second one slips each column on two rows running, and the fabric opens into a lattice.

How it works

Variants only state what changes

A pattern can start from another one and override rows, or swap stitches outright. Here a slip-stitch rib gets its floats moved to the front:

pattern slip-rib
  cast on 15
  row 1: k1, *sl1, k1*
  row 2: *p*
  work 1 2 x 10

pattern slip-rib-front from slip-rib
  replace sl1 -> sl1 wyif

purlhaps is an early prototype. The stitch set, the language and the physics are all still changing.