This random number generator Simon built in Processing simultaneously graphs the probability of the values as you “throw the dice”. This is Simon’s own code and what’s more, he has turned it into a truly scientific experiment/observation. Simon programmed the generator to automatically throw the dice every 60 frames a second (i.e. every 1/15th of a second). The graph showing the probability of certain values should increasingly resemble a perfect isoceles triangle the more throws occur, because the probability of you getting 7 is much higher than those of getting 2 or 12.
The perfect triangle was drawn at around 4000 throws.
Simon also experimented with programming the same generator for 3 dice. The graph should then form a bell shaped curve, a parabola, and takes a longer while to shape up. “As the number of dice grows towards infinity, the distribution will change from a uniform distribution to a Gaussian distribution”, – Simon explains.
Simon’s live stream last night was a blast. Simon worked on two games on a grid: 15s Puzzle and Connect Four, both in Processing (Java). He had already made the 15s Puzzle before, but built the Connect Four (also called Four in a Row) without any prior preparation.
The stream got lots of views as Daniel Shiffman kindly advertised it again on his Twitter:
Let me also archive the live chat here, to save it from oblivion:
Simon playing his game together with sis:
This is a project about pattern. “Some people look for patterns. We call those people mathematicians”, Matt Parker said in a Numberphile video. I think I have never heard a description that would suit Simon better. He has always been looking for patterns, everywhere – in music, in toys, in ice-cream menus, in books about space or chemistry manuals. When he was little and spent days ranking planets and stars from memory, we used to think space was his true interest. Or elementary particles. Or the periodic table. Or Japanese letters. Or Greek letters. As it turned out later, he simply picked the topics that had more pattern in them, that were easy to classify. To this day, he enjoys music theory much more than actually playing the piano, and when listening to music I see him move his hand rhythmically every time a recognisable/ repetitive pattern is distinguishable.
In the video below, Simon is trying to build a Hilbert Curve (a space filling curve, a type of fractal) in Processing. The project was inspired by the math videos by 3Blue1Brown and the Koch Snowflake example by Daniel Shiffman (Chapter 8 in his book The Nature of Code, Fractals).
Links to the Hilbert Curve videos on the 3Blue1Brown channel:
Simon built this game inspired by a Numberphile video (he had never seen or played the actual puzzle before, but I have as a kid). The code is Simon’s own, here is a link to the code on GitHub: https://github.com/simon-tiger/15s_puzzle
The math behind this project comes from the amazing math channel 3Blue1Brown: https://www.youtube.com/watch?v=QJYmyhnaaek
Inspired by a Meth Meth Method Tetris video, Simon has come back to his Tetris project in Processing, something he started a long while ago and never finished. At the moment, the primary difficulty he experiences is having the pieces accumulate at the bottom of the grid and not vanish immediately once hit by other pieces. Work in progress.
Simon has become a Processing Foundation member! We love Processing! Anyone is welcome to join, just go to Processing.org to support this wonderful open source platform – what better way to celebrate this season than donate for a more enlighten future? We can rightfully say that Processing has played a huge role in Simon’s development as a young programmer so far and he definitely hopes to become an even more active member in the years to come.
Simon invented this fun game in Processing after he and his little sister had some proper winter fun outdoors in the fresh December snow (quite rare for the local climate and thus immensely cherished by the little people). The game is about throwing snowballs in such a trajectory that they stick to one another, forming a super-snowball. After I finished filming this, the two snowball throwers had such a great time with the game that I dare say the giggling effect from of this 2D simulation overshadowed the real snowball fight that had originally inspired it. They did love playing in the real snow on the next day though, until it melted away.
Simon’s new take on cellular automata:
Some results would make fancy knitting patters!
In case you wonder, what on earth are cellular automata:
A cellular automaton (pl. cellular automata, abbrev. CA) is studied in computer science, mathematics, physics, theoretical biology and microstructure modeling.
A cellular automaton consists of a regular grid of cells, each in one of a finite number of states, such as on and off . The grid can be in any finite number of dimensions. For each cell, a set of cells called its neighborhood is defined relative to the specified cell. An initial state (time t = 0) is selected by assigning a state for each cell. A new generation is created (advancing t by 1), according to some fixed rule (generally, a mathematical function) that determines the new state of each cell in terms of the current state of the cell and the states of the cells in its neighborhood.
The concept was originally discovered in the 1940s by Stanislaw Ulam and John von Neumann while they were contemporaries at Los Alamos National Laboratory. While studied by some throughout the 1950s and 1960s, it was not until the 1970s and Conway’s Game of Life, a two-dimensional cellular automaton, that interest in the subject expanded beyond academia. In the 1980s, Stephen Wolfram engaged in a systematic study of one-dimensional cellular automata, or what he calls elementary cellular automata; his research assistant Matthew Cook showed that one of these rules is Turing-complete. Wolfram published A New Kind of Science in 2002, claiming that cellular automata have applications in many fields of science. These include computer processors and cryptography. (Wikipedia)
Simon has prepared this implementation of “K-Means Clustering” in Processing as a gift for Daniel Shiffman, who is plainning to talk about this Machine Learning model in one of his upcoming live sessions on the Coding Train channel.
Simon writes: K-Means Clustering is a type of Machine Learning Model. It’s for “Unsupervised Learning” (meaning you have data with no labels).
Link to Simon’s code on GitHub: https://github.com/simon-tiger/k-means-clustering
Link to pseudocode by Siraj Raval: https://www.youtube.com/watch?v=9991JlKnFmk&spfreload=1