nature-of-code / noc-book

The Nature of Code book (archived repo, see README for new repo / build system!)

Home Page:http://natureofcode.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing explanation

PPrasai opened this issue · comments

In the first "Introduction" chapter, there is this piece of code to ascertain the next step of the Walker:

void step() {
    float stepx = random(-1, 1);
    float stepy = random(-1, 1);

    x += stepx;
    y += stepy;
}

For some reason, the next step is always drawn relatively to the top-left of current location and the Walker heads in the general direction towards the top-left of the window. Some explanation about why the Walker's behaving like that would be very much appreciated!

Addressed in noc-book-2 now.