The Nature of Code
- Spring 2010
- Section 1: Tuesdays 12:30 - 3:00 pm
- Section 2: Wednesdays 12:30 - 3:00 pm
- Daniel Shiffman, daniel.shiffman@nyu.edu
- Office Hours Signup
Important Sites
Syllabus
Week 1 -- Jan 19/20 -- Numbers and Vectors
- Class Intro / Overview
- Processing review
- Randomness, Probability, and Perlin Noise
- Object Oriented Programming Review & Vectors
- Assignment: Sign up for the class mailing list: join-itp-noc@lists.nyu.edu
- 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 develop a set of rules for moving the Walker. Can you do it without using any random whatsoever? 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: Processing PVector tutorial, also available as PDF.
- 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!
- Mathematics and Physics for Programmers, Chapter 1 -- Numbers, Danny Kodicek (optional)
Week 2 -- Jan 26/27 -- 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 2/3 -- 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
- Research and implement a simulation of Torque.
- 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.
- 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)
Week 4 -- Feb 9/10 -- Libraries!
- Box2D tutorial: http://www.shiffman.net/teaching/nature/box2d-processing/
- Toxiclibs tutorial: http://www.shiffman.net/teaching/nature/toxiclibs/
- Google code repository: http://code.google.com/p/pbox2d/
- Reading: This isn't terribly exciting, but read the Box2D manual. It's actually quite helpful for the concepts (you can ignore the code and focus on our class examples instead.)
- Assignment: Use a physics library. For example, you might:
- Take one of the Box2D examples and simply change the way it is rendered. What kind of scene can you create with color, images, texture, shapes, etc? For example, can you turn the "Blob" example into a cute, cuddly creature with eyes, nose, mouth, and hair? (See: Nokia Friends or Big Screams for inspiration)
- Recreate one of your previous assignments using Box2D. Does Box2D make your life easier or more difficult? Is the result better or worse?
- Research Toxiclibs and incorporate its features into a Processing sketch.
Week 5 -- Feb 16/17 -- Particle Systems
- ArrayLists
- Advanced Object Oriented Programming -- Inheritance and Polymorphism
- Box2D particle System: http://www.shiffman.net/itp/classes/nature/box2d_2010/liquid
- Connected systems (using toxiclibs): http://www.shiffman.net/teaching/nature/toxiclibs/
- Reading: "Particle animation and rendering using data parallel computation", Karl Sims (available via NYU network/proxy)
- Reading: "Particle Systems, a Technique for Modeling a Class of Fuzzy Objects", Reeves (available via NYU network/proxy)
- Reading: How my Dog learned Polymorphism
- Other suggested reading: Particle Systems (Siggraph), Particle System API, by David K. McAllister, Particle Systems by Allen Martin
- Flight404's Particle example: http://www.flight404.com/blog/?p=113
- Assignment: Develop a proposal and a prototype for a "midterm" project. The scope of the project can be quite large (trial idea for a final, for example), however, you will not be expected to implement the entire project. For the proposal, include a description, relevant links, and a quick Processing sketch of the first step towards the idea. Link your proposal from the wiki. Next week, we will look at a selection of proposals and then on Mar 2/3, the results for all midterm projects will be presented.
Week 6 -- Feb 23/24 -- Steering Behaviors
- A bit more on inheritance + interfaces
- Autonomous Agents
- Steering Forces
- Reading: Handout provided via listserv about Braitenberg Vehicles. Vehicles book
- Reading: Steering Behaviors For Autonomous Characters, Craig Reynolds
- Assignment: Complete midterm project, post link to wiki and be prepared to present next week. Please note again this doesn't not need to be a fully realized project. You can use drawings, images, video, and text to describe your ideain addition to your first step implementation.
Week 7 -- Mar 2/3 -- Present Midterm
Week 8 -- Mar 9/10 -- Complex Systems
- Self-Organization Craig Reynolds' Boids -- Alignment, Cohesion, Separation
- 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?
- 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.
SPRING BREAK
Week 9 -- Mar 23/24 -- More Complex Systems + Self-Similarity
- Wolfram CA, The Game of Life
- 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
- Watch: Nova: The Hidden Dimension
- Assignment: Sign up for a final project proposal and presentation slot. Include in your proposal a title, brief description, and links to things you want to show / talk about -- work that inspired you, reference pages, sketches you've made, sample programs/code, previous projects, etc.
Week 10 -- Mar 30/31 -- Genetic Algorithms and Final Project Proposals
Week 11 -- Apr 6/7 -- Genetic Algorithms, Neural Networks and Final Project Proposals
Week 12 -- Apr 13/14 -- Neural Networks, Final Project Proposals, and misc. workshop time
Week 13 -- Apr 20/21 -- Final Project Presentations
Week 14 -- Apr 27/28 -- Final Project Presentations
Reading Materials
Homework
Students are required to complete a programming exercise each week. Documentation for each assignment should be posted to the linked wiki page.
Requirements: (no incompletes)
- 50% homeworks
- 30% final project
- 20% class participation, attendance
|