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.