The Nature of Code is a site, a book and a Youtube channel (part of 'The Coding Train') by Daniel Schiffman. Its stated aim is to teach how to simulate natural systems with Javascript and more particular wih the p5.js library, which in its turn is based on the Processing language
The p5.js programs (called 'sketches') can be created, edited and saved online via its own online editor. Other editors are of course possible.
So what is the link with Basic256?
Well apart that they are both programming languages, there is not a lot of overlap... Basic256 is a nice QT-based IDE but still on top of a relatie primitive programming language variant of Basic ('Beginners All Symbolic Instruction Code'). It is an interpreted language, has no OOP (Object Oriented Programming) capabilities, vectors and related subroutines etc. However they are both programming languages so we should be able to emulate some of the simpler programs in The Nature of Code (although p5.js sketches will execute a lot faster...).
I will try to keep to the same structure as the original book/ebook/site.
I have now rewritten most programs so that they are all structured in a similar way with subroutines and look like this.
#Setup
gosub ScreenSetup
gosub ForceDeclaration
gosub ObjectDeclaration
#Draw
while 1
gosub UpdateForces
gosub UpdateObjects
gosub Show
refresh
# pause 0.002 #adapt the pause to get a pleasing effect
end while
This is then followed by the subroutines and functions. This makes it a lot easier tounderstand and to experiment with the settings
I would suggest you follow the first 'episodes' of the Nature of Code Youtube series and if you like what you see, I would advise to buy the book as using it to look up things later on is a lot easier than going through a bunch of Youtube vides...
Each chapter of the Nature of Code book will get its own webpage:
1. Randomness
2. Balls (originally 'Vectors' but... BASIC256)
3. Forces
4. Oscillation