Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
The Nature of Code (2012) (natureofcode.com)
210 points by pelasaco on April 25, 2023 | hide | past | favorite | 23 comments


Given the contents:

    1. VECTORS
    2. FORCES
    3. OSCILLATION
    4. PARTICLE SYSTEMS
    5. PHYSICS LIBRARIES
    6. AUTONOMOUS AGENTS
    7. CELLULAR AUTOMATA
    8. FRACTALS
    9. THE EVOLUTION OF CODE
    10. NEURAL NETWORKS
a title "The Code of Nature" would also seem appropriate...


Yes that is the play on words here! They are all aiming to simulate physical processes and such.


Yep; they also could have gone with "Natural code", or "Code natural" ...



Thanks! Macroexpanded:

The Nature of Code - https://news.ycombinator.com/item?id=23157721 - May 2020 (1 comment)

The Nature of Code – evolutionary and emergent properties of nature in code - https://news.ycombinator.com/item?id=19632361 - April 2019 (8 comments)

Generative Coding – “The Nature of Code” Ported to Three.js - https://news.ycombinator.com/item?id=18122940 - Oct 2018 (12 comments)

The Nature of Code (2012) - https://news.ycombinator.com/item?id=14410201 - May 2017 (16 comments)

The Nature of Code: Simulating Natural Systems with Processing [video] - https://news.ycombinator.com/item?id=13295139 - Jan 2017 (1 comment)

The Nature of Code - https://news.ycombinator.com/item?id=8060179 - July 2014 (15 comments)

Basics of Neural Networks with example codes and illustrations - https://news.ycombinator.com/item?id=6300510 - Aug 2013 (29 comments)

* The Nature of Code free online book with live examples* - https://news.ycombinator.com/item?id=5153895 - Feb 2013 (2 comments)

Daniel Shiffman launches "The Nature of Code" online for free - https://news.ycombinator.com/item?id=4709551 - Oct 2012 (11 comments)


  (map link-expander list-of-links)
I wonder what it looks like in Arc. Does HN keep any of its codebase public?


There's a very old version at http://arclanguage.com/, but the current codebase isn't public.

FWIW, here's the Arc code I wrote to generate a string of the form "Italicized Title - https://news.ycombinator.com/item?id=$ID - Month Year (n comments)". The variable i stands for item, which is HN's term for a post (story, comment, or poll):

  (def biblioref (i)
    (let mon (monthdate (date i!time) 'short)
      (tostring
       (if (astorypoll i)
           (do (pr "*" (subst i!title "*" "\\*") "* - " (fullurl:item-url i!id)
                   " - " mon" (" (plural i!klive "comment") ")"))
           (do (pr (fullurl:item-url i!id))
               (unless (is mon (monthdate (date) 'short))
                 (pr " (" mon ")")))))))
Not that elegant but maybe not too bad.


I like it!

Here's one I use to decide from a list of free-form submissions whether to generate a link or a Google search:

  (fn [pair-of]
    (let [text (get pair-of 1)]
      (cond 
        (clojure.string/starts-with? text "http")
          (list [:a {:href text} (truncate text 60)] [:br])
        :else (list [:a {:href (str "https://google.com/search?q=" text)} text] [:br]))))
Doesn't always work but works often enough! ;)


If you're a beginner absolutely give it a try!

I implemented all of the book almost 10 years ago in Python and pygame. I was starting to code professionally back then and it is responsible for much of the confidence I needed. It definitely is more about nature and math than code. If you're the kind of hands on learner like I am, then I'd recommend using this as a resource to learn to code first before learning about theorectical data structures. Thanks to the author, I am now in a position to buy it :)


The author said a 2nd edition will be out later this year: https://twitter.com/shiffman/status/1646961509833011201?s=20


The homepage puts "Receive lifetime book updates for free", I guess that would mean second editions?


My intention is to send free digital updates to those who purchased the original 2012 PDF via the website, I have a list via fetchapp.com. I will probably remove this message for the new version. Print editions or other proprietary ebook formats (like kindle, etc) will be for purchase only for the new version. More: https://github.com/nature-of-code/natureofcode.com/pull/42


Great book. I got inspired by this book and the other one (https://www.cim.mcgill.ca/~clark/nordmodularbook/nm_algorith...) last year and made an logistic map function random notes example for the music programming language I created:

https://glicol.org/demo#chaos


Check out “coding train” on YouTube if you haven’t already. Love how he teaches coding, mistakes and all.


One of my absolute favorite YT coding channels, I will second that recommendation!

https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw


Hi! I'm the author, excited to find this post here. I am working furiously on a new version of the book, if you want to see it in progress there is a preview site here: https://nature-of-code-2nd-edition.netlify.app/

More: https://github.com/nature-of-code/noc-book-2023


I think this book should be used to teach "Programming" (in any language) in School because it shows how to use Computers as an aid to actually learning/simulating Science which dovetails nicely with the Maths/Physics/Chemistry/Biology classes.

Teaching this way will actually motivate students to understand Science since they can program the evidence and convince themselves of the "Scientific Truth" of what they have studied.


Loved this book.

When I first started programing, I was convinced that text applications weren't real programs, and the visual aspect of the book pulled me in to be a life-time programmer :)


Daniel Shiffman is amazing! An excellent teacher.


If you like this book you might also like Generative Gestaltung / Generative Design:

http://www.generative-gestaltung.de


Great author and one of the best teachers! This book is being rewritten to use JavaScripts p5js- original version is written for Java processing.


Such a lovely book. Try it, go fall in love with nature -o-f- and code.


This is one of the first books I read when learning how to code :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: