← Parminces
Daniel Shiffman (2012)

The Nature of Code

Simulating natural systems with code. From vectors and forces to neural networks and genetic algorithms, each chapter rebuilt as an interactive lesson with live Canvas simulations.

10
Chapters
20+
Simulations
80+
Quizzes
Part I: Motion & Physics
Chapter 1

Vectors

Euclidean vectors, addition, subtraction, magnitude, normalization, and the PVector class.

Chapter 2

Forces

Newton's laws, gravity, friction, drag, and applying multiple forces to moving objects.

Chapter 3

Oscillation

Angles, angular motion, trigonometry, pendulums, springs, and wave patterns.

Chapter 4

Particle Systems

Emitters, lifespans, ArrayLists, inheritance, polymorphism, and forces on particles.

Chapter 5

Physics Libraries

Box2D, toxiclibs, rigid bodies, joints, springs, and collision detection.

Part II: Intelligence & Complexity
Chapter 6

Autonomous Agents

Steering behaviors: seek, flee, arrive, wander, flow fields, path following, and flocking.

Chapter 7

Cellular Automata

Wolfram's elementary CA, the Game of Life, and emergent complexity from simple rules.

Chapter 8

Fractals

Recursion, self-similarity, the Koch curve, fractal trees, L-systems, and the Mandelbrot set.

Chapter 9

The Evolution of Code

Genetic algorithms, fitness functions, selection, crossover, mutation, and evolving phrases.

Chapter 10

Neural Networks

The perceptron, weighted inputs, supervised learning, and training with gradient descent.