A while ago I wrote about a way to introduce "mistakes" into a generative system, as a way of creating surprising results. Then I did an experiment where I tried to implement this using the same generative techniques I use in a lot of my other work.
What kind of mistakes you make when writing code probably depends on things like individual style, programming language and domain. What I've noticed is that I tend to make quite a few interesting mistakes when writing generative code. (Not so much when programming other things.) These mistakes are interesting for various reasons. Sometimes the mistakes yield interesting visual results in themselves.
The images in this text is an example of such a code mistake. I thought I was doing one thing, but I eventually realised that the code in fact did something different. In the end I liked the erroneous version more, and just kept it.
A programming mistake will usually cause me to examine the code more closely. In turn this can lead to better understanding of what is happening. Even better, the understanding can result in exploring some new behaviour. I know I'm not the first to think along these lines, but being aware of this is a useful part of my process.
For these kinds of mistakes to be useful to me I need some kind of visual output. In turn this means that the code has to be sufficiently resilient to various errors. That way it will produce some kind of result regardless of whether the code does what you intended or not.
- Obviously there is a difference between a syntax error and a logical error/mistake. Most (?) syntax errors will most likely just keep your code from running altogether.
- There are a lot of pretty obvious weaknesses with this approach, as I'm sure you will realize quite quickly.
- The programming model described here is one helpful way of creating such resilient code, since it will self-correct to some degree. It's probably not sufficient though.