Chaos Code

I recently watched a presentation in which the presenter had an environment that let him see changes in code immediately and visually whilst editing. The source code wasn't released, and figuring it would be a nice experiment, I've made a simple live code editor to see the consequences it would have on coding.

Looking for a visual example program, I came across a piece of code from a while back that generated a chaos fern. Here it is in realtime in javascript.

Note: You can edit these examples to play with the result

One of the things I noticed while porting it in a live editor is that the immediate feedback allows you to really play with the parameters. As you can see, I've actually set off two sequences, with slightly different parameters and different colors - this came as a direct consequence of me playing with the parameters and liking the results.

Playing with parameters that triggered subtle differences in code reminded me of the properties of strange attractors, and I thought that this would be another good example - here is the Gumowski-Mira attractor generating a creepy looking star.

Again - play with the code - particularly editing the values of i,j,k and l have big consequences in the outcome.

As I played with the result I realised that the immediate feedback loop makes this a great way to play with code, and that this would be a great way to teach coding.