|
|
|
|
|
by _caw
383 days ago
|
|
I tried and failed to write a knitting interpreter that could take a written pattern and generate a visual representation. You could have variables that expand into larger expressions, and some kind of "syntax highlighting" or verification step to make sure things are consistent. Interested to know if you've ever tried something like that? I also get that knitting is a hobby many people do to escape computers for a minute. Anyways, that got me into approaching the problem from a different angle (https://madhatter.app). A visual editor for hat patterns with layering, repeats, shapes, overstitching markers. Some stuff is broken right now and it doesn't look great on mobile, but I'm building it in real time whenever my partner expresses frustration in some aspect of existing paid software ;-) |
|
I haven't tried writing a knitting interpreter, even though that it extremely within the Venn diagram intersection of my interests. I have spent some time thinking about trying to formalizing knitting pattern notation. Right now, it's, like mostly there, but every pattern tweaks things in ways that are often arbitrary and confusing.
Knitting patterns are an interesting programming language. Ignoring the resulting fabric for a moment, one way to think of them is that they are an encoding of a linear series of steps the knitter is supposed to perform.
As any programmer knows, there are a whole bunch of possible programs that produce the same output:
Versus: One of the challenges of designing a knitting pattern is coming up with a good encoding for the series of stitches to be created. You might think that the shortest encoding is best, but what you're really trying to optimize for is how easy is it mentally keep track of where you are.A knitting pattern that, say, has deeply nested loops, can require the knitter to hold multiple indexes in their head (or using external counters) and increases the odds of making a mistake. Unrolled some of those loops manually might be more verbose but less error prone. Or not! Maybe the extra verbosity of the long list of stitches makes it easier to lose your place.
Even things like choosing where to place stitch markers can have an effect on how user-friendly the pattern is.
It's an interesting design problem. You're trying to design a set of instructions to produce a good object, but you're also trying to design a set of instructions that yield a good experience producing that object.