Nature of Code

Neural Networks - April 09, 2018

Because Neural Networks are such a massive topic, crossing so many disciplines (Computer Science, Mathematics, Statistics and Data Science), I wanted to focus this week on building a foundational understanding of their structure and operation. To that end, I recreated the “Toy Neural Network” described in this series of videos on the Coding Train youtube channel. Rather than using a higher-level framework like ml5.js, tensorflow.js or ml4a, these videos build from scratch an entire working neural network in javascript.

Genetic Algorithms - March 30, 2018

This week I recreated Roger Johansson’s Evolving Mona Lisa, which attempts to ‘evolve’ an image (the Mona Lisa) from a number of randomly-placed and randomly-colored triangles. In particular, this project does the following: * Setup a random DNA string (application start) 1. Copy the current DNA sequence and mutate it slightly 2. Use the new DNA to render polygons onto a canvas 3. Compare the canvas to the source image 4.

Herding Agents - February 26, 2018

Key: Sheep are represented by smaller triangles. Herding Dog is represented by the larger triangle. Border fences are represented by white lines. The sheep avoid crossing this border. The dog does not. The red circle represents the center of mass of the flock of sheep. It is calculated by averaging each sheep’s position. The blue circle represents the dog’s target for the sheep. When the center of mass of the flock reaches this target, the dog is given a new target.

Point Cloud Particle System - February 19, 2018

keyboard controls: move: arrow keys rotate: shift + arrow keys zoom: option + arrow keys gravity: ‘g’ key home: ‘h’ key Full code available here For this week’s assignment, I was inspired by Karl Sims’ Particle Dreams animation from 1988. In particular, I wanted to recreate the cloud of particles at 20s which variously composes and destroys a large foreboding head shape in a number of unique ways.

Oscillating Motion - February 12, 2018

For this week’s exploration into oscillating motion, I wanted to capture some of the playfulness and fun inherent in the chaotic motion of the double pendulum. Many incredible visuals online capture the mathematical complexity and underlying patterns to this motion, but I felt there were aspects of this motion that went unexplored.

Forces and Vectors - February 05, 2018

This week, we looked at how vectors and vector math can provide a valuable framework for building a physics engine. Because the underlying math for manipulating vectors remains the same whether we are dealing with position, velocity, acceleration or multiple independent force vectors, our code can rely on a single set of functions to perform vector manipulations. Luckily for us, most of these functions are already baked into the p5.

Random Walker - January 28, 2018

I wanted to explore how the random walker could be used to create or destroy an image. Could a series of seemingly random actions coalesce to become a coherent whole? I wanted to pull an image into its constituent units, and have those units each move independently of each other, finding their position in the image through a seemingly random path. At first, I gave each walker a destination position in addition to their random starting location.