All methods mentioned, assume the reader knows how to copy and read code from a GitHub repository. Step 1 for all methods is keeping the desired sketch open in GitHub.
Copy the code just from the main source-code, i.e., sketch.js
Paste it into the web editor (and save - Ctrl+S works, to avoid losing it from your editor)
Click on the Play icon to run the simulation - shown beside the editor (named Preview)
NOTE: For some sketches (in ch:4,5) I will refer to global files in the repo directory. Check the accompanying index.html (in the same directory as the sketch) to ensure that all the files used are imported to the web editor. And referenced in the index.html file with the correct relative path
2. Locally using VSCode IDE (Preferred method by me):
Clone the entire repository into your local computer (How to do that?) - you would also need to have VSCode and the Git installed locally or just the folder containing the sketch you would like to run (in that case you do not need Git)
Install the P5 Server extension in VSCode, this also auto-installs the Live Server extension - which enables the user to host a local server in just one click.
Right-click onto the corresponding index.html file and click Open with Live Server option - this should automatically open a tab in your browser, which will run the simulation of the code
Again be careful that all the .js files referenced in sketch.js are available locally on the computer, with the same directory.
3. Locally through other means:
Technically all the written codes should run on any JS runtime environment, which can also locally host a web server. Since all the code only does the following:
Open a html file (index.html) with all the required libraries, stylesheet and most importantly our sketch.js within a <script> tag to run the code
While running the code, with the help of the p5 library, it notices that the code is supposed to run on the Canvas element defined using createCanvas( width and height ). And places this element at the origin of the <div> element it is in (usually just the screen)
Therefore one could also manipulate the Canvas element to reposition, resize it, by naming it and accessing it within the html, and the p5.js file as shown here
But, the exact methods for running the sketch files will differ according to the JS runtime chosen. So instructions will vary.