Giter VIP home page Giter VIP logo

the-nature-of-code-archive's Introduction

The Nature of Code

This repo is an archive of the raw materials for the first edition (1.0) of The Nature of Code book. I am now working on a 2.0 version. Progress was made at the following repo:

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

But I never finished and am now working on the book here:

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

The Nature of Code book readme from days of yore

Hello. If you found your way here you have found the raw source material for my Nature of Code book. The book is for sale in PDF and print forms at natureofcode.com. There, you'll also find a free version of the book available as HTML.

You may notice that all of the book's content is here -- illustrations, source code, raw text (ASCIIDOC files), and well as design elements (CSS). The book is licensed under the Creative Commons Attribution-NonCommercial 3.0 Unported License. You are free to share and remix the book, as long as you provide attribution and do not attempt to re-sell.

All of the book's source code is licensed under the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

By using GitHub to host all the raw material for the book, it's my hope that I will be able to more easily manage corrections and revisions. Please use the GitHub issues for bug reports, typos, suggestions, etc. You are also welcome to fork the repo, make corrections on your own and submit a pull request.

Finally, please note that if you attempt to generate the book using ASCIIDOC, it won't come out properly. While I am using ASCIIDOC as the raw material, the book's design (for PDF and HTML) is being generated via something called the "Magic Book Project." Check out the repo here: https://github.com/runemadsen/Magic-Book-Project. We're hoping to launch the Magic Book Project soon as a web application. Currently to use it, you'll have to clone the repo and configure and run manually. There are instructions in the Magic Book's repo.

Stay tuned for more!

the-nature-of-code-archive's People

Contributors

andersonfreitas avatar chriskelley avatar danbernier avatar ebukva avatar edmore avatar evanemolo avatar jschulenklopper avatar larrylegend avatar namin avatar nocksock avatar origamike avatar runemadsen avatar scotthmurray avatar shannonfry avatar shiffman avatar sklise avatar swfenton avatar timsbryan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

the-nature-of-code-archive's Issues

placement of trails note

Should the note that is caption in chapter 1 be moved to a more prominent place—like in the text proper, rather than in a caption? (Sometimes readers skim or skip captions…and while it's their fault that they weren't reading carefully, it still would be helpful to call more attention to a general note like that.

Chapter 2 stylesheet

PVector
Mover [class, object]
Liquid or liquid [object]
Attractor or attractor [object, class]

Published book versioning

Need to add something to book's text to indicate version for updates. For example, right now the book is in beta. When I launch the site it'll be 1.0. As I tweak and make small changes/fixes, it'll be 1.1, 1.2. Then when I do a major overhaul 2.0. Should this go in the footer on every page?

noc v1.1, page 22

Or just in the front matter?

(This is really only relevant for PDF)

Padding around code blocks

revisit CSS for padding around block of code. In particular there seems to be a lot of extra space below a block of code.

functions and capitalization in hyperlinks

On p. 27 of the introduction (under "Noise Detail"), I noticed that noiseDetail() should be in fixed-width text, as a function. However, it's also part of the first hyperlink in that box. Can we put noiseDetail() in FW without changing the font of the link itself? Also, I think the "see" before each link will be less obtrusive if it's lowercase.

Licensing

CC non-commercial license for text, illustrations
more open license for code

JavaScript errors in Introduction; using Fedora 17 Linux, Mozilla 15.0.1

I get errors like these:
Timestamp: 09/07/2012 08:54:03 PM
Error: uncaught exception: Processing.js: Unable to load pjs sketch files: processingjs/intro/_I_1_RandomWalkTraditional/_I_1_RandomWalkTraditional.pde ==> Invalid XHR status 404

processingjs/intro/_I_1_RandomWalkTraditional/Walker.pde ==> Invalid XHR status 404

Timestamp: 09/07/2012 08:54:03 PM

Error: uncaught exception: Processing.js: Unable to load pjs sketch files: processingjs/intro/_I_2_RandomDistribution/_I_2_RandomDistribution.pde ==> Invalid XHR status 404

Timestamp: 09/07/2012 08:54:03 PM
Error: uncaught exception: Processing.js: Unable to load pjs sketch files: processingjs/intro/_I_3_RandomWalkTendsToRight/_I_3_RandomWalkTendsToRight.pde ==> Invalid XHR status 404

processingjs/intro/_I_3_RandomWalkTendsToRight/Walker.pde ==> Invalid XHR status 404

Timestamp: 09/07/2012 08:54:03 PM
Error: uncaught exception: Processing.js: Unable to load pjs sketch files: processingjs/intro/_I_4_Gaussian/_I_4_Gaussian.pde ==> Invalid XHR status 404

and response time is very slow

style questions by chapter

Here are a list of terms for which I was unsure about the proper capitalization, punctuation, or use of fixed width. [I was going to create a new issue for each chapter, but maybe just one is better??]

Introduction
We had discussed making parameters bold here, but the blue book uses FW ital. Not sure if that will look strange with these particular parameters. Ch. 5 and Ch. 6 are the only other chapters that have parameter names.
a mean of zero and a standard deviation of one

Chapter 1
(x,y)—should this always be in parentheses?
PVector
x and y [floating point numbers—treat as variables? how about as components?]
location [object]
velocity [object]
PFont
PImage
Walker
Mover or mover
constructor [seen elsewhere as Constructor]
Particle [object]
ParticleSystem [class]

Chapter 2
PVector
Mover [class, object]
Liquid or liquid [object]
Attractor or attractor [object, class]

Chapter 3
PI
TWO_PI
Mover
Box2D
x and y or x,y or (x,y) [components]
PVector
Oscillator [class, object]
for [loop]
x location, y location
Wave [class]
Pendulum [object, class]
PVector origin, PVector location
(r,angle) [on p. 145; should that be fixed width?]
Bob [object, class]
Spring [class]
Attractor [object, class]

Chapter 4
Particle or particle [object, class]
particle system [sometimes appears as Particle System]
ParticleSystem [class]
Mover
Oscillator
PImage
lifespan [variable]
ArrayList
Generics/generics
for [loop]
Iterator [object, class; it always appears as FW in the text]
PVector
Dog [class]
Animal [class]
Confetti [class]
x location
Repeller [object]

Chapter 5
distance, strength [parameters—make FW ital as in blue book?]
Box2D
toxiclibs
VerletPhysics/VerletPhysics2D
JBox2D
PBox2D
Body
Shape
PVector
Vec2
Mover
Body Definition
BodyDef
PolygonShape, ChainShape, CircleShape
Fixture
FixtureDef
Box [object, tab, class]
ArrayList
(x,y)
Boundary (class, object)
ChainLoop
Surface
Joint
Particle
frequencyHz
dampingRatio
DistanceJoint
RevoluteJoint/RevoluteJointDef
TWO_PI
Windmill
box1, box2
MouseJoint
Spring
Attractor
ContactListener
Contact
Vec2D, Vec3D
GravityBehavior
VerletSpring/VerletSpring2D
Node
Cluster
AttractionBehavior

Chapter 6
In Exercise 6.18, make parameters FW ital? (separation weight, cohesion weight, alignment weight, maximum force, maximum speed)
boids
Boid object
Mover
Particle
Vehicle
Attractor
PVector
TWO_PI
maxforce
r [radius]
wander (cap "Wander behavior"? all caps?)
resolution
x component, y component
FlowField
PImage
cos(theta)
Path
normalPoint
a and b
target [variable]
ArrayList
ParticleSystem
Flock
magSquared
x-value

Chapter 7
Mover
Particle
Vehicle
Boid
generation [lc in illustrations, both lc and cap in text]
cap Cell if accompanied by a number (Cell # 5)
x,y
sometimes CA is treated as plural, sometimes not—best to think of it as one way or the other?

Chapter 8
Cantor set [sometimes Cantor Set]
ArrayList
KochLine (class, object)
PVector
mouseX
Branch [object]
String
L-System (or L-system?)
StringBuffer
stochastic [I figure it should be lc, but there's one instance of cap]

Chapter 9
String
ArrayList
parentA, parentB
Population
PVector
Rocket [class]
DNA [class]
float [data type]
Mover
Obstacle
Boolean [should be capitalized according to the dictionary; I'm going to search the chapters for other instances]
finishTime
Face class
genetic algorithm [occasionally shows up as Genetic Algorithm]
Bloop
World [class]
Constructor
ParticleSystem
health [variable]

Chapter 10
perceptron, Perceptron [class, object]
x and y
weight[x] and weight[y] [subscript x and y]
int
[delta]weight
[delta]velocity
x position
yline
y-value [I think this looks better than y value]
Trainer
ptron
Vehicle
ArrayList
PVector
XOR
NOT AND
OR, AND
A and B
Neuron [object]
Connection [object]
Network object
a.location, b.location
Boolean

Table with code style

Got <pre> tag working in ASCIIDOC:

|
`<pre>`
int x = 100;
int y = 200;
`<\pre>`
|

and added this:

.table.code td {
    text-align: left;
}

but probably need font smaller and also line breaks aren't being maintained. Oh, and can't get things inside <> to render, i.e.

ArrayList<Particle> particles;

different quote style for longer quotes in text body

Chapter 4:

In 1982, William T. Reeves, a researcher at Lucasfilm Ltd., was working on the film “Star Trek II: The Wrath of Khan.” Much of the movie revolves around the Genesis Device, a torpedo that when shot at a barren, lifeless planet has the ability to reorganize matter and create a habitable world for colonization. During the sequence, a wall of fire ripples over the planet while it is being “terraformed.” The term “particle system,” an incredibly common and useful technique in computer graphics, was coined in the creation of this particular effect.

“A particle system is a collection of many many minute particles that together represent a fuzzy object. Over a period of time, particles are generated into a system, move and change from within the system, and die from the system.”
—William Reeves, “Particle Systems—a Technique for Modeling a Class of Fuzzy Objects,” ACM Transactions on Graphics 2:2 (April 1983), p. 92.

Since the early 1980s, particle systems have been used in countless video games, animations, digital art pieces, and installations to model various irregular types of natural phenomena, such as fire, smoke, waterfalls, fog, grass, bubbles, and so on.

add something at the end to wrap up the book

something informal, like a "Goodbye and thanks!" or "Here's where I leave you…", or something that hints at more to come, or something that tells readers to consider how far they've come with their Ecosystem Project.

code comment pair page-break-inside:avoid

this is causing some issues:

.code-comment-pair {
    page-break-inside: avoid;
}

Huge blocks of code are wrapping to the next page. Seems to be keeping together more than just the code comment and the line of code. Rendering this is a good example:

Chapter 2.  Forces
------------------

[[chapter04_section2]]
=== 4.2 A Single Particle

Before we can get rolling on the system itself, we’ve got to work on writing the class to describe a single particle.  The good news: we’ve done this already.    Our [klass]*Mover* class from Chapter 2 serves as the perfect template.  For us, a particle is an independent body that moves about the screen.  It has [var]*location*, [var]*velocity*, and [var]*acceleration*, a constructor to initialize those variables, and functions to [function]*display()* itself and [function]*update()* its location. Before we can get rolling on the system itself, we’ve got to work on writing the class to describe a single particle.  The good news: we’ve done this already.    Our [klass]*Mover* class from Chapter 2 serves as the perfect template.  For us, a particle is an independent body that moves about the screen.  It has [var]*location*, [var]*velocity*, and [var]*acceleration*, a constructor to initialize those variables, and functions to [function]*display()* itself and [function]*update()* its location.


[source,java]
----
class Particle {
  // A “Particle” object is just another name for our “Mover.”
  // It has location, velocity, and acceleration.
  PVector location;
  PVector velocity;
  PVector acceleration;

  Particle(PVector l) {
    location = l.get();
    acceleration = new PVector();
    velocity = new PVector();
  }

  void update() {
    velocity.add(acceleration);
    location.add(velocity);
  }

  void display() {
    stroke(0);
    fill(175);
    ellipse(location.x,location.y,8,8);
  }  
}
----

double check inline code formatting

anywhere in the raw ASCIIDOC files where it says:

// [bold]

this will have to fixed to have no space between the slashes and the [bold]

Corrected is:

//[bold]

@evanemolo I'll probably do a big find and replace at some point, but if you see these as you are inputting changes feel free to fix.

Multiple parameters for image/canvas

Some images will need to have multiple parameters, i.e. class for styling as well as JS files for canvas version, etc. Something like:

image::imgs/chapter01_2-01.png[canvas="processingjs/bouncingball_novectors.pde"][classname="half-width"]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.