Skip to content

tabreturn/py5-nature-of-code

Repository files navigation

Nature of Code (2), py5 Port

py5 implementations of Daniel Shiffman's "The Nature of Code" (2024 edition)

Built with py5 using Thonny-py5mode

I've taken a few liberties in my interpretation. First, the examples in the book and its accompanying p5.js sketches don't always align exactly. Second, in places, minor adjustments were necessary to support an idiomatic, py5-compatible Python implementation. Some chapters rely on p5.js-exclusive libraries, so I've had to employ substitutes/alternatives. Throughout, however, my goal has been to balance faithfulness to the original material with Python best practices and clarity for readers working through the book.

To run the sketches, install Thonny-py5mode and activate py5 → Imported mode for py5 in the editor.

Find the original p5.js examples in the noc-book-2 repo, linked alongside each py5 sketch listed below, or in the Book's online Examples section.

Where text is displayed, the sketches use the DejaVu Sans Mono font.


NOTE: The # PY5 IMPORTED MODE CODE marker tells py5 to inject its API into the module's namespace, allowing external files to call py5 functions without explicitly importing py5. You'll see this marker in several modules, so that there's no need to add from py5 import * or import py5.


⚙️ Part 1: Inanimate Objects

Ch. 00 - Randomness
Ch. 01 - Vectors
Ch. 02 - Forces
Ch. 03 - Oscillation
Ch. 04 - Particle Systems

🧬 Part 2: It's Alive!

Ch. 05 - Autonomous Agents
Ch. 06 - Physics Libraries
Ch. 07 - Cellular Automata
Ch. 08 - Fractals

🧠 Part 3: Intelligence

Ch. 09 - Evolutionary Computing
Ch. 10 - Neural Networks
Ch. 11 - Neuroevolution

⬆️ top

About

py5 implementations of "The Nature of Code" (2024 edition)

Topics

Resources

Stars

Watchers

Forks

Contributors