# Evolving Creatures in p5.js

Simon’s latest independent coding project involved some biology lessons! He loves the channel Primer by Justin Helps and watched his evolution series many times, studying the rules for species’ survival and multiplication. This resulted in two interactive evolution simulations, in both of which Simon recreated the rules he learned. The first simulation doesn’t involve natural selection and is based on these two videos: Simulating Competition and Logistic Growth and Mutations and the First Replicators.

Full Screen interactive version: https://editor.p5js.org/simontiger/present/MK4b75542

Simon added natural selection in Part 2, based on Primer’s video Simulating Natural Selection (the code Simon wrote from scratch):

Full Screen interactive version: https://editor.p5js.org/simontiger/present/68WXliTza

We devoted the beginning of January to a goofy stop-motion project: Simon and I baked 2048 cookies! No, we didn’t bake over two thousand cookies! We only baked and decorated a little over a hundred of them, Simon had calculated that that would be enough to play the 2048 game… with cookies. Simon came up with all the editing tricks to make this project work. In the video, he also explains his winning strategy and confesses he has made another attempt to program the game, without me knowing it. Apparently, that’s how he first came up with the idea to bake the cookies, by looking up pictures of 2048 while programming and stumbling upon this blog.

Here is a link to Simon’s previous attempt to program 2048, about a year ago (he got pretty far).

# Simon's Formula to Check Triangle Numbers

Simon spent the morning of December 5 pondering about how to test whether a number is a triangle number. “To test if something is a triangle number: double it, ask if it’s a multiple of its own square root. If that square root has a decimal, round it down”. This was his initial hypothesis, later discarded.

Another formula he came up with was if n is even, m is a triangle number. After we got back home, he quickly wrote some code to check it:

# Approximating pi and e with Randomness

This has been one of Simon’s most ambitious (successful) projects so far and a beautiful grand finale of 2019, also marking his channel reaching 1K subscribers. The project – approximating Euler’s number (e) in a very weird way – is based upon a Putnam exam puzzle that Simon managed to prove:

The main part of the project was inspired by 3Blue1Brown Grant Sanderson’s guest appearance on Numberphile called Darts in Higher Dimensions, showing how one’s probable score would end up being e to the power of pi/4. Simon automated the game and used the visualization to approximate e. Below is the main video Approximating pi and e with Randomness. You can run the project online at: https://editor.p5js.org/simontiger/present/fNl0aoDtW

The history and the math behind the project:

Simon’s proof od the math behind the project:

Simon has visualized this problem and proof at: https://editor.p5js.org/simontiger/present/2uMPZ8THW

# Galton Board in p5.js

Simon saw a prototype of this Galton Board in a video about maths toys (it works similarly to a sand timer in a see-through container). He created his digital simulation using p5.js online editor, free for everyone to enjoy:

https://editor.p5js.org/simontiger/sketches/h7p-wZCw8

# More Engineering. RAM Ready in the simulated 8-bit computer project in Circuitverse.

In October and early November, Simon was busy with another attempt to simulate SAP-1 (simple as possible processor, an 8-bit computer) in Circuitverse (something that he hadn’t managed to complete when he tried it last time). I’m not even sure if anyone uses Circuitverse for such large-scale projects.

On November 7, Simon finally managed to finish the RAM on his simulated 8-bit computer (a computer where every general-purpose register contains 8 bits and therefore can only process 8 bits of data)! Although he is far from the end of the project, he is convinced that the RAM is the hardest part, so “now everything is going to be okay!”

“RAM was the hardest mainly because I have been trying to build the subcircuit for the RAM myself, which is not going to do it for SAP-2”,(Simon’s next ambition, also an 8-bit computer but with 64K memory, 2K PROM + 62K RAM). “This time the RAM I needed was particularly small, so I built a mini-RAM myself”.

You can view and launch this (unfinished) project via this link: https://circuitverse.org/users/7241/projects/35775

All of Simon’s projects on his Circuitverse page: https://circuitverse.org/users/7241

Simon’s current plan is to record a series of videos based on the Digital Computer Electronics book he uses as a guide in his engineering projects.

These are some simpler circuits from late September, simulated on Tinkercad:

# Simon’s Random Number Generator

This one’s back from mid-October, forgot to post here.

Simon created a random number generator that generates a frequency, and then picks it back up. Then, it calculates the error between the generated frequency and the picked up frequency. This is one of my community contributions for a Coding Train challenge: https://thecodingtrain.com/CodingChallenges/151-ukulele-tuner.html