Nature-of-Code-S09
Syllabus / Nature-of-Code-S09

## The Nature of Code

• Spring 2009
• Section 1: Wednesdays 12:30 - 3:00 pm
• Section 2: Thursdays 12:30 - 3:00 pm
• Daniel Shiffman, daniel.shiffman@nyu.edu
• Office Hours Signup

## Syllabus

Week 1 -- Jan 21/22 -- Numbers and Vectors

• Class Intro / Overview
• Processing review
• Randomness, Probability, and Perlin Noise
• Object Oriented Programming Review & Vectors
• Assignment: Take a look at these two examples of a square randomly moving around the screen: Walker without vectors, Walker with vectors. Find an example of real-world "natural" motion (preferably in the form of an online video) and using the techniques illustrated this week in class, develop a set of rules for moving the Walker with controlled randomness. Without changing how the square looks at all (changing size or rotation is ok), can you give it a personality or make it appear to have an emotional quality? Create a second version with the same behavior, but with your own non-square design. Feel free to design an environment for the Walker to live in as well. We'll compare the versions in class next week. Can we create something natural through algorithmic behaviors alone? How much does visual design play a part? Post a link to your work, as well as any thoughts on the above, on the homework wiki.
• Reading: Computational Beauty of Nature, Introduction, Gary William Flake (you must be logged in through NYU to access the online version.)
• Reading: Probability Theory -- great friendly site!
• Introduction to Probability, Grinstead, Snell (optional) -- this is long, a lot of material, not as friendly, chapters 1-2 is probably a good goal.
• Mathematics and Physics for Programmers, Chapter 1 -- Numbers, Danny Kodicek (optional)

Week 2 -- Jan 28/29 -- Vectors and Forces

• Object Oriented Programming Review & Vectors
• Attraction/Repulsion
• Friction/Drag
• Reading: Newtonian Physics, An Online Textbook (This is long, you may find Chapter 4 to be particularly relevant to this week's discussion.)
• Reading: The Physics Classroom -- Newton's Laws
• Reading: Mathematics and Physics for Programmers, Chapters 12 and 14, Danny Kodicek (suggested)
• Homework (choose one / create your own) Post your work on the wiki:
• Rework your motion sketch from week 1 using PVector. Try incorporating the concept of forces into the environment by affecting only the acceleration. Create a formula for calculating a dynamic acceleration, one that changes over time based on any number of factors. Make more than one object by creating an array.
• Redo the basic forces examples to have a Liquid class. Make more than one liquid object. Example Answer
• Research a force not covered in class and implement it as a vector.
• Use the concept of forces to visualize some input (could be data, literal example would be get windspeed online and translate to a wind force in Processing, but feel free to think more abstractly)

Week 3 -- Feb 4/5 -- Oscillations

• (First, continuation of Forces)
• Trigonometry
• Polar vs. Cartesian Coordinates
• Pendulum
• Graphing waves (perlin noise waves)
• 2D trig equation graphing ("graphing inequalities")
• Reading: Trigonometry, What is it good for? (follow along to 7 parts)
• Reading: The Mathematics of Oscillatory Motion (refer to e-mail to class list.)
• Reading: Mathematics and Physics for Programmers, Chapter 4, Danny Kodicek (suggested)
• Assignment: Incorporate oscillatory motion into a previous assignment (or create a new one). Some suggestions:
• Create a moving body with a shape made from oscillating parts, i.e. the object moves according to the usual vector motion, but its shape incorporates oscillation around its center point. Example Answer
• Rework the wave examples to have a Wave class and visualize the wave using something other than circles. Example Answer (minus the change in visualization)
• String together a series of pendulums so that the endpoint of one is the origin point of another.
• Create an object-oriented version of an oscillating Spring. Examples to get you started: Spring on processing.org, Springs on processing.org. Incorporate PVector into your class so that you Spring can respond to other forces as well.

Week 4 -- Feb 11/12 -- Particle Systems

Week 5 -- Feb 18/19 -- Steering Behaviors

Week 6 -- Feb 25/26 -- Midterm Workshop

Week 7 -- Mar 4/5 -- Complex Systems

• Self-Organization Craig Reynolds' Boids -- Alignment, Cohesion, Separation
• Cellular Automata -- Wolfram CA, The Game of Life
• Reading: Chapter 15, Cellular Automata, Computational Beauty of Nature, Flake
• Reading: Chapter 16 — Autonomous Agents and Self-Organization, The Computational Beauty of Nature, Gary William Flake,
• Reading: Conway's Game of Life, Scientific American, 1970
• Reading: Exploring Emergence, Mitchel Resnick and Brian Silverman Epistemology and Learning Group MIT Media Laboratory
• Reading: From Ants to People, an instinct to Swarm
• Assignment: Choose one of the following options or create your own.
• Develop your midterm project one step further based on class feedback / discussion.
• Using the flocking example as a model, develop your own set of rules for boid interaction.
• Implement Flake's "View" rule, described in Computational Beauty of Nature
• Combine the concepts of Cellular Automata with the flocking example -- what happens if you assign each boid a "state" which influences its behavior?
• Consider the state of a cell to be its color. What types of image processing filters can you create using the principles of Cellular Automata?

Week 8 -- Mar 11/12 -- Self-Similarity

• Fractals, MandelBrot Set
• Recursion
• L-Systems
• Reading: The Computational Beauty of Nature, Gary William Flake, Chapter 5 — Self-Similarity and Fractal Geometry, Chapter 6 — L-Systems and Fractal Growth
• Reading: Algorithmic Beauty of Plants -- suggested
• Assigment: Choose one of the following options or create your own.
• Sketch out a concept you've been thinking about for a final project. (Feel free to also continue your midterm work.)
• Implement one of Reynolds steering behaviors not covered in class.
• Develop your own rules for a Cellular Automata, 1D or 2D. This could be something completely made up or a simulation of real-world phenomena. For example, forest fires: [http://en.wikipedia.org/wiki/Forest-fire_model] or Predator, Prey [p. 191 of Computational Beauty of Nature.]
• Develop an alternative "Game of Life" with time as factor, i.e. what does it mean for a cell to be "alive" or "dead" for many frames in a row.
• Design a creature using the principles of recursion. Create motion behaviors for that creature using topics we've previously covered this semester.

## SPRING BREAK

Week 9 -- Mar 25/26 -- Genetic Algorithms

Week 10 -- Apr 1/2 -- Neural Networks and Final Project Proposals

Week 11 -- Apr 8/9 -- Final Project Proposals

Week 12 -- Apr 15/16 -- Final Project Proposals

Week 13 -- Apr 22/23 -- Final Project Presentations

Week 14 -- Apr 29/30 -- Final Project Presentations