The Nature of Code

Front Cover
No Starch Press, Sep 3, 2024 - Computers - 640 pages
All aboard The Coding Train! This beginner-friendly creative coding tutorial is designed to grow your skills in a fun, hands-on way as you build simulations of real-world phenomena with “The Coding Train” YouTube star Daniel Shiffman.

How can we use code to capture the unpredictable properties of nature? How can understanding the mathematical principles behind our physical world help us create interesting digital environments? Written by “The Coding Train” YouTube star Daniel Shiffman, The Nature of Code is a beginner-friendly creative coding tutorial that explores a range of programming strategies for developing computer simulations of natural systems—from elementary concepts in math and physics to sophisticated machine-learning algorithms.

Using the same enthusiastic style on display in Shiffman’s popular YT channel, this book makes learning to program fun, empowering you to generate fascinating graphical output while refining your problem-solving and algorithmic-thinking skills. You’ll progress from building a basic physics engine that simulates the effects of forces like gravity and wind resistance, to creating evolving systems of intelligent autonomous agents that can learn from their mistakes and adapt to their environment.

The Nature of Code introduces important topics such as:
  • Randomness
  • Forces and vectors
  • Trigonometry
  • Cellular automata and fractals
  • Genetic algorithms
  • Neural networks

Learn from an expert how to transform your beginner-level skills into writing well-organized, thoughtful programs that set the stage for further experiments in generative design.

NOTE: All examples are written with p5.js, a JavaScript library for creative coding, and are available on the book's website.

Other editions - View all

About the author (2024)

Daniel Shiffman is an Associate Arts Professor at ITP/IMA, Tisch School of the Arts, NYU. He is a director of The Processing Foundation and the author of Learning Processing: A Beginner’s Guide to Programming Images, Animation, and Interaction and The Nature of Code, an open source book about simulating natural phenomenon with code. On his YouTube channel, The Coding Train, he publishes "creative coding" tutorials with subjects ranging from the basics of programming languages like JavaScript (with p5.js) and Java (with Processing) to generative algorithms like physics simulation, computer vision, and data visualization.

Bibliographic information