├── .gitignore ├── images └── cover.png ├── README.md ├── class.asciidoc ├── testing ├── variables_flow_part2.asciidoc └── variables_flow_setup_and_draw.asciidoc ├── week7.asciidoc ├── book.asciidoc ├── presentation_schedule.asciidoc ├── Syllabus-2013.asciidoc ├── week11.asciidoc ├── week6.asciidoc ├── week9.asciidoc ├── week10.asciidoc ├── week3.asciidoc ├── week4.asciidoc ├── week1.asciidoc ├── week8.asciidoc ├── week5.asciidoc ├── week2.asciidoc └── Syllabus-2012.asciidoc /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | scratch* 3 | -------------------------------------------------------------------------------- /images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nature-of-code/The-Nature-of-Code-Course/HEAD/images/cover.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | The-Nature-of-Code-Course 2 | ========================= 3 | 4 | Syllabus and Course Materials for The Nature of Code. Book code examples are here: https://github.com/shiffman/The-Nature-of-Code-Examples -------------------------------------------------------------------------------- /class.asciidoc: -------------------------------------------------------------------------------- 1 | :bookseries: basic 2 | 3 | = Nature of Code Class 4 | 5 | include::noc_syllabus.asciidoc[] 6 | 7 | include::variables_flow_setup_and_draw.asciidoc[] 8 | 9 | include::variables_flow_part2.asciidoc[] -------------------------------------------------------------------------------- /testing/variables_flow_part2.asciidoc: -------------------------------------------------------------------------------- 1 | == Flow, setup and draw (Part II) 2 | 3 | video::http://d4uxalfja0cvd.cloudfront.net/1234000000898/videos/01e141e7a41e53c8353742d44120e5de.mp4[poster='http://d4uxalfja0cvd.cloudfront.net/1234000000898/videos/01e141e7a41e53c8353742d44120e5de_4.jpg'] 4 | -------------------------------------------------------------------------------- /week7.asciidoc: -------------------------------------------------------------------------------- 1 | [[week7]] 2 | [preface] 3 | = Nature of Code: Week 7 4 | 5 | [[week5_video9]] 6 | [role="shoutout"] 7 | .Midterm Documentation Links 8 | **** 9 | Please post a link to your midterm documentation here. Your documentation should include something visual (screen capture, video documentation, or running JS sketch) as well as documentation of your source code. 10 | **** 11 | -------------------------------------------------------------------------------- /book.asciidoc: -------------------------------------------------------------------------------- 1 | :bookseries: basic 2 | 3 | = Nature of Code Course 4 | 5 | include::Syllabus-2013.asciidoc[] 6 | 7 | include::presentation_schedule.asciidoc[] 8 | 9 | include::week1.asciidoc[] 10 | 11 | include::week2.asciidoc[] 12 | 13 | include::week3.asciidoc[] 14 | 15 | include::week4.asciidoc[] 16 | 17 | include::week5.asciidoc[] 18 | 19 | include::week6.asciidoc[] 20 | 21 | include::week7.asciidoc[] 22 | 23 | include::week8.asciidoc[] 24 | 25 | include::week9.asciidoc[] 26 | 27 | include::week10.asciidoc[] 28 | 29 | include::week11.asciidoc[] -------------------------------------------------------------------------------- /presentation_schedule.asciidoc: -------------------------------------------------------------------------------- 1 | [preface] 2 | == Homework Presentation Schedule 3 | 4 | Because of the large class size and experimental "studio" structure, there is not a lot of time in class for homework presentations and critque. However, I would like everyone to have at least one chance to show their work in class. It's useful for everyone to get to see example projects along the way each week to week so hopefully this will fill that need. Here is our schedule: 5 | 6 | ==== Week 2: Feb 6 7 | * Maria Paula 8 | * Matt L 9 | * Matt E 10 | * Su 11 | * Melissa 12 | 13 | ==== Week 3, Feb 13 14 | * Archana 15 | * Colin 16 | * David 17 | * Gal 18 | * Sam 19 | * Michelle 20 | * Peiqi 21 | 22 | ==== Week 4, Feb 20 23 | * Youjin 24 | * Jorge 25 | * Katie 26 | * Luca 27 | * Maxim 28 | * Nadine 29 | * GJ 30 | 31 | ==== Week 5, Feb 27 32 | * Mike A 33 | * Lilia 34 | * Rose 35 | * Louise 36 | * Ju 37 | 38 | ==== Week 6, Mar 6 39 | * Monica 40 | * Sonia 41 | * Talya 42 | * Tarana 43 | * Vanessa 44 | * Lei 45 | * Bill 46 | * Asli 47 | 48 | Rest of semester TBA -------------------------------------------------------------------------------- /testing/variables_flow_setup_and_draw.asciidoc: -------------------------------------------------------------------------------- 1 | == Flow, setup and draw (Part I) 2 | 3 | In this section, we cover: 4 | 5 | * The main event loop 6 | * Creating variables 7 | * Basic Interaction 8 | * Foo 9 | * Bar 10 | 11 | video::http://d4uxalfja0cvd.cloudfront.net/1234000000898/videos/dc107985e8648ca28d032b104422c4ea.mp4[poster='http://d4uxalfja0cvd.cloudfront.net/1234000000898/videos/dc107985e8648ca28d032b104422c4ea_4.jpg'] 12 | 13 | === Exercise 14 | 15 | There's probably a creative excercise I could make here, but instead I've just shown a bouncing ball: 16 | 17 | [source, processingjslive] 18 | ---- 19 | // Learning Processing 20 | // Daniel Shiffman 21 | // http://www.learningprocessing.com 22 | 23 | // Example 5-6: Bouncing Ball 24 | int x = 0; 25 | int speed = 1; 26 | 27 | void setup() { 28 | size(200,200); 29 | smooth(); 30 | } 31 | 32 | void draw() { 33 | background(255); 34 | 35 | // Add the current speed to the x location. 36 | x = x + speed; 37 | 38 | // Remember, || means "or." 39 | if ((x > width) || (x < 0)) { 40 | // If the object reaches either edge, multiply speed by -1 to turn it around. 41 | speed = speed * -1; 42 | } 43 | 44 | // Display circle at x location 45 | stroke(0); 46 | fill(175); 47 | ellipse(x,100,32,32); 48 | } 49 | ---- 50 | 51 | -------------------------------------------------------------------------------- /Syllabus-2013.asciidoc: -------------------------------------------------------------------------------- 1 | [preface] 2 | = Syllabus 3 | 4 | * Daniel Shiffman, daniel.shiffman@nyu.edu 5 | 6 | ==== Important Sites 7 | * Book: http://natureofcode.com[http://natureofcode.com] 8 | * Code Examples: https://github.com/shiffman/The-Nature-of-Code-Examples[https://github.com/shiffman/The-Nature-of-Code-Examples]) 9 | * All videos: https://vimeo.com/channels/464686[https://vimeo.com/channels/464686] 10 | * Mailing list: https://groups.google.com/a/itp.nyu.edu/group/natureofcode/[https://groups.google.com/a/itp.nyu.edu/group/natureofcode/] 11 | 12 | ==== Schedule 13 | * <> 14 | * <> 15 | * <> 16 | * <> 17 | * <> 18 | * <> 19 | * <> 20 | * <> 21 | * <> 22 | * <> 23 | * <> 24 | * Week 12: Final Project Proposals 25 | * Week 13: Final Project Workshop 26 | * Week 14: Final Project Presentations 27 | 28 | ===== Requirements 29 | 30 | * Students are required to complete a programming exercise each week. A link to documentation for each assignment should be posted to this site using the comments (see instructions on homework pages). 31 | * Each week, a selection of students will be assigned to present their homework assignment in class. 32 | * Students should also submit questions 33 | 34 | Requirements: (no incompletes) 35 | 50% homeworks 36 | 30% final project 37 | 20% class participation, attendance 38 | -------------------------------------------------------------------------------- /week11.asciidoc: -------------------------------------------------------------------------------- 1 | [[week11]] 2 | [preface] 3 | = Nature of Code: Week 11 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | 9 | [[week11_GA]] 10 | [preface] 11 | == Introduction to Genetic Algorithms 12 | 13 | video::http://player.vimeo.com/video/64663043[height='300', width='500', poster='generic_video.png'] 14 | 15 | [[week11_video1]] 16 | [role="shoutout"] 17 | .Confused by this video? 18 | **** 19 | Post any questions or comments here. 20 | **** 21 | 22 | This video covers genetic algorithms and looks at how they are applied in 3 scenarios. 1: search problems where brute force is an impossibility (infinite monkey theorem). 2: physics-based systems 3: Interactive selection (i.e. user behavior driven fitness). 23 | 24 | This video is excerpted from a presentation given at Kickstarter. Full video is here: https://vimeo.com/63755542[https://vimeo.com/63755542] 25 | 26 | * Read along: http://natureofcode.com/book/chapter-9-the-evolution-of-code/[Chapter 9] 27 | 28 | * http://www.karlsims.com/evolved-virtual-creatures.html[Evolved Virtual Creatures] 29 | * http://en.wikipedia.org/wiki/Infinite_monkey_theorem[Infinite Monkey Theorem] 30 | * http://www.blprnt.com/smartrockets/[Smart Rockets] 31 | * http://boxcar2d.com/[BoxCar2D] 32 | * http://www.karlsims.com/galapagos/[Galapagos] 33 | 34 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp9_ga[All Chapter 9 Processing examples] 35 | 36 | [[week11_homework]] 37 | [preface] 38 | == Homework Week 11 39 | 40 | Final Project Proposals are due next week. 41 | 42 | The final project should be a creative project that builds off of or is inspired by the concepts we've covered this semester. You should feel free to think non-traditionally, final projects do not need to be screen-based or even involve programming 43 | 44 | Use the space below to propose your final project. You can either link to your own site or write your proposal in the comment itself. It's up to you to best present your idea, but at a minimum you should include: 45 | 46 | * Title and short paragraph description 47 | * Visual documentation -- drawings, videos, images, code sketches, etc 48 | * Links to inspiration and source material 49 | -------------------------------------------------------------------------------- /week6.asciidoc: -------------------------------------------------------------------------------- 1 | [[week6]] 2 | [preface] 3 | = Nature of Code: Week 6 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | 12 | * <> 13 | 14 | [[week6_toxiclibs]] 15 | [preface] 16 | == What is ToxicLibs VerletPhysics? 17 | 18 | video::http://player.vimeo.com/video/62395897[height='300', width='500', poster='generic_video.png'] 19 | 20 | [[week6_video1]] 21 | [role="shoutout"] 22 | .Confused by this video? 23 | **** 24 | Post any questions or comments here. 25 | **** 26 | 27 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section15[The Nature of Code: Chapter 5] 28 | * http://toxiclibs.org/[ToxicLibs] 29 | * https://vimeo.com/1472427[The Making of Nokia Friends] 30 | * http://www.gamasutra.com/resource_guide/20030121/jacobson_pfv.htm[Advanced Character Physics] 31 | 32 | [week6_toxiclibs_basics] 33 | [preface] 34 | == ToxicLibs VerletPhysics: Particles and Springs 35 | 36 | video::http://player.vimeo.com/video/62395895[height='300', width='500', poster='generic_video.png'] 37 | 38 | [[week6_video2]] 39 | [role="shoutout"] 40 | .Confused by this video? 41 | **** 42 | Post any questions or comments here. 43 | **** 44 | 45 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section16[The Nature of Code: Chapter 5] 46 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/NOC_5_10_SimpleSpring[Example 5.10: Simple ToxicLibs Spring] 47 | 48 | [week6_toxiclibs_connected] 49 | [preface] 50 | == Connected Systems in ToxicLibs 51 | 52 | video::http://player.vimeo.com/video/62395895[height='300', width='500', poster='generic_video.png'] 53 | 54 | [[week6_video3]] 55 | [role="shoutout"] 56 | .Confused by this video? 57 | **** 58 | Post any questions or comments here. 59 | **** 60 | 61 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section18[The Nature of Code: Chapter 5] 62 | * https://vimeo.com/1472427[The Making of Nokia Friends] 63 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/NOC_5_11_SoftStringPendulum[Example 5.11: Soft Swinging Pendulum] 64 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/NOC_5_12_SimpleCluster[Example 5.12: Simple Cluster] 65 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/Exercise_5_13_SoftBodySquareAdapted[Example 5.13: Soft Body (Cloth) Simulation] 66 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/Exercise_5_15_ForceDirectedGraph[Exercise 5.15: Force Directed Graph] 67 | 68 | [week6_attraction] 69 | [preface] 70 | == Attraction Behaviors 71 | 72 | video::http://player.vimeo.com/video/62395896[height='300', width='500', poster='generic_video.png'] 73 | 74 | [[week6_video3]] 75 | [role="shoutout"] 76 | .Confused by this video? 77 | **** 78 | Post any questions or comments here. 79 | **** 80 | 81 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section20[The Nature of Code: Chapter 5] 82 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/toxiclibs/NOC_5_13_AttractRepel[Example 5.13: Attract and Repel] 83 | * http://haptic-data.com/toxiclibsjs/examples/Attraction2D_pjs.html[Attraction2D (from Toxiclibs examples)] 84 | 85 | [[week6_homework]] 86 | [preface] 87 | == Homework Week 6 88 | 89 | For this week, you should finish midterm project and <>. 90 | 91 | 92 | 93 | -------------------------------------------------------------------------------- /week9.asciidoc: -------------------------------------------------------------------------------- 1 | [[week8]] 2 | [preface] 3 | = Nature of Code: Week 9 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | 12 | [[week9_ca]] 13 | [preface] 14 | == Introduction to Cellular Automata 15 | 16 | video::http://player.vimeo.com/video/64198156[height='300', width='500', poster='generic_video.png'] 17 | 18 | [[week9_video1]] 19 | [role="shoutout"] 20 | .Confused by this video? 21 | **** 22 | Post any questions or comments here. 23 | **** 24 | 25 | * Read along: http://natureofcode.com/book/chapter-7-cellular-automata/[Chapter 7] 26 | * http://en.wikipedia.org/wiki/Cellular_automaton[Wikipedia CA] 27 | 28 | [[week9_wolfram]] 29 | [preface] 30 | == Wolfram Elementary CA 31 | 32 | video::http://player.vimeo.com/video/64198154[height='300', width='500', poster='generic_video.png'] 33 | 34 | [[week9_video2]] 35 | [role="shoutout"] 36 | .Confused by this video? 37 | **** 38 | Post any questions or comments here. 39 | **** 40 | 41 | * Read along: http://natureofcode.com/book/chapter-7-cellular-automata/#chapter07_section2[Chapter 7.2] 42 | 43 | * http://www.wolframscience.com/nksonline/toc.html[A New Kind of Science] 44 | * http://mathworld.wolfram.com/ElementaryCellularAutomaton.html[Elementary Cellular Automaton] 45 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/NOC_7_01_WolframCA_simple[Example 7.1: Wolfram Elementary CA] 46 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/Exercise_7_04_WolframCA_scrolling[Exercise 7.4: Wolfram scrolling] 47 | 48 | [[week9_gol]] 49 | [preface] 50 | == The Game of Life 51 | 52 | video::http://player.vimeo.com/video/64198155[height='300', width='500', poster='generic_video.png'] 53 | 54 | [[week9_video3]] 55 | [role="shoutout"] 56 | .Confused by this video? 57 | **** 58 | Post any questions or comments here. 59 | **** 60 | 61 | * Read along: http://natureofcode.com/book/chapter-7-cellular-automata/#chapter07_section6 62 | 63 | * http://www.ibiblio.org/lifepatterns/october1970.html[Original 1970 Scientific American Article] 64 | 65 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/NOC_7_02_GameOfLifeSimple[Example 7.2: Game of Life] 66 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/NOC_7_03_GameOfLifeOOP[Example 7.3: Game of Life OOP] 67 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/GameOfLifeWrapAround[Game of Life "wrapped" edges] 68 | 69 | * https://github.com/stevenklise/ConwaysGameOfLife[Steve Klise's GOL processing.js implementation] 70 | * http://llk.media.mit.edu/projects/emergence/[Exploring Emergence] 71 | 72 | [[week9_exercises]] 73 | [preface] 74 | == CA Exercises 75 | 76 | video::http://player.vimeo.com/video/64198157[height='300', width='500', poster='generic_video.png'] 77 | 78 | [[week9_video4]] 79 | [role="shoutout"] 80 | .Confused by this video? 81 | **** 82 | Post any questions or comments here. 83 | **** 84 | 85 | * Read along: http://natureofcode.com/book/chapter-7-cellular-automata/#chapter07_section9 86 | 87 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp7_CA/Exercise_7_09_HexagonCells[Exercise 7.9: Hexagonal Cells] 88 | * http://freespace.virgin.net/hugo.elias/graphics/x_water.htm[2D Water Ripples CA] 89 | 90 | [[week9_homework]] 91 | [preface] 92 | == Homework Week 9 93 | 94 | For the remainder of this semester you should be working on your final project. We'll do this in three stages. 95 | 96 | 1. Final Project Experimentation -- Create several quick and dirty sketches that implement the beginnings or seeds of an idea. 97 | 2. Final Project Proposal -- develop a plan and proposal. 98 | 3. Final Project -- Build the final project and present in class! 99 | 100 | For your week 9 homework, you should be on step #2. I'm also including some exercise ideas related to cellular automata below. 101 | 102 | * Cellular Automata 103 | ** Combine CA with the flocking example -- what happens if you assign each boid a "state" which influences its behavior? 104 | ** 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? 105 | ** 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[http://en.wikipedia.org/wiki/Forest-fire_model]] or Predator, Prey [p. 191 of Computational Beauty of Nature.] 106 | ** 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. 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | -------------------------------------------------------------------------------- /week10.asciidoc: -------------------------------------------------------------------------------- 1 | [[week10]] 2 | [preface] 3 | = Nature of Code: Week 10 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | 13 | * <> 14 | 15 | [[week10_Fractals]] 16 | [preface] 17 | == What is a Fractal? 18 | 19 | video::http://player.vimeo.com/video/64424400[height='300', width='500', poster='generic_video.png'] 20 | 21 | [[week10_video1]] 22 | [role="shoutout"] 23 | .Confused by this video? 24 | **** 25 | Post any questions or comments here. 26 | **** 27 | 28 | * Read along: http://natureofcode.com/book/chapter-8-fractals/[Chapter 8] 29 | * http://www.youtube.com/watch?v=LemPnZn54Kw[PBS Nova - Fractals - Hunting the Hidden Dimension] 30 | * http://en.wikipedia.org/wiki/The_Fractal_Geometry_of_Nature[Fractal Geometry of Nature] 31 | * http://en.wikipedia.org/wiki/Factorial[Factorial] 32 | * http://en.wikipedia.org/wiki/How_Long_Is_the_Coast_of_Britain%3F_Statistical_Self-Similarity_and_Fractional_Dimension[How Long is the Coastline of Britain by Benoit Mandelbrot] 33 | 34 | [[week10_Recursion]] 35 | [preface] 36 | == Writing Recursive Functions in Processing 37 | 38 | video::http://player.vimeo.com/video/64424402[height='300', width='500', poster='generic_video.png'] 39 | 40 | [[week10_video2]] 41 | [role="shoutout"] 42 | .Confused by this video? 43 | **** 44 | Post any questions or comments here. 45 | **** 46 | 47 | * Read along: http://natureofcode.com/book/chapter-8-fractals/#chapter08_section2[Chapter 8.2] 48 | 49 | * http://en.wikipedia.org/wiki/Cantor_set[Cantor Set] 50 | * http://en.wikipedia.org/wiki/Sierpinski_triangle[Serpinski Triangle] 51 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_01_Recursion[Example 8.1: Recursion] 52 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_02_Recursion[Example 8.2: Recursion] 53 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_03_Recursion[Example 8.3: Recursion] 54 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_04_CantorSet[Example 8.4: Cantor Set] 55 | 56 | [[week10_ArrayList]] 57 | [preface] 58 | == Recursion with ArrayList of Objects 59 | 60 | video::http://player.vimeo.com/video/64424401[height='300', width='500', poster='generic_video.png'] 61 | 62 | [[week10_video3]] 63 | [role="shoutout"] 64 | .Confused by this video? 65 | **** 66 | Post any questions or comments here. 67 | **** 68 | 69 | * Read along: http://natureofcode.com/book/chapter-8-fractals/#chapter08_section4[Chapter 8.4] 70 | 71 | * http://en.wikipedia.org/wiki/Koch_snowflake[Koch Snowflake] 72 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_05_Koch[8.5: Koch Curve] 73 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/Exercise_8_02_KochSnowFlake[Exercise 8.2: Koch Snowflake] 74 | 75 | [[week10_pushpop]] 76 | [preface] 77 | == Recursion with Transformations 78 | 79 | video::http://player.vimeo.com/video/64663044[height='300', width='500', poster='generic_video.png'] 80 | 81 | [[week10_video4]] 82 | [role="shoutout"] 83 | .Confused by this video? 84 | **** 85 | Post any questions or comments here. 86 | **** 87 | 88 | * Read along: http://natureofcode.com/book/chapter-8-fractals/#chapter08_section5[Chapter 8.5] 89 | 90 | * http://recursivedrawing.com/[Toby Schachman's Recursive Drawing] 91 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_06_Tree[Example 8.6: Tree] 92 | https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_07_TreeStochastic[Example 8.7: Stochastic Tree] 93 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/Exercise_8_08_09_TreeArrayListLeaves[Example 8.9: Tree as ArrayList of branches (and leaves!)] 94 | 95 | [[week10_lsystems]] 96 | [preface] 97 | == L-Systems 98 | 99 | video::http://player.vimeo.com/video/64663042[height='300', width='500', poster='generic_video.png'] 100 | 101 | [[week10_video5]] 102 | [role="shoutout"] 103 | .Confused by this video? 104 | **** 105 | Post any questions or comments here. 106 | **** 107 | 108 | * Read along: http://natureofcode.com/book/chapter-8-fractals/#chapter08_section6[Chapter 8.6] 109 | 110 | * http://algorithmicbotany.org/papers/#abop[Algorithmic Beauty of Plants] 111 | * http://books.google.com/books?id=0aUhuv7fjxMC&pg=PA78[L-Systems in Computational Beauty of Nature] 112 | 113 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_08_SimpleLSystem[Example 8.8: Simple L-System] 114 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp8_fractals/NOC_8_09_LSystem[Example 8.9: L-System] 115 | 116 | [[week10_homework]] 117 | [preface] 118 | == Homework Week 10 119 | 120 | For the remainder of this semester you should be working on your final project. We'll do this in three stages. 121 | 122 | 1. Final Project Experimentation -- Create several quick and dirty sketches that implement the beginnings or seeds of an idea. 123 | 2. Final Project Proposal -- develop a plan and proposal. 124 | 3. Final Project -- Build the final project and present in class! 125 | 126 | For your week 10 homework, you should be on step #2 with a little bit of #3 thrown in. I'm also including some exercise ideas related to fractals below. 127 | 128 | * Fractals 129 | ** Build a fractal structure with physics. For each with make a fractal tree where branch of the tree is two toxiclibs particles connected with a spring. How can you get the tree to stand up and not fall down? 130 | ** Use an L-system as a set of instructions for creating objects stored in an ArrayList. Use trigonometry and vector math to perform the rotations instead of matrix transformations (much like in the Koch curve example). 131 | -------------------------------------------------------------------------------- /week3.asciidoc: -------------------------------------------------------------------------------- 1 | [[week3]] 2 | [preface] 3 | = Nature of Code: Week 3 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | 13 | [[week3_angles]] 14 | [preface] 15 | == Angles and Angular Motion 16 | 17 | video::http://player.vimeo.com/video/59509643[height='300', width='500', poster='generic_video.png'] 18 | 19 | [[week3_video1]] 20 | [role="shoutout"] 21 | .Confused by this video? 22 | **** 23 | Post any questions or comments here. 24 | **** 25 | 26 | * Read along in the http://natureofcode.com/book/chapter-3-oscillation/[Nature of Code Chapter 3: Oscillation] 27 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_01_angular_motion[Example 3.1: Angular Motion] 28 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_02_forces_angular_motion[Example 3.2: Angular Motion for Moving Body] 29 | 30 | 31 | [[week3_trig]] 32 | [preface] 33 | == Trigonometry and Polar Coordinates 34 | 35 | video::http://player.vimeo.com/video/59509645[height='300', width='500', poster='generic_video.png'] 36 | 37 | [[week3_video2]] 38 | [role="shoutout"] 39 | .Confused by this video? 40 | **** 41 | Post any questions or comments here. 42 | **** 43 | 44 | * Read along in the http://natureofcode.com/book/chapter-3-oscillation/[Nature of Code Chapter 3: Oscillation] 45 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_01_angular_motion[Example 3.1: Angular Motion] 46 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_02_forces_angular_motion[Example 3.2: Angular Motion for Moving Body] 47 | 48 | [[week3_wave]] 49 | [preface] 50 | == Simple Harmonic Motion 51 | 52 | video::http://player.vimeo.com/video/59509644[height='300', width='500', poster='generic_video.png'] 53 | 54 | [[week3_video3]] 55 | [role="shoutout"] 56 | .Confused by this video? 57 | **** 58 | Post any questions or comments here. 59 | **** 60 | 61 | * Read along in: http://natureofcode.com/book/chapter-3-oscillation/#chapter03_section6[Nature of Code Chapter 3: Oscillation] 62 | 63 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_05_simple_harmonic_motion[Example 3.5: Simple Harmonic Motion I] 64 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_06_simple_harmonic_motion[Example 3.6: Simple Harmonic Motion II] 65 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_07_oscillating_objects[Example 3.7: Oscillating Objects] 66 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_08_static_wave_lines[Example 3.8: Waves] 67 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_09_exercise_additive_wave[Example 3.9: Additive Waves] 68 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/AttractionArrayWithOscillation[Extra: Moving bodies with oscillating motion] 69 | 70 | [[week3_pendulum]] 71 | [preface] 72 | == Pendulums 73 | 74 | video::http://player.vimeo.com/video/59707298[height='300', width='500', poster='generic_video.png'] 75 | 76 | [[week3_video4]] 77 | [role="shoutout"] 78 | .Confused by this video? 79 | **** 80 | Post any questions or comments here. 81 | **** 82 | 83 | * Read along in: http://natureofcode.com/book/chapter-3-oscillation/#chapter03_section9[Nature of Code Chapter 3.9: Pendulums] 84 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_10_PendulumExample[Examples 3.10: Pendulum] 85 | 86 | [[week3_spring]] 87 | [preface] 88 | == Springs 89 | 90 | video::http://player.vimeo.com/video/59707299[height='300', width='500', poster='generic_video.png'] 91 | 92 | [[week3_video5]] 93 | [role="shoutout"] 94 | .Confused by this video? 95 | **** 96 | Post any questions or comments here. 97 | **** 98 | 99 | * Read along in: http://natureofcode.com/book/chapter-3-oscillation/#chapter03_section9[Nature of Code Chapter 3.10: Springs] 100 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_11_spring[Examples 3.11: Spring Forces] 101 | 102 | [[week3_homework]] 103 | [preface] 104 | == Homework Week 3 105 | 106 | Incorporate oscillatory motion into a previous assignment (or create a new one). Some suggestions: 107 | 108 | * Design a creature with oscillating parts (legs, wings, antennae, etc.) Consider tying the speed of oscillation to the speed of the creature's linear motion. Can you make it appear that the creature's internal mechanics (oscillation) drive its locomotion? https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/NOC_3_07_oscillating_objects[An example solution.] 109 | 110 | * Create a simulation where objects are shot out of a cannon. Each object should experience a sudden force when shot (just once) as well as gravity (always present). Add rotation to the object to model its spin as its shot from the cannon. How realistic can you make it look? 111 | 112 | * Create a simulation of a vehicle that you can drive around the screen using the arrow keys: left arrow accelerates the car to the left, right to the right. The car should point in the direction it is currently moving. 113 | 114 | * Simulate the spaceship in the game Asteroids. In case you aren't familiar with Asteroids, here is a brief description. A spaceship (represented as a triangle) floats in two dimensional space. The left arrow keys turns the spaceship counter-clockwise, the right clock-wise. The space bar applies a “thrust“ force in the direction the spaceship is pointing. https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/Exercise_3_05_asteroids[Example Solution] 115 | 116 | * String together a series of pendulums so that the endpoint of one is the origin point of another. 117 | 118 | * Use trigonometry to model a box sliding down an incline with friction. Note that the magnitude of the friction force is equal to the normal force. 119 | 120 | * Rework the wave examples to have a Wave class and visualize the wave using something other than circles. https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/Exercise_3_10_OOPWave[Example Answer (minus the change in visualization)] 121 | 122 | * Using the Spring example as a basis, create a system of multiple bobs and spring connections. How would you have a Bob connected to a Bob with no fixed anchor? 123 | 124 | * Research and implement a simulation of http://en.wikipedia.org/wiki/Torque[Torque]. 125 | 126 | As always, please create a web page to document your homework. Make sure it include some visual documentation of your work as well as the source code. 127 | 128 | [[homework_week3_links]] 129 | [role="shoutout"] 130 | .Post your homework 131 | **** 132 | Post a link to your homework assignment here. 133 | **** 134 | 135 | [preface] 136 | == Supplemental Reading 137 | 138 | * http://natureofcode.com/book/chapter-3-oscillation[The Nature of Code Chapter 3: Oscillation] 139 | * The Mathematics of Oscillatory Motion (refer to e-mail to class list.) 140 | * http://www.phy6.org/stargaze/Strig1.htm[Trigonometry, What is it good for?] (follow along to 7 parts) 141 | * http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapter 4, Danny Kodicek 142 | 143 | -------------------------------------------------------------------------------- /week4.asciidoc: -------------------------------------------------------------------------------- 1 | [[week4]] 2 | [preface] 3 | = Nature of Code: Week 4 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | * <> 13 | * <> 14 | 15 | [[week4_ps]] 16 | [preface] 17 | == Introduction to Particle Systems 18 | 19 | video::http://player.vimeo.com/video/60027382[height='300', width='500', poster='generic_video.png'] 20 | 21 | [[week4_video1]] 22 | [role="shoutout"] 23 | .Confused by this video? 24 | **** 25 | Post any questions or comments here. 26 | **** 27 | 28 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/[The Nature of Code: Chapter 4] 29 | * Reeves, William T. http://dl.acm.org/citation.cfm?id=357320["Particle Systems—A Technique for Modeling a Class of Fuzzy Objects."] _ACM Transactions on Graphics_ 2:2 (April 1983): 91-108. 30 | * http://www.youtube.com/watch?v=QXbWCrzWJo4[Genesis Effect on Youtube] 31 | * Sims, Karl. http://www.karlsims.com/papers/ParticlesSiggraph90.pdf["Particle Animation and Rendering Using Data Parallel Computation."] Paper presented at SIGGRAPH '90: The 17th Annual Conference on Computer Graphics and Interactive Techniques, Dallas, TX, August 6-10, 1990. 32 | * http://www.karlsims.com/particle-dreams.html[Sims Particle Dreams Video] 33 | 34 | [[week4_arraylist]] 35 | [preface] 36 | == What is an ArrayList? 37 | 38 | video::http://player.vimeo.com/video/60027379[height='300', width='500', poster='generic_video.png'] 39 | 40 | [[week4_video2]] 41 | [role="shoutout"] 42 | .Confused by this video? 43 | **** 44 | Post any questions or comments here. 45 | **** 46 | 47 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section3[Nature of Code 4.3] 48 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_02_ArrayListParticles[Example 4.2: ArrayList of particles] 49 | 50 | [[week4_deleting]] 51 | [preface] 52 | == Removing Elements from an ArrayList 53 | 54 | video::http://player.vimeo.com/video/60027381[height='300', width='500', poster='generic_video.png'] 55 | 56 | [[week4_video3]] 57 | [role="shoutout"] 58 | .Confused by this video? 59 | **** 60 | Post any questions or comments here. 61 | **** 62 | 63 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section3[Nature of Code 4.3] 64 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_02_ArrayListParticles[Example 4.2 ArrayList of Particles] 65 | 66 | [[week4_psclass]] 67 | [preface] 68 | == A Particle System class 69 | 70 | video::http://player.vimeo.com/video/60027380[height='300', width='500', poster='generic_video.png'] 71 | 72 | [[week4_video4]] 73 | [role="shoutout"] 74 | .Confused by this video? 75 | **** 76 | Post any questions or comments here. 77 | **** 78 | 79 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section4[Nature of Code: 4.4] 80 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_03_ParticleSystemClass[Example 4.3: ParticleSystem class] 81 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_04_SystemofSystems[Example 4.4: System of Systems] 82 | 83 | [[week4_inheritance]] 84 | [preface] 85 | == Inheritance and Polymorphism 86 | 87 | video::http://player.vimeo.com/video/60187927[height='300', width='500', poster='generic_video.png'] 88 | 89 | video::http://player.vimeo.com/video/60187929[height='300', width='500', poster='generic_video.png'] 90 | 91 | video::http://player.vimeo.com/video/60187931[height='300', width='500', poster='generic_video.png'] 92 | 93 | [[week4_video4]] 94 | [role="shoutout"] 95 | .Confused by this video? 96 | **** 97 | Post any questions or comments here. 98 | **** 99 | 100 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section6[Nature of Code: 4.6] 101 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_05_ParticleSystemInheritancePolymorphism[Examples 4.5: Inheritance and Polymorphism] 102 | 103 | 104 | [[week4_forces]] 105 | [preface] 106 | == Particle System and forces 107 | 108 | video::http://player.vimeo.com/video/60187932[height='300', width='500', poster='generic_video.png'] 109 | 110 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section11[Nature of Code: 4.11] 111 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_06_ParticleSystemForces[Examples 4.6: Particle System forces] 112 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_07_ParticleSystemForcesRepeller[Example 4.7: Particle System repeller] 113 | 114 | [[week4_images]] 115 | [preface] 116 | == Particle textures 117 | 118 | video::http://player.vimeo.com/video/60187934[height='300', width='500', poster='generic_video.png'] 119 | 120 | * Read along: http://natureofcode.com/book/chapter-4-particle-systems/#chapter04_section13[Nature of Code: 4.13] 121 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_08_ParticleSystemSmoke[Example 4.8: Smoke Particle System] 122 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp4_systems/NOC_4_09_AdditiveBlending[Example 4.9: Additive Blending] 123 | 124 | 125 | [[week4_homework]] 126 | [preface] 127 | == Homework Week 4 128 | 129 | At this point we're a bit deeper in the semester and approaching the midterm project. Feel free to simply start on a midterm idea or continue something you've been working on previously. If you would like to try an exercise related to particle systems, here are some suggestions: 130 | 131 | * Use a particle system in the design of a "Mover" object. In other words take, say, one of our earlier examples and instead of rendering a Mover object as a simple circle, emit particles from the mover's location. For example, building off https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp3_oscillation/Exercise_3_05_asteroids[Chapter 3’s "Asteroids" example], use a particle system to emit particles from the ship’s “thrusters” whenever a thrust force is applied. The particles’ initial velocity should be related to the ship’s current direction. 132 | 133 | * Create a particle system where the particles respond to each other via forces. For example, what if you connect the particles with spring forces? Or an attraction / repulsion force? 134 | 135 | * Model a specific visual effect using a particle system -- fire, smoke, explosion, waterfall, etc. 136 | 137 | * Create a simulation of an object shattering into many pieces. How can you turn one large shape into many small particles? What if there are several large shapes on the screen and they shatter when you click on them? 138 | 139 | * Create a particle system in which each particle responds to every other particle. (Note we'll be doing this in detail in Week 6. 140 | 141 | * Create a particle system with different “kinds” of particles in the same system. Try varying more than just the look of the particles. How do you deal with different behaviors using inheritance? 142 | 143 | * Use an array of images and assign each Particle object a different image. Even though single images are drawn by multiple particles, make sure you don’t call loadImage() any more than you need to, i.e. once for each image file. 144 | 145 | As always, please create a web page to document your homework. Make sure it include some visual documentation of your work as well as the source code. 146 | 147 | [[homework_week4_links]] 148 | [role="shoutout"] 149 | .Post your homework 150 | **** 151 | Post a link to your homework assignment here. 152 | **** 153 | 154 | [preface] 155 | == Supplemental Reading 156 | 157 | * http://doi.acm.org/10.1145/97879.97923["Particle animation and rendering using data parallel computation", Karl Sims] (available via NYU network/proxy) 158 | * http://doi.acm.org/10.1145/357318.357320["Particle Systems, a Technique for Modeling a Class of Fuzzy Objects", Reeves] (available via NYU network/proxy) 159 | * http://www.javaranch.com/campfire/StoryPoly.jsp[How my Dog learned Polymorphism] 160 | * http://www.siggraph.org/education/materials/HyperGraph/animation/particle.htm[Particle Systems (Siggraph)], http://www.cs.unc.edu/+++~+++davemc/Particle/[Particle System API, by David K. McAllister], http://www.cs.wpi.edu/+++~+++matt/courses/cs563/talks/psys.html[Particle Systems by Allen Martin] 161 | 162 | -------------------------------------------------------------------------------- /week1.asciidoc: -------------------------------------------------------------------------------- 1 | [[week1]] 2 | [preface] 3 | = Nature of Code: Week 1 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | * <> 13 | 14 | [[week1]] 15 | [preface] 16 | == Course Introduction 17 | 18 | Hello! Welcome to week 1 of The Nature of Code. Here is an introductory video you can watch (if you are taking the class at ITP you could skip this as I'm going to do the same content in class on the first day.) 19 | 20 | *Assignment: Sign up for the class mailing list https://groups.google.com/a/itp.nyu.edu/group/natureofcode/[class mailing list]* 21 | 22 | video::http://player.vimeo.com/video/58388167[height='300', width='500', poster='generic_video.png'] 23 | 24 | * http://itp.nyu.edu[ITP] 25 | * http://processing.org[Processing] 26 | * http://natureofcode.com[The Nature of Code book web site] 27 | 28 | [[week1_random_walk]] 29 | [preface] 30 | == Random Walker 31 | 32 | video::http://player.vimeo.com/video/58391447[height='300', width='500', poster='generic_video.png'] 33 | 34 | * Read along in the http://natureofcode.com/book/introduction/[Nature of Code Introduction] 35 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/NOC_I_1_RandomWalkTraditional[Example I.1: Random Walk Traditional] 36 | 37 | [[week1_probability]] 38 | [preface] 39 | == Probability 40 | 41 | video::http://player.vimeo.com/video/58400734[height='300', width='500', poster='generic_video.png'] 42 | 43 | * Read along in the http://natureofcode.com/book/introduction/#intro_section3[Nature of Code I.3] 44 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/NOC_I_2_RandomDistribution[Example I.2: Random Number Distribution] 45 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/NOC_I_3_RandomWalkTendsToRight[Example I.3: Random Walker Tends to Right] 46 | 47 | [[week1_gaussian_distributions]] 48 | [preface] 49 | == Gaussian Distribution 50 | 51 | video::http://player.vimeo.com/video/58489018[height='300', width='500', poster='generic_video.png'] 52 | 53 | * Read along in the http://natureofcode.com/book/introduction/#intro_section4[Nature of Code I.4] 54 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/NOC_I_4_Gaussian[Example I.4: Gaussian Distribution] 55 | 56 | [[week1_monte_carlo]] 57 | [preface] 58 | == Monte Carlo 59 | 60 | video::http://player.vimeo.com/video/58490313[height='300', width='500', poster='generic_video.png'] 61 | 62 | * Read along in the http://natureofcode.com/book/introduction/#intro_section5[Nature of Code I.5] 63 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/MonteCarloDistribution[Example: Custom Distribution] 64 | 65 | [[week1_perlin_noise]] 66 | [preface] 67 | == Perlin Noise 68 | 69 | video::http://player.vimeo.com/video/58492076[height='300', width='500', poster='generic_video.png'] 70 | 71 | * Read along in the http://natureofcode.com/book/introduction/#intro_section6[Nature of Code I.6] 72 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/NOC_I_5_NoiseWalk[Example: Noise Walk] 73 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/introduction/Exercise_I_10_NoiseLandscape[Exercise I.10: Noise Landscape] 74 | 75 | [[week1_homework]] 76 | [preface] 77 | == Homework Week 1 78 | 79 | For this week's homework, develop a Processing sketch (or program in the environment of your choosing) that experiments with motion.You should feel free to design your own assignment. If you are stuck for an idea here are some suggestions. 80 | 81 | * Create a random walker with dynamic probabilities. For example, can you give it a 50% chance of moving in the direction of the mouse? 82 | * Gaussian random walk is defined as one in which the step size (how far the object moves in a given direction) is generated with a normal distribution. Implement this variation of our random walk. 83 | * Try implementing the "self-avoiding walk": http://en.wikipedia.org/wiki/Self-avoiding_walk[http://en.wikipedia.org/wiki/Self-avoiding_walk] 84 | * Try implement the random walk known as a Levy Flight: http://en.wikipedia.org/wiki/L%C3%A9vy_flight[http://en.wikipedia.org/wiki/L%C3%A9vy_flight] 85 | * Try a walk in 3D: See: http://en.wikipedia.org/wiki/Quantum_Cloud[http://en.wikipedia.org/wiki/Quantum_Cloud] 86 | * Use the random walker as a template to simulate some real-world "natural" motion. Can you develop a set of rules for simulating that behavior? Ideas: nervous fly, hopping bunny, slithering snake, etc. (Consider the challenge of using minimal visual design, i.e. b&w primitive shapes. Can you give your "being" a personality? Can it express emotions -- happiness, sadness, fear, etc.? 87 | * There are also more exercises in http://natureofcode.com/book/introduction/[The Nature of Code Introduction] 88 | 89 | *You'll need to create a web page to document your homework.* It could be as simple as the auto-generated page created by Processing's JavaScript mode. It could also be a blog post or something custom you design. 90 | 91 | *After completing and documenting your homework add a link to it below using "add comment."* (Note you need to be logged into Chimera in order for this to work. If you have trouble, don't worry, just e-mail me and we'll sort it out in class.) 92 | 93 | Homework links go here: 94 | 95 | [preface] 96 | == Supplemental Reading 97 | 98 | * http://natureofcode.com/book/introduction/[The Nature of Code Introduction] 99 | * http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapter 5 -- Vectors, Danny Kodicek 100 | * http://cognet.mit.edu/library/books/view?isbn=0262062003[Computational Beauty of Nature], Introduction, Gary William Flake (you must be logged in through NYU to access the online version.) 101 | * http://www.probabilitytheory.info/[Probability Theory] 102 | 103 | [preface] 104 | == Nature of Code related and past projects 105 | 106 | ==== Forces 107 | * http://roberthodgin.com/eyeo-2012/[Robert Hodgin's Eyeo 2012 work] 108 | * https://vimeo.com/135858[Robert Hodgin's Magnetosphere 1] 109 | * http://emilywebster.com/abscissa/[Emily Webster ‘The Abscissa Cycle’ NOC 2012] 110 | * http://tomgerhardt.com/mudtub/[Mud Tub by Tom Gerhardt NOC 2009] 111 | 112 | ==== Oscillation 113 | * https://vimeo.com/47124314[Mimi Yin and Guang Zhu 'Beluga'] 114 | 115 | ==== Particle Systems 116 | * http://www.youtube.com/watch?v=QXbWCrzWJo4[Genesis Effect from Star TreK II: Wrath of Khan] 117 | * http://dl.acm.org/citation.cfm?id=357320["Particle Systems—A Technique for Modeling a Class of Fuzzy Objects." William T. Reeves] 118 | * http://work.gmunk.com/TRON-Fireworks[TRON Fireworks, Josh Nimoy + GMunk] 119 | * http://www.markbreneman.com/blog1/2012/05/10/nature-of-code-final-patterns-in-pixel-movement/[Patterns in Pixel Movement Mark Breneman (NOC 2012] 120 | * http://www.karlsims.com/particle-dreams.html[Particle Dreams by Karl Sims] 121 | * https://vimeo.com/11482851[Scrollables by Filippo Vanucci NOC 2010] 122 | 123 | ==== Physics Libraries 124 | * http://www.ameliechucky.cl/blah-blah-blobby[Blah blah blobby Marcela Godoy Eunyoung Kang NOC 2012] 125 | * https://vimeo.com/9090403[Jellies by Cedric Kieffer and Ricardo Sanchez] 126 | * http://itp.nyu.edu/~jhl589/myblog/portfolio/up/[Up by Ji Hyun Lee] 127 | * https://vimeo.com/37383446[NeoGeo Marina Zurkow Daniel Shiffman] 128 | 129 | ==== Steering (Autonomous Agents, Complexity) 130 | * http://www.paulmay.org/blog/nature-of-code-creatures/[Creatures by Paul May NOC 2012] 131 | * http://nicksantan.com/blog/2012/05/xbox_foray/[Nightlifter for XBox by Nick Santaniello NOC 2012] 132 | * http://www.phlea.tv/molly_blogolly/?p=462[Belly Full of Eels by Molly Schwartz NOC 2010] 133 | 134 | ==== Fractals, CA, L-Systems, other Rule-Based Systems 135 | * http://www.bravomartin.cl/installations/skittish-tree/[Skittish Tree by Martin Bravo NOC 2011] 136 | * http://n-e-r-v-o-u-s.com/[Anything by Nervous System (Jessica Rosenkrantz and Jesse Louis-Rosenberg)] 137 | 138 | ==== Genetic Algorithms 139 | * http://www.typegalapagos.com/[Ann Chen & Danne Woo - Galapagos Evolutionary Type Design NOC 2012] 140 | * http://boxcar2d.com/[BoxCar2D] 141 | * http://www.karlsims.com/evolved-virtual-creatures.html[Evolved Virtual Creatures] 142 | * http://joan.cat/en/dbn/[Digital Babylon NOC 2005] 143 | 144 | 145 | 146 | 147 | -------------------------------------------------------------------------------- /week8.asciidoc: -------------------------------------------------------------------------------- 1 | [[week8]] 2 | [preface] 3 | = Nature of Code: Week 8 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | * <> 13 | * <> 14 | * <> 15 | 16 | * <> 17 | 18 | [[week8_steering]] 19 | [preface] 20 | == Autonomous Agents and Steering Behaviors 21 | 22 | video::http://player.vimeo.com/video/63089178[height='300', width='500', poster='generic_video.png'] 23 | 24 | [[week8_video1]] 25 | [role="shoutout"] 26 | .Confused by this video? 27 | **** 28 | Post any questions or comments here. 29 | **** 30 | 31 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/[Chapter 6] 32 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents[All Chapter 6 Examples] 33 | 34 | * https://vimeo.com/22955812[Reas Process Compendium] 35 | * http://books.google.com/books/?id=7KkUAT_q_sQC[Braitenberg Vehicles] 36 | * http://www.red3d.com/cwr/steer/[Craig Reynolds' Steering Behaviors for Autonomous Characters] 37 | 38 | [[week8_seek]] 39 | [preface] 40 | == Seeking a Target 41 | 42 | video::http://player.vimeo.com/video/63089177[height='300', width='500', poster='generic_video.png'] 43 | 44 | [[week8_video2]] 45 | [role="shoutout"] 46 | .Confused by this video? 47 | **** 48 | Post any questions or comments here. 49 | **** 50 | 51 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section3[Chapter 6.3] 52 | * http://www.red3d.com/cwr/steer/SeekFlee.html[Reynolds Demo] 53 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_01_Seek[Example 6.1: Seek] 54 | 55 | [[week8_arrive]] 56 | [preface] 57 | == Arriving at a Target 58 | 59 | video::http://player.vimeo.com/video/63089179[height='300', width='500', poster='generic_video.png'] 60 | 61 | [[week8_video3]] 62 | [role="shoutout"] 63 | .Confused by this video? 64 | **** 65 | Post any questions or comments here. 66 | **** 67 | 68 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section4[Chapter 6.4] 69 | * http://www.red3d.com/cwr/steer/Arrival.html[Reynolds Demo] 70 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_02_Arrive[Example 6.2: Arrive] 71 | 72 | [[week8_flow]] 73 | [preface] 74 | == Flow Field Following 75 | 76 | video::http://player.vimeo.com/video/63101109[height='300', width='500', poster='generic_video.png'] 77 | 78 | [[week8_video4]] 79 | [role="shoutout"] 80 | .Confused by this video? 81 | **** 82 | Post any questions or comments here. 83 | **** 84 | 85 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section6[Chapter 6.6] 86 | * http://www.red3d.com/cwr/steer/FlowFollow.html[Reynolds Demo] 87 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_04_Flowfield[Example 6.4: Flow Field Following] 88 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/Exercise_6_08_FlowField3DNoise[Exercise 6.8: Flow Field 3D Noise] 89 | 90 | [[week8_dot]] 91 | [preface] 92 | == Vector Dot Product 93 | 94 | video::http://player.vimeo.com/video/63101108[height='300', width='500', poster='generic_video.png'] 95 | 96 | [[week8_video5]] 97 | [role="shoutout"] 98 | .Confused by this video? 99 | **** 100 | Post any questions or comments here. 101 | **** 102 | 103 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section7[Chapter 6.7] 104 | * http://en.wikipedia.org/wiki/Dot_product[Dot Product Wikipedia] 105 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/Exercise_6_09_AngleBetween[Exercise 6.9: Angle Between] 106 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/SimpleScalarProjection[Simple Scalar Projection demo] 107 | 108 | 109 | [[week8_path]] 110 | [preface] 111 | == Path Following 112 | 113 | video::http://player.vimeo.com/video/63928276[height='300', width='500', poster='generic_video.png'] 114 | 115 | [[week8_video6]] 116 | [role="shoutout"] 117 | .Confused by this video? 118 | **** 119 | Post any questions or comments here. 120 | **** 121 | 122 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section8[Chapter 6.8] 123 | * http://www.red3d.com/cwr/steer/PathFollow.html[Reynolds Demo] 124 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_05_PathFollowingSimple[Example 6.5: Simple Path Following (straight line)] 125 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_06_PathFollowing[Example 6.6: Path Following (with multi-point path)] 126 | 127 | [[week8_group]] 128 | [preface] 129 | == Group Steering Behaviors 130 | 131 | video::http://player.vimeo.com/video/63928275[height='300', width='500', poster='generic_video.png'] 132 | 133 | [[week8_video7]] 134 | [role="shoutout"] 135 | .Confused by this video? 136 | **** 137 | Post any questions or comments here. 138 | **** 139 | 140 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section11[Chapter 6.11] 141 | * http://www.red3d.com/cwr/steer/Doorway.html[Doorway Reynolds Demo] 142 | * http://www.red3d.com/cwr/steer/CrowdPath.html[Crowd Path Following Reynolds Demo] 143 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/Alignment[Alignment Example] 144 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_07_Separation[Example 6.7: Separation] 145 | 146 | [[week8_combining]] 147 | [preface] 148 | == Combining Multiple Steering Behaviors 149 | 150 | video::http://player.vimeo.com/video/63928274[height='300', width='500', poster='generic_video.png'] 151 | 152 | [[week8_video8]] 153 | [role="shoutout"] 154 | .Confused by this video? 155 | **** 156 | Post any questions or comments here. 157 | **** 158 | 159 | * Read along: http://natureofcode.com/book/chapter-6-autonomous-agents/#chapter06_section12[Chapter 6.12] 160 | * http://www.red3d.com/cwr/boids/[Craig Reynolds Boids] 161 | 162 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_08_SeparationAndSeek[Example 6.8: Separation and Seek] 163 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/Exercise_6_13_CrowdPathFollowing[Exercise 6.13: Crowd Path Following] 164 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/NOC_6_09_Flocking[Example 6.9: Flocking] 165 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp6_agents/Exercise_6_17_View[Exercise 6.17: Flake "View" Rule] 166 | 167 | 168 | [[week8_homework]] 169 | [preface] 170 | == Homework Week 8 171 | 172 | For the remainder of this semester you should be working on your final project. We'll do this in three stages. 173 | 174 | 1. Final Project Experimentation -- Create several quick and dirty sketches that implement the beginnings or seeds of an idea. 175 | 2. Final Project Proposal -- develop a plan and proposal. 176 | 3. Final Project -- Build the final project and present in class! 177 | 178 | For your week 8 homework, do #1 above. We'll worry about #2 and #3 later. If you are stuck for an idea, I'll include below a long list of suggestions for exercises that might lead you towards an idea from the material in chapter 6. 179 | 180 | [[homework_week8_links]] 181 | [role="shoutout"] 182 | .Post your homework 183 | **** 184 | Post a link to your homework assignment here. 185 | **** 186 | 187 | * Steering Behaviors 188 | ** Implement seeking a moving target, often referred to as “pursuit.“ In this case, your desired velocity won't point towards the object's current location, rather its “future“ location as extrapolated based on its current velocity. 189 | ** Create a sketch where a Vehicle's maximum force and maximum speed do not remain constant, but rather vary according to environmental factors. 190 | ** Create a flow field that changes over time 191 | ** Create a flow field based on image data 192 | ** Expand the path following example to have a path that changes over time. Can the points that define the path itself have their own steering behaviors? 193 | ** Create something inspired by Braitenberg's Vehicles 194 | * Flocking 195 | ** Implement Flake's "View" rule, described in Computational Beauty of Nature 196 | ** Create a flocking simulation where all of the parameters (separation weight, cohesion weight, alignment weight, maximum force, maximum speed) change over time. They could be controlled by Perlin noise or by user interaction. 197 | ** Build a creature with countless steering behaviors (as many as you can reasonably add). Think about ways to vary the weights of these behaviors so that you can dial those behaviors up and down, mixing and matching on the fly. How are creatures' initial weights set? What rules drive how the weights change over time? 198 | ** Use applyForce() in Box2D or addForce() in Toxiclibs to create a flocking simulation in one of those physics engines 199 | ** Complex systems can be nested. Can you design a single creature out of a flock of boids? And can you then make a flock of those creatures? 200 | -------------------------------------------------------------------------------- /week5.asciidoc: -------------------------------------------------------------------------------- 1 | [[week5]] 2 | [preface] 3 | = Nature of Code: Week 5 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | * <> 13 | * <> 14 | * <> 15 | * <> 16 | 17 | * <> 18 | 19 | [[week5_box2d]] 20 | [preface] 21 | == What is Box2D? 22 | 23 | video::http://player.vimeo.com/video/60601614[height='300', width='500', poster='generic_video.png'] 24 | 25 | [[week5_video1]] 26 | [role="shoutout"] 27 | .Confused by this video? 28 | **** 29 | Post any questions or comments here. 30 | **** 31 | 32 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/[The Nature of Code: Chapter 5] 33 | * http://box2d.org/[Box2D web site] 34 | * http://www.jbox2d.org/[JBox2D web site] 35 | * https://github.com/shiffman/PBox2D[PBox2D github repo] 36 | 37 | [[week5_box2dworld]] 38 | [preface] 39 | == What are the core elements of the Box2D world? 40 | 41 | video::http://player.vimeo.com/video/60601612[height='300', width='500', poster='generic_video.png'] 42 | 43 | [[week5_video2]] 44 | [role="shoutout"] 45 | .Confused by this video? 46 | **** 47 | Post any questions or comments here. 48 | **** 49 | 50 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section3[The Nature of Code: Chapter 5, Section 3] 51 | * http://box2d.org/manual.pdf[Box2D manual] 52 | 53 | [[week5_box2dvectors]] 54 | [preface] 55 | == Box2D coordinate system and Box2D vectors 56 | 57 | video::http://player.vimeo.com/video/60601611[height='300', width='500', poster='generic_video.png'] 58 | 59 | [[week5_video3]] 60 | [role="shoutout"] 61 | .Confused by this video? 62 | **** 63 | Post any questions or comments here. 64 | **** 65 | 66 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section4[The Nature of Code: Chapter 5, Section 4] 67 | 68 | ++++ 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 |
TaskFunction
Convert location from World to PixelsVec2 coordWorldToPixels(Vec2 world)
Convert location from World to PixelsVec2 coordWorldToPixels(float worldX, float worldY)
Convert location from Pixels to WorldVec2 coordPixelsToWorld(Vec2 screen)
Convert location from Pixels to WorldVec2 coordPixelsToWorld(float pixelX, float pixelY)
Scale a dimension (such as height, width, or radius) from Pixels to Worldfloat scalarPixelsToWorld(float val)
Scale a dimension from World to Pixelsfloat scalarWorldToPixels(float val)
99 | ++++ 100 | 101 | [[week5_box2dexercise]] 102 | [preface] 103 | == A first Box2D sketch 104 | 105 | video::http://player.vimeo.com/video/60601613[height='300', width='500', poster='generic_video.png'] 106 | 107 | video::http://player.vimeo.com/video/60782773[height='300', width='500', poster='generic_video.png'] 108 | 109 | [[week5_video4]] 110 | [role="shoutout"] 111 | .Confused by this video? 112 | **** 113 | Post any questions or comments here. 114 | **** 115 | 116 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section5[The Nature of Code: Chapter 5, Section 5] 117 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_1_box2d_exercise[Example 5.1: Simple Processing Sketch with no Box2D] 118 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_1_box2d_exercise_solved[Example 5.1: Simple Processing Sketch with Box2D added!] 119 | 120 | [[week5_static]] 121 | [preface] 122 | == Static Objects in Box2D 123 | 124 | video::http://player.vimeo.com/video/60782770[height='300', width='500', poster='generic_video.png'] 125 | 126 | [[week5_video5]] 127 | [role="shoutout"] 128 | .Confused by this video? 129 | **** 130 | Post any questions or comments here. 131 | **** 132 | 133 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section8[The Nature of Code: Chapter 5, Section 8] 134 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_2_Boxes[Example 5.2: Boxes falling on platforms] 135 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_3_ChainShape_Simple[Example 5.3: ChainShape surface] 136 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/Exercise_5_3_NoiseChain[Exercise 5.3: Noise Chain] 137 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/Exercise_5_3_SineChain[Exercise 5.3: Sine Chain] 138 | 139 | [[week5_complex]] 140 | [preface] 141 | == Complex Shapes in Box2D 142 | 143 | video::http://player.vimeo.com/video/60782771[height='300', width='500', poster='generic_video.png'] 144 | 145 | [[week5_video6]] 146 | [role="shoutout"] 147 | .Confused by this video? 148 | **** 149 | Post any questions or comments here. 150 | **** 151 | 152 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section10[The Nature of Code: Chapter 5, Section 10] 153 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_4_Polygons[Example 5.4: Custom Polygons]) 154 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_5_MultiShapes[Example 5.5: Attaching multiple shapes to one body] 155 | 156 | 157 | [[week5_joints]] 158 | [preface] 159 | == Box2D Joints 160 | 161 | video::http://player.vimeo.com/video/61114507[height='300', width='500', poster='generic_video.png'] 162 | 163 | video::http://player.vimeo.com/video/61114509[height='300', width='500', poster='generic_video.png'] 164 | 165 | video::http://player.vimeo.com/video/61114510[height='300', width='500', poster='generic_video.png'] 166 | 167 | [[week5_video7]] 168 | [role="shoutout"] 169 | .Confused by this video? 170 | **** 171 | Post any questions or comments here. 172 | **** 173 | 174 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section11[Nature of Code 5.11] 175 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_6_DistanceJoint[Example 5.6: Distance Joint] 176 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_7_RevoluteJoint[Example 5.7: Revolute Joint] 177 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_8_MouseJoint[Example 5.8: Mouse Joint] 178 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/KinematicTest[Kinematic Body Demo] 179 | 180 | [[week5_forces]] 181 | [preface] 182 | == Applying Forces in Box2D 183 | 184 | video::http://player.vimeo.com/video/61114512[height='300', width='500', poster='generic_video.png'] 185 | 186 | [[week5_video8]] 187 | [role="shoutout"] 188 | .Confused by this video? 189 | **** 190 | Post any questions or comments here. 191 | **** 192 | 193 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section12[Nature of Code 5.12] 194 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/Exercise_5_10_ApplyForceSimpleWind[Exercise 5.10: Wind] 195 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/Exercise_5_10_ApplyForceAttractMouse[Exercise 5.10: Attract Mouse] 196 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/Exercise_5_10_AttractionApplyForce[Exercise 5.10: Gravitational Attraction] 197 | 198 | [[week5_events]] 199 | [preface] 200 | == Triggering Collision Events in Box2D 201 | 202 | video::http://player.vimeo.com/video/61114514[height='300', width='500', poster='generic_video.png'] 203 | 204 | [[week5_video9_oops]] 205 | [role="shoutout"] 206 | .Confused by this video? 207 | **** 208 | Post any questions or comments here. 209 | **** 210 | 211 | * Read along: http://natureofcode.com/book/chapter-5-physics-libraries/#chapter05_section13[Nature of Code 5.13] 212 | 213 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/NOC_5_9_CollisionListening[Example 5.9: Collision Listening] 214 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/CollisionListeningDeletionExercise[Collision Deletion Demo] 215 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp5_physicslibraries/box2d/CollisionsAndControl[Another Collision listening demo] 216 | 217 | 218 | [[week5_homework]] 219 | [preface] 220 | == Homework Week 5 221 | 222 | For this week, you should begin working on your midterm project. As an experiment, I'd like to try seeding a little online discussion about midterm ideas. Please visit the following link and make a post and comment on other posts: 223 | 224 | * http://natureofcode.com/itp/midterm.html[http://natureofcode.com/itp/midterm.html] 225 | 226 | If you are struggling for ideas, here are some links to midterm projects from last year: 227 | 228 | * http://itp.nyu.edu/~db2497/itp/?p=329[Dollee's Mon Mon Monsters] 229 | * http://www.markbreneman.com/blog/2012/03/06/plop-plop-fizz-fizz/[Mark's Plop Plop Fizz Fizz] 230 | * http://itp.nyu.edu/~nbe206/blog/?p=673[Natalie's Trees] 231 | * http://blog.benturner.com/2012/03/07/nature-of-code-midterm-genetic-crossing-with-verlet-physics/[Ben's Genetic Verlet Physics] 232 | * http://stu.itp.nyu.edu/~pmd299/NOC/midterm/[Peter's Name Swarm] 233 | * http://nicksantan.com/blog/2012/03/cosmic-crossfire/[Nick's Cosmic Crossfire] 234 | * http://jann.ae/collide/[Jannae's Collide] 235 | * http://stu.itp.nyu.edu/~mk3981/blog/?p=1311[Mark's Waiting Game airport project] 236 | 237 | 238 | 239 | 240 | -------------------------------------------------------------------------------- /week2.asciidoc: -------------------------------------------------------------------------------- 1 | [[week2]] 2 | [preface] 3 | = Nature of Code: Week 2 4 | 5 | Topics for this week include: 6 | 7 | * <> 8 | * <> 9 | * <> 10 | * <> 11 | * <> 12 | * <> 13 | * <> 14 | * <> 15 | * <> 16 | 17 | [[week2_vectors]] 18 | [preface] 19 | == What is a vector? 20 | 21 | video::http://player.vimeo.com/video/58734251[height='300', width='500', poster='generic_video.png'] 22 | 23 | [[week2_videoA]] 24 | [role="shoutout"] 25 | .Confused by this video? 26 | **** 27 | Post any questions or comments here. 28 | **** 29 | 30 | * Read along in the http://natureofcode.com/book/chapter-1-vectors/[Nature of Code Chapter 1: Vectors] 31 | 32 | 33 | [[week2_pvector]] 34 | [preface] 35 | == The PVector class 36 | 37 | video::http://player.vimeo.com/video/58943395[height='300', width='500', poster='generic_video.png'] 38 | 39 | [[week2_videoB]] 40 | [role="shoutout"] 41 | .Confused by this video? 42 | **** 43 | Post any questions or comments here. 44 | **** 45 | 46 | * Read along in the http://natureofcode.com/book/chapter-1-vectors/[Nature of Code Chapter 1: Vectors] 47 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_1_bouncingball_novectors[Example 1.1: Bouncing Ball, no vectors] 48 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_2_bouncingball_vectors[Example 1.2: Bouncing Ball, with vectors!] 49 | 50 | [[week2_vectormath]] 51 | [preface] 52 | == Basic Vector Math 53 | 54 | video::http://player.vimeo.com/video/58943394[height='300', width='500', poster='generic_video.png'] 55 | 56 | [[week2_video1]] 57 | [role="shoutout"] 58 | .Confused by this video? 59 | **** 60 | Post any questions or comments here. 61 | **** 62 | 63 | * Read along in the http://natureofcode.com/book/chapter-1-vectors/[Nature of Code Chapter 1: Vectors] 64 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_3_vector_subtraction[Example 1.3: Vector Subtraction] 65 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_4_vector_multiplication[Example 1.4: Vector multiplication (I mean scaling)] 66 | 67 | video::http://player.vimeo.com/video/58943396[height='300', width='500', poster='generic_video.png'] 68 | 69 | [[week2_video2]] 70 | [role="shoutout"] 71 | .Confused by this video? 72 | **** 73 | Post any questions or comments here. 74 | **** 75 | 76 | * This video covers mag() and normalize() in the PVector class. 77 | * Read along in the http://natureofcode.com/book/chapter-1-vectors/[Nature of Code Chapter 1: Vectors] 78 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_5_vector_magnitude[Example 1.5: Vector magnitude] 79 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_6_vector_normalize[Example 1.6: Vector normalize] 80 | 81 | [[week2_physics]] 82 | [preface] 83 | == Motion 101: Location, Velocity, Acceleration 84 | 85 | video::http://player.vimeo.com/video/58943393[height='300', width='500', poster='generic_video.png'] 86 | 87 | [[week2_video3]] 88 | [role="shoutout"] 89 | .Confused by this video? 90 | **** 91 | Post any questions or comments here. 92 | **** 93 | 94 | * Read along in the http://natureofcode.com/book/chapter-1-vectors/#chapter01_section8[Nature of Code Section 1.8] 95 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_7_motion101[Example 1.7: Constant velocity] 96 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_8_motion101_acceleration[Example 1.8: Constant Acceleration] 97 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp1_vectors/NOC_1_9_motion101_accelerationp[Example 1.9: Random Acceleration] 98 | 99 | [[week2_newton]] 100 | [preface] 101 | == Newton's Laws of Motion: F = M*A 102 | 103 | video::http://player.vimeo.com/video/59028633[height='300', width='500', poster='generic_video.png'] 104 | 105 | [[week2_video4]] 106 | [role="shoutout"] 107 | .Confused by this video? 108 | **** 109 | Post any questions or comments here. 110 | **** 111 | 112 | * This video discusses the definition of a "force" as well as an overview of Newton's 3 laws of motion. 113 | * Read along in the http://natureofcode.com/book/chapter-2-forces/[Nature of Code Chapter 2] 114 | 115 | [[week2_applyforce]] 116 | [preface] 117 | == Applying a force 118 | 119 | video::http://player.vimeo.com/video/59028634[height='300', width='500', poster='generic_video.png'] 120 | 121 | [[week2_video5]] 122 | [role="shoutout"] 123 | .Confused by this video? 124 | **** 125 | Post any questions or comments here. 126 | **** 127 | 128 | * This video covers how to apply a force to a moving object in Processing. These forces are "made-up" values and don't yet involve more complex formulae (coming soon!) 129 | * Read along: http://natureofcode.com/book/chapter-2-forces/#chapter02_section2[Nature of Code 2.2] 130 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_1_forces[Example 2.1: Forces] 131 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_2_forces_many[Example 2.2: Forces many objects] 132 | 133 | [[week2_mass]] 134 | [preface] 135 | == Incorporating mass 136 | 137 | video::http://player.vimeo.com/video/59028632[height='300', width='500', poster='generic_video.png'] 138 | 139 | [[week2_video6]] 140 | [role="shoutout"] 141 | .Confused by this video? 142 | **** 143 | Post any questions or comments here. 144 | **** 145 | 146 | * This video shows how to add mass to your object for a simulation with shapes of different sizes. 147 | * Read along: http://natureofcode.com/book/chapter-2-forces/#chapter02_section4[The Nature of Code 2.4] 148 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_3_forces_many_realgravity[Example 2.3: Forces with mass (also demonstrates "real-world" gravity on earth)] 149 | 150 | [[week2_friction_drag]] 151 | [preface] 152 | == Forces Case Study: Friction and Drag 153 | 154 | video::http://player.vimeo.com/video/59435251[height='300', width='500', poster='generic_video.png'] 155 | 156 | [[week2_video7]] 157 | [role="shoutout"] 158 | .Confused by this video? 159 | **** 160 | Post any questions or comments here. 161 | **** 162 | 163 | * Read along: http://natureofcode.com/book/chapter-2-forces/#chapter02_section7[The Nature of Code 2.7] 164 | * http://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_4_forces_friction[Example 2.4: Friction] 165 | 166 | video::http://player.vimeo.com/video/59435250[height='300', width='500', poster='generic_video.png'] 167 | 168 | [[week2_video8]] 169 | [role="shoutout"] 170 | .Confused by this video? 171 | **** 172 | Post any questions or comments here. 173 | **** 174 | 175 | * Read along: http://natureofcode.com/book/chapter-2-forces/#chapter02_section8[The Nature of Code 2.8] 176 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_5_fluidresistance[Example 2.5: Fluid Resistance] 177 | 178 | 179 | [[week2_gravitational_attraction]] 180 | [preface] 181 | == Forces Case Study: Gravitational Attraction 182 | 183 | video::http://player.vimeo.com/video/59435252[height='300', width='500', poster='generic_video.png'] 184 | 185 | [[week2_video9]] 186 | [role="shoutout"] 187 | .Confused by this video? 188 | **** 189 | Post any questions or comments here. 190 | **** 191 | 192 | * Read along: http://natureofcode.com/book/chapter-2-forces/#chapter02_section9[The Nature of Code 2.9] 193 | * http://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_6_attraction[Example 2.6: Attraction] 194 | * http://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_7_attraction_many[Example 2.7: Attraction many] 195 | * http://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_2_8_mutual_attraction[Example 2.8: Mutual Attraction] 196 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_02forces_many_attraction_3D[Extra: Attraction 3D] 197 | * https://github.com/shiffman/The-Nature-of-Code-Examples/tree/master/Processing/chp2_forces/NOC_02forces_many_mutual_boundaries[Extra: Mutual Attraction w/ boundaries] 198 | 199 | [[week2_homework]] 200 | [preface] 201 | == Homework Week 2 202 | 203 | Choose one or create your own. Post your work as a link in the comments below. 204 | 205 | * 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. What happens if you make more than one object via an array. 206 | * Using forces, simulate a helium-filled balloon floating upward (and bouncing off the top of a window). Can you add a wind force which changes over time, perhaps according to Perlin noise? 207 | * Create an example where instead of objects bouncing off the edge of the wall, an invisible force pushes back on the objects to keep them in the window. Can you weight the force according to how far the object is from an edge, i.e. the closer it is, the stronger the force? 208 | * Create pockets of air resistance / friction in a Processing sketch. Try using circles instead of rectangles, i.e. pockets of mud (or ice). What if you vary the strength (drag / friction coefficient) of each circle? What if you make some of them the opposite of drag—i.e., when you enter a given pocket you actually speed up instead of slow down? 209 | * Can you create an example where all of the Mover objects are attracted to the mouse, but repel each other? Think about how you need to balance the relative strength of the forces and how to most effectively use distance in your force calculations. 210 | * Research a force not covered in class and implement it as a vector. 211 | * 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) 212 | * Build a sketch that has both "Movers" and "Attractors". What if you make the Attractors invisible? Can you create a pattern / design from the trails of objects moving around attractors? See the http://processing.org/exhibition/works/metropop/[Metropop Denim project by Clayton Cubitt and Tom Carden] for an example. 213 | 214 | Just as with last week, please create a web page to document your homework. Make sure it include some visual documentation of your work as well as the source code. 215 | 216 | [[homework_week2_links]] 217 | [role="shoutout"] 218 | .Post your homework 219 | **** 220 | Post a link to your homework assignment here. 221 | **** 222 | 223 | [preface] 224 | == Supplemental Reading 225 | 226 | * http://natureofcode.com/book/chapter-1-vectors[The Nature of Code Chapter 1: Vectors] 227 | * http://natureofcode.com/book/chapter-2-forces[The Nature of Code Chapter 2: Forces] 228 | * http://www.lightandmatter.com/area1book1.html[Newtonian Physics, An Online Textbook] (This is long, you may find Chapter 4 to be particularly relevant to this week's discussion.) 229 | * http://www.physicsclassroom.com/Class/newtlaws/newtltoc.html[The Physics Classroom -- Newton's Laws] 230 | * http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapters 12 and 14, Danny Kodicek (suggested) 231 | -------------------------------------------------------------------------------- /Syllabus-2012.asciidoc: -------------------------------------------------------------------------------- 1 | == The Nature of Code 2 | 3 | * Spring 2012 4 | 5 | * Section 1: Tuesdays 12:30 - 3:00 pm 6 | 7 | * Section 2: Wednesdays 12:30 - 3:00 pm 8 | 9 | * Daniel Shiffman, daniel.shiffman@nyu.edu 10 | 11 | * https://itp.nyu.edu/inwiki/Signup/Shiffman[Office Hours Signup] 12 | 13 | 14 | === Important Sites 15 | 16 | * Draft Book PDFS: http://itp.nyu.edu/varwiki/Nature/Book[http://itp.nyu.edu/varwiki/Nature/Book] 17 | 18 | * Code Examples: https://github.com/shiffman/The-Nature-of-Code[https://github.com/shiffman/The-Nature-of-Code] 19 | 20 | * Mailing list: https://groups.google.com/a/itp.nyu.edu/group/natureofcode/[https://groups.google.com/a/itp.nyu.edu/group/natureofcode/] 21 | 22 | * http://itp.nyu.edu/varwiki/Nature/Nature[Homework and other wikis] 23 | 24 | * Delicious links: http://del.icio.us/tag/natureofcode[http://del.icio.us/tag/natureofcode] 25 | 26 | * Twitter: https://twitter.com/#!/search/%23natureofcode[#natureofcode] 27 | 28 | 29 | === Syllabus 30 | 31 | *Week 1 -- Jan 24/25 -- http://www.shiffman.net/teaching/nature/week-1/[Numbers] and http://processing.org/learning/pvector/[Vectors]* 32 | 33 | * Class Intro / Overview 34 | 35 | * http://www.processing.org[Processing] review 36 | 37 | * Randomness, Probability, and Perlin Noise 38 | 39 | * Object Oriented Programming Review & Vectors 40 | 41 | * Assignment: Sign up for the class mailing list: https://groups.google.com/a/itp.nyu.edu/group/natureofcode/[https://groups.google.com/a/itp.nyu.edu/group/natureofcode/] 42 | 43 | * Assignment: The exercises below are suggestions, for this first week's assignment a more open-ended wording might read: "Experiment with motion in Processing." 44 | 45 | ** Take a look through the random walker examples (shared via dropbox, also https://github.com/shiffman/The-Nature-of-Code/tree/master/prologue[on github]). Create your own (not so random?) walker. Post a link to your work, as well as any thoughts on the above, on the http://itp.nyu.edu/varwiki/Nature/Nature[homework wiki]. Some ideas: 46 | 47 | ** Try implementing the "self-avoiding walk": http://en.wikipedia.org/wiki/Self-avoiding_walk[http://en.wikipedia.org/wiki/Self-avoiding_walk] 48 | 49 | ** Try implement the random walk known as a Levy Flight: http://en.wikipedia.org/wiki/L%C3%A9vy_flight[http://en.wikipedia.org/wiki/L%C3%A9vy_flight] 50 | 51 | ** Try a walk in 3D: See: http://en.wikipedia.org/wiki/Quantum_Cloud[http://en.wikipedia.org/wiki/Quantum_Cloud] 52 | 53 | ** Use the random walker as a template to simulate some real-world "natural" motion. Can you develop a set of rules for simulating that behavior? Ideas: nervous fly, hopping bunny, slithering snake, etc. (Consider the challenge of using minimal visual design, i.e. b&w primitive shapes. Can you give your "being" a personality? Can it express emotions -- happiness, sadness, fear, etc.? 54 | 55 | * Reading: http://www.processing.org/learning/pvector/[Processing PVector tutorial], also http://itp.nyu.edu/varwiki/Nature/Book[available as PDF]. 56 | 57 | * PDF Handout about probability (available via course mailing list) 58 | 59 | * http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapter 5 -- Vectors, Danny Kodicek 60 | 61 | * Reading: http://cognet.mit.edu/library/books/view?isbn=0262062003[Computational Beauty of Nature], Introduction, Gary William Flake (you must be logged in through NYU to access the online version.) 62 | 63 | * Reading: http://www.probabilitytheory.info/[Probability Theory] -- great friendly site! 64 | 65 | 66 | *Week 2 -- Jan 31/Feb 1 -- http://processing.org/learning/pvector/[Vectors] and Forces* 67 | 68 | 69 | * Object Oriented Programming Review & Vectors 70 | 71 | * Attraction/Repulsion 72 | 73 | * Friction/Drag 74 | 75 | * Core material 76 | 77 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 2 from Nature of Code book] 78 | 79 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp2_forces[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp2_forces] 80 | 81 | * Supplemental reading: 82 | 83 | ** http://www.lightandmatter.com/area1book1.html[Newtonian Physics, An Online Textbook] (This is long, you may find Chapter 4 to be particularly relevant to this week's discussion.) 84 | 85 | ** http://www.physicsclassroom.com/Class/newtlaws/newtltoc.html[The Physics Classroom -- Newton's Laws] 86 | 87 | ** http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapters 12 and 14, Danny Kodicek (suggested) 88 | 89 | * Homework (choose one / create your own) Post your work on the http://itp.nyu.edu/varwiki/Nature/Nature[wiki]: 90 | 91 | ** 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. What happens if you make more than one object via an array. 92 | 93 | ** Using forces, simulate a helium-filled balloon floating upward (and bouncing off the top of a window). Can you add a wind force which changes over time, perhaps according to Perlin noise? 94 | 95 | ** Create an example where instead of objects bouncing off the edge of the wall, an invisible force pushes back on the objects to keep them in the window. Can you weight the force according to how far the object is from an edge, i.e. the closer it is, the stronger the force? 96 | 97 | ** Create pockets of air resistance / friction in a Processing sketch. Try using circles instead of rectangles, i.e. pockets of mud (or ice). What if you vary the strength (drag / friction coefficient) of each circle? What if you make some of them the opposite of drag—i.e., when you enter a given pocket you actually speed up instead of slow down? 98 | 99 | ** Can you create an example where all of the Mover objects are attracted to the mouse, but repel each other? Think about how you need to balance the relative strength of the forces and how to most effectively use distance in your force calculations. 100 | 101 | ** Research a force not covered in class and implement it as a vector. 102 | 103 | ** 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) 104 | 105 | ** Build a sketch that has both "Movers" and "Attractors". What if you make the Attractors invisible? Can you create a pattern / design from the trails of objects moving around attractors? See the http://processing.org/exhibition/works/metropop/[Metropop Denim project by Clayton Cubitt and Tom Carden] for an example. 106 | 107 | *Week 3 -- Feb 7/8 -- Oscillations* 108 | 109 | * Trigonometry 110 | 111 | * Polar vs. Cartesian Coordinates 112 | 113 | * Pendulum 114 | 115 | * Graphing waves (perlin noise waves) 116 | 117 | * 2D trig equation graphing ("graphing inequalities") 118 | 119 | * Core material 120 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 3 from Nature of Code book] 121 | 122 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp3_oscillation[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp3_oscillation] 123 | 124 | * Supplemental Reading: 125 | 126 | ** The Mathematics of Oscillatory Motion (refer to e-mail to class list.) 127 | 128 | ** http://www.phy6.org/stargaze/Strig1.htm[Trigonometry, What is it good for?] (follow along to 7 parts) 129 | 130 | ** http://www.amazon.com/gp/product/1584503300/[Mathematics and Physics for Programmers], Chapter 4, Danny Kodicek (suggested) 131 | 132 | * Assignment: Incorporate oscillatory motion into a previous assignment (or create a new one). Some suggestions: 133 | 134 | ** Rewrite the above Oscillator class so that each object doesn't simply oscillate around the middle of the Processing window (width/2,height/2), but around a moving point. In other words, design a creature that moves around the screen according to location, velocity, and acceleration. But that creature isn't just a static shape, it's an oscillating body. Consider tying the speed of oscillation to the speed of motion. Think of a butterfly's flapping wings or the legs of an insect. Can you make it appear that the creature's internal mechanics (oscillation) drive its locomotion? (See "AttractionArrayWithOscillation" example as a model). 135 | 136 | ** Create a simulation where objects are shot out of a cannon. Each object should experience a sudden force when shot (just once) as well as gravity (always present). Add rotation to the object to model its spin as its shot from the cannon. How realistic can you make it look? 137 | 138 | ** Create a simulation of a vehicle that you can drive around the screen using the arrow keys: left arrow accelerates the car to the left, right to the right. The car should point in the direction it is currently moving. 139 | 140 | ** Simulate the spaceship in the game Asteroids. In case you aren't familiar with Asteroids, here is a brief description. A spaceship (represented as a triangle) floats in two dimensional space. The left arrow keys turns the spaceship counter-clockwise, the right clock-wise. The space bar applies a “thrust“ force in the direction the spaceship is pointing. See "_03_asteroids" example for sample answer. 141 | 142 | ** String together a series of pendulums so that the endpoint of one is the origin point of another. 143 | 144 | ** Use trigonometry to model a box sliding down an incline with friction. Note that the magnitude of the friction force is equal to the normal force. 145 | 146 | ** Rework the wave examples to have a Wave class and visualize the wave using something other than circles. http://www.shiffman.net/itp/classes/nature/week04_s09/OOPWave.zip[Example Answer (minus the change in visualization)] 147 | 148 | ** Using the Spring example as a basis, create a system of multiple bobs and spring connections. How would you have a Bob connected to a Bob with no fixed anchor? 149 | 150 | ** Research and implement a simulation of http://en.wikipedia.org/wiki/Torque[Torque]. 151 | 152 | *Week 4 -- Feb 14/15-- Particle Systems* 153 | 154 | * ArrayLists 155 | 156 | * Advanced Object Oriented Programming -- Inheritance and Polymorphism 157 | 158 | * Core material 159 | 160 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 4 from Nature of Code book] 161 | 162 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp4_systems[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp4_systems] 163 | 164 | ** Flight404's Particle example: http://www.flight404.com/blog/?p=113[http://www.flight404.com/blog/?p=113], see github for updated version for Processing 2.0a4 165 | 166 | * Supplemental Reading 167 | 168 | ** http://doi.acm.org/10.1145/97879.97923["Particle animation and rendering using data parallel computation", Karl Sims] (available via NYU network/proxy) 169 | 170 | ** http://doi.acm.org/10.1145/357318.357320["Particle Systems, a Technique for Modeling a Class of Fuzzy Objects", Reeves] (available via NYU network/proxy) 171 | 172 | ** http://www.javaranch.com/campfire/StoryPoly.jsp[How my Dog learned Polymorphism] 173 | 174 | ** http://www.siggraph.org/education/materials/HyperGraph/animation/particle.htm[Particle Systems (Siggraph)], http://www.cs.unc.edu/+++~+++davemc/Particle/[Particle System API, by David K. McAllister], http://www.cs.wpi.edu/+++~+++matt/courses/cs563/talks/psys.html[Particle Systems by Allen Martin] 175 | 176 | * Homework exercise -- At this point we're a bit deeper in the semester and approaching the midterm project. Feel free to simply start on a midterm idea or continue something you've been working on previously. If you would like to try an exercise related to particle systems, here are some suggestions: 177 | ** Use a particle system in the design of a "Mover" object. In other words take, say, one of our earlier examples and instead of rendering a Mover object as a simple circle, emit particles from the mover's location. Consider using the http://www.shiffman.net/2011/02/13/asteroids-spaceship/[Asteroids] example and emit particles from the ship when a thrust force is applied. 178 | 179 | ** Create a particle system where the particles respond to each other via forces. For example, what if you connect the particles with spring forces? Or an attraction / repulsion force? 180 | 181 | ** Model a specific visual effect using a particle system -- fire, smoke, explosion, waterfall, etc. 182 | 183 | ** Create a simulation of an object shattering into many pieces. How can you turn one large shape into thousands of small particles? 184 | 185 | ** Create a particle system in which each particle responds to every other particle. (Note we'll be doing this in detail in Week 6. 186 | 187 | ** (There are more exercise suggestions in the PDF for this week) 188 | 189 | *Week 5 -- Feb 21/22 -- Physics Libraries: Box2D* 190 | 191 | * Box2D: http://box2d.org/[http://box2d.org/] 192 | 193 | * Core material 194 | 195 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 5 from Nature of Code book] 196 | 197 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp5_physicslibraries[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp5_physicslibraries] 198 | 199 | ** PBox2D source: https://github.com/shiffman/PBox2D[https://github.com/shiffman/PBox2D] 200 | 201 | ** Download library: http://www.shiffman.net/p5/libraries/pbox2d/pbox2d.zip[http://www.shiffman.net/p5/libraries/pbox2d/pbox2d.zip] 202 | 203 | * Supplemental Reading: This isn't terribly exciting, but read the http://www.box2d.org/manual.html[Box2D manual]. It's actually quite helpful for the concepts (you can ignore the code and focus on our class examples instead.) 204 | 205 | * Homework: Your midterm assignment (/varwiki/Nature/Midterm-T-12[Midterm-T-12], /varwiki/Nature/Midterm-W-12[Midterm-W-12]) can be anything that _build off of_ or _is inspired by_ the concepts we've covered this first half of the semester (motion and physics). You should feel free to think non-traditionally, i.e. your midterm need not be a Processing sketch. The midterm does not need to be a fully realized project, it is useful to use this time to build out a single component of a larger idea. If you are stuck, feel free to come and talk to me. Or try one of these suggestions: 206 | 207 | ** Extend one of the examples into 3D 208 | 209 | ** Design a simulation of a single creature (that you imagine living in a larger eco-system). 210 | 211 | ** Develop a non keyboard/mouse way of interacting with an environments' forces (i.e. video tracking, sensors, etc.) 212 | 213 | ** Use physics simulation to fabricate something -- a print, a sculpture, etc. 214 | 215 | 216 | *Week 6 -- Feb 28/29 -- Physics Libraries: more Box2D and Toxiclibs* 217 | 218 | * Toxiclibs: http://toxiclibs.org/[http://toxiclibs.org/] 219 | 220 | * Connected systems (using toxiclibs springs and Box2D joints) 221 | 222 | * A bit more on inheritance + interfaces 223 | 224 | ** Java tutorial: http://java.sun.com/docs/books/tutorial/java/IandI/createinterface.html[http://java.sun.com/docs/books/tutorial/java/IandI/createinterface.html] 225 | 226 | ** with box2d ContactListener: http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/[http://www.shiffman.net/2010/02/19/box2d-contact-listener-in-processing/] 227 | 228 | * Core material 229 | 230 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 5 from Nature of Code book] 231 | 232 | 233 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp5_physicslibraries[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp5_physicslibraries] 234 | 235 | ** Toxiclibs: http://toxiclibs.org/[http://toxiclibs.org/] 236 | 237 | * Assignment: Complete midterm project, post link to wiki (/varwiki/Nature/Midterm-T-12[Midterm-T-12], /varwiki/Nature/Midterm-W-12[Midterm-W-12]) and be prepared to present next week. 238 | 239 | ** Please include both visual and text documentation of your project, i.e. you might include a short paragraph description, links to relevant projects, video documentation, screenshots, or online applet, etc. The midterm need not be a finished project, it is useful to use this time to build out a single component of a larger idea. 240 | 241 | ** Each presentation should be less than 10 minutes total. Plan to talk very briefly about the larger idea and demo your implementation, giving yourself only *2-3 minutes* (you may use your own laptop or the classroom laptop). This will allow for time for feedback / discussion. 242 | 243 | ** In addition to whatever prototype implementation you preset, I encourage you to use drawings, images, video, and text to describe your idea 244 | 245 | ** We will follow the order below so feel free to move things around if you would like to present earlier or later in class, before or after break, etc. (Since the class is 18 students a few of you at the bottom of the list have a chance of being pushed a week later.) 246 | 247 | *Week 7 -- Mar 6/7 -- Present Midterm* 248 | 249 | *Week 8 -- Mar 20/21 -- Autonomous Agents and Complex Systems* 250 | 251 | 252 | * Autonomous Agents and Steering Behaviors 253 | 254 | ** Steering 255 | 256 | ** Dot Product + Path Following 257 | 258 | * Group Behaviors 259 | 260 | ** Craig Reynolds' Flocking Boids -- Alignment, Cohesion, Separation 261 | 262 | * Core material 263 | 264 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 6 from Nature of Code book] 265 | 266 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp6_steering[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp6_steering] 267 | 268 | ** http://www.red3d.com/cwr/steer/gdc99/[Steering Behaviors For Autonomous Characters], http://www.red3d.com/cwr/[Craig Reynolds] 269 | 270 | * Supplemental Reading 271 | 272 | ** Handout provided via listserv about http://en.wikipedia.org/wiki/Braitenberg_vehicles[Braitenberg Vehicles.] http://www.amazon.com/Vehicles-Experiments-Psychology-Valentino-Braitenberg/dp/0262521121[Vehicles book] 273 | 274 | ** Chapter 16 — Autonomous Agents and Self-Organization, The Computational Beauty of Nature, Gary William Flake, 275 | 276 | ** http://ddi.cs.uni-potsdam.de/HyFISCH/Produzieren/lis_projekt/proj_gamelife/ConwayScientificAmerican.htm[Conway's Game of Life], Scientific American, 1970 277 | 278 | ** http://llk.media.mit.edu/projects/emergence/index.html[Exploring Emergence], Mitchel Resnick and Brian Silverman Epistemology and Learning Group MIT Media Laboratory 279 | 280 | ** http://www.nytimes.com/2007/11/13/science/13traff.html?_r=1&oref=slogin[From Ants to People, an instinct to Swarm] 281 | 282 | * Assignment: Choose one of the following options or create your own. 283 | 284 | ** Midterm Expansion 285 | 286 | ** Develop your midterm project one step further based on class feedback / discussion. 287 | 288 | ** Final Project Experiment 289 | 290 | ** Take a first step towards a final project 291 | 292 | ** Individual Behaviors 293 | 294 | ** Implement seeking a moving target, often referred to as “pursuit.“ In this case, your desired vector won't point towards the object's current location, rather its “future“ location as extrapolated based on its current velocity. 295 | 296 | ** Create a sketch where a Vehicle's maximum force and maximum speed do not remain constant, but rather vary according to environmental factors. 297 | 298 | ** Create a flow field that changes over time 299 | 300 | ** Create a flow field based on image data 301 | 302 | ** Expand the path following example to have a path that changes over time. Can the points that define the path itself have their own steering behaviors? 303 | 304 | ** Create something inspired by Braitenberg's Vehicles 305 | 306 | ** Flocking 307 | 308 | ** Implement Flake's "View" rule, described in Computational Beauty of Nature 309 | 310 | ** Create a flocking simulation where all of the parameters (separation weight, cohesion weight, alignment weight, maximum force, maximum speed) change over time. They could be controlled by Perlin noise or by user interaction. 311 | 312 | ** Build a creature with countless steering behaviors (as many as you can reasonably add). Think about ways to vary the weights of these behaviors so that you can dial those behaviors up and down, mixing and matching on the fly. How are creatures' initial weights set? What rules drive how the weights change over time? 313 | 314 | ** Use applyForce() in Box2D or addForce() in Toxiclibs to create a flocking simulation in one of those physics engines 315 | 316 | ** Complex systems can be nested. Can you design a single creature out of a flock of boids? And can you then make a flock of those creatures? 317 | 318 | ** Cellular Automata (you'll have to read ahead to next week's examples) 319 | 320 | ** Combine CA with the flocking example -- what happens if you assign each boid a "state" which influences its behavior? 321 | 322 | ** 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? 323 | 324 | ** 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[http://en.wikipedia.org/wiki/Forest-fire_model]] or Predator, Prey [p. 191 of Computational Beauty of Nature.] 325 | 326 | ** 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. 327 | 328 | *Week 9 -- Mar 27/28 -- Cellular Automata* 329 | 330 | * Cellular Automata 331 | 332 | ** Wolfram CA 333 | 334 | ** The Game of Life 335 | 336 | * Fractals, MandelBrot Set 337 | 338 | * Recursion 339 | 340 | * L-Systems 341 | 342 | * Core material 343 | 344 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 7 from Nature of Code book] 345 | 346 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp7_CA[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp7_CA] 347 | 348 | * Supplemental Reading 349 | 350 | ** http://www.ibiblio.org/lifepatterns/october1970.html[The fantastic combinations of John Conway's new solitaire game "life"], Scientific American, 223 (October 1970): 120-123. 351 | 352 | ** The Computational Beauty of Nature, Chapter 15, Cellular Automata, Computational Beauty of Nature, Flake 353 | 354 | * Assignment: Prepare a final project proposal. 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. Schedule: http://itp.nyu.edu/varwiki/Nature/Final1-T-12[Tues], http://itp.nyu.edu/varwiki/Nature/Final1-W-12[Wed] 355 | 356 | *Week 10 -- April 3/4 -- Fractals and Final Project Proposals* 357 | 358 | * Fractals, MandelBrot Set 359 | 360 | * Recursion 361 | 362 | * L-Systems 363 | 364 | * Core material 365 | 366 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 8 from Nature of Code book] 367 | 368 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp8_fractals[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp8_fractals] 369 | 370 | * Supplemental Reading 371 | 372 | ** The Computational Beauty of Nature, Gary William Flake, Chapter 5 — Self-Similarity and Fractal Geometry, Chapter 6 — L-Systems and Fractal Growth 373 | 374 | ** http://algorithmicbotany.org/papers/#abop[Algorithmic Beauty of Plants] -- suggested 375 | 376 | ** Watch: http://video.pbs.org/video/1050932219/[Nova: The Hidden Dimension], http://www.youtube.com/watch?v=ZbK92bRW2lQ[youtube] 377 | 378 | *Week 11 -- Apr 10/11 -- Genetic Algorithms and Final Project Proposals* 379 | 380 | * Core material 381 | 382 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 9 from Nature of Code book] 383 | 384 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp9_ga[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp9_ga] 385 | 386 | * Reading: The Computational Beauty of Nature, Gary William Flake, Chapter 20 — Genetics and Evolution 387 | 388 | * Reading: http://karlsims.com/papers/siggraph94.pdf[Evolved Virtual Creatures, Karl Sims, Siggraph 1994] 389 | 390 | * Reading: http://karlsims.com/papers/siggraph91.html[Artificial Evolution for Computer Graphics], Karl Sims (ACM SIGGRAPH '91 Conference Proceedings, Las Vegas, Nevada, July 1991.) 391 | 392 | * Schedule is here: http://itp.nyu.edu/varwiki/Nature/Final1-T-12[Tues], http://itp.nyu.edu/varwiki/Nature/Final1-W-12[Wed] 393 | 394 | *Week 12 -- Apr 17/18 -- Neural Networks and Final Project Proposals* 395 | 396 | 397 | * Core material 398 | 399 | ** http://itp.nyu.edu/varwiki/Nature/Book[Chapter 10 from Nature of Code book] 400 | 401 | ** Code: https://github.com/shiffman/The-Nature-of-Code/tree/master/chp10_nn[https://github.com/shiffman/The-Nature-of-Code/tree/master/chp10_nn] 402 | 403 | * Schedule is here: http://itp.nyu.edu/varwiki/Nature/Final1-T-12[Tues], http://itp.nyu.edu/varwiki/Nature/Final1-W-12[Wed] 404 | 405 | *Week 13 -- Apr 24/25 -- Optional Final Project Presentations + Final Project Workshop* 406 | 407 | 408 | *Week 14 -- May 1/2 -- Final Project Presentations* 409 | 410 | * Post links to documentation here: http://itp.nyu.edu/varwiki/Nature/Final2-T-12[Tues], http://itp.nyu.edu/varwiki/Nature/Final2-W-12[Wed] 411 | 412 | *Reading Materials* 413 | 414 | * Nature of Code Draft PDFS: http://itp.nyu.edu/varwiki/Nature/Book[http://itp.nyu.edu/varwiki/Nature/Book] 415 | 416 | * http://cognet.mit.edu/library/books/view?isbn=0262062003[The Computational Beauty of Nature], Gary William Flake (required) 417 | 418 | * https://www.charlesriver.com/titles/mathphysics.html[Mathematics and Physics for Programmers], Danny Kodicek. 419 | 420 | * http://algorithmicbotany.org/papers/[Algorithmic Beauty of Plants], Przemyslaw Prusinkiewicz 421 | 422 | * http://www.amazon.com/gp/product/0262680939/[Turtles, Termites, and Traffic Jams: Explorations in Massively Parallel Microworlds (Complex Adaptive Systems)], Mitchel Resnick 423 | 424 | * Just about any book by http://www.amazon.com/exec/obidos/search-handle-url/index=books&field-author-exact=Ian%20Stewart&rank=-relevance%2C%2Bavailability%2C-daterank/104-8379570-6103164[Ian Stewart] 425 | 426 | 427 | *Homework* 428 | 429 | Students are required to complete a programming exercise each week. Documentation for each assignment should be posted to the linked wiki page. 430 | 431 | *Requirements: (no incompletes)* 432 | 433 | * 50% homeworks 434 | 435 | * 30% final project 436 | 437 | * 20% class participation, attendance --------------------------------------------------------------------------------