Simon proving his peg solitaire solution:
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
I’ve been terrible at keeping this blog up to date. One of Simon’s best project in December 2019 was creating a chess robot and I haven’t even shared it here.
We were joking how this is Simon’s baby and her name is Chessy. Simon also made an improved version with a drop-down menu allowing to choose 1 to 5 steps ahead difficulty level (warning: levels 4 and 5 may run quite slowly): https://chess-ai-user-friendly–simontiger.repl.co/
While researching how to apply the Minimax algorithm, Simon has relied on Sebastian Lague’s Algorithms Explained – minimax and alpha-beta pruning; Keith Galli’s How does a Board Game AI Work? (Connect 4, Othello, Chess, Checkers) – Minimax Algorithm Explained; a Medium article on Programming a Chess AI: A step-by-step guide to building a simple chess AI by Lauri Hartikka; of course, The Coding Train’s challenge Tic Tac Toe AI with Minimax; and What is the Minimax Algorithm? – Artificial Intelligence by Gaurav Sen.
Simon contributed his chess robot to the MINIMAX coding challenge page on the Coding Train website:
And naturally we’ve had a lot of fun simply playing with Chessy as a family:
Inspired by the Card Flipping Proof by Numberphile, Simon created his own version of this proof. He made a solitaire game and proved why it would be impossible to solve with an even number of orange-side-up circles. He drew all the shapes in Microsoft Paint, printed them out and spent something like two hours cutting them out, but it was worth it!
If there’s an odd number of orange circles in the middle, then the end pieces are the same, both orange or both white. In both cases the total number of orange circles will also be odd. If there’s an even number of orange circles in the middle, then the ends have to be different (one orange, one white).
In the case of odd number of orange pieces, the ends have to match. In the case of an even number of orange pieces, you would have pieces that point the same way at both ends. “Now we’ve proven that to make this puzzle possible it has to have an odd number of orange pieces”, Simon says.
Why? Imagine a stick figure that always walks to the right, but always faces in the direction of the arrow (as in it can’t go backwards). It would flip every time it reaches an orange circle. Focusing on everything except the ends, if there are an odd number of orange circles, the puzzle pieces would face the other way. Which means that the end pieces are the same, and therefore the end circles are the same. If there are an even number of orange circles in the middle, the puzzle pieces would face the same way. Which means that the end pieces are different, and therefore the end circles are different.
Simon finds this sort of proof easy, but I felt like my brains are going to boil and dripple through my ears and nostrils. He patently exlained it to me several times and types the above explanation, too.
It’s Sinterklaas season in the Dutch-speaking world and, of course, as we have started baking the traditional spiced cookies called kruidnoten (“gingerbread buttons”) Simon didn’t want to miss an opportunity to play a version of peg solitaire with eatable pieces!
Simon loves the Maths Is Fun website and has borrowed a couple of ideas for cool games from there. He wrote the code completely on his own, from scratch. Below is a video where he presents his Connect games:
I’ve gone Connect Crazy!
This project is inspired by MathsIsFun, which has a lot of variations on the classic game Connect Four, the code is entirely mine.
Classic Game of Connect Four: https://editor.p5js.org/simontiger/full/TISsTqZ8D
And then I’ve made Connect Three: https://editor.p5js.org/simontiger/full/c30Oqd4Qf
And Connect Five: https://editor.p5js.org/simontiger/full/I6Digth0A
Then I’ve also made a version called Drop, where if the bottom row fills up, the whole board drops down one row:
Another game Simon built was Bulls and Cows (trying to guess a sequence of letters): https://editor.p5js.org/simontiger/full/3bC9j3501 Link to Simon’s code: https://editor.p5js.org/simontiger/sketches/3bC9j3501
Yet another one was a Reaction Time test! You can test your reaction time by clicking anywhere on the screen as soon as the circle changes color: https://editor.p5js.org/simontiger/full/Gzv094mgzM Link to Simon’s code: https://editor.p5js.org/simontiger/sketches/Gzv094mgzM
And last but not least, an unfinished project of building a Checkers game:
Simon has worked really hard for several days on his first machine learning community contribution! He has created this mini-series about building a game of Make 24 with Google’s Teachable Machine that he trained to recognise gestures as a game controller.
“It’s the first time I’m using ml5 from scratch! I’ve also built in a feature to enable the users to train their own models!”
Link to my ml5 project: https://editor.p5js.org/simontiger/full/McNY2_ay_
Link to my game of Make 24 without ml5/Teachable Machine: https://editor.p5js.org/simontiger/full/qH_ZSvup5
Simon has been fascinated by these possible-impossible puzzles (that he picked up from the MajorPrep channel) for a couple of days. He prepared many paper visuals so that Dad and I could try solving them. This morning he produced this beautiful piece of design:
This is a project that Simon started a few weeks ago but never finished, so I think it’s time I archive it here. It’s based upon this wonderful Numberphile video, in which Ben Sparks shows a curious math problem – a game of cat and mouse – in a computer simulation he’d built. The setting is that the mouse is swimming in a round pond and is trying to escape from a cat that is running around the pond. What is the strategy that the mouse should apply to escape, considering that it swims at a quarter of the speed the cat runs?
Simon came up with his own code to recreate the simulation from the Numberphile video. In the four fragments I recorded, he showcases what he has built. Please ignore my silly questions, at the time of the recording I hadn’t viewed the Numberphile video yet and had no idea what the problem entailed.
Simon opened up a genetic algorithm game he built about two years ago and made a fascinating discovery: one of the organisms seems to have become immortal! Simon has called his discovery “The Everlasting Vehicle” and saved the vehicle’s DNA.
Links to the game on GiHub:
Original code: https://github.com/simon-tiger/steering-behaviors-evolution
p5.js version: https://simon-tiger.github.io/Game_SteeringBehaviorsEvolution/SteeringBehaviours_EvolutionGame_p5/
The last time I ran the program is a couple of hours ago. Everything died out, except for one vehicle.
I have programmed this with a genetic algorithm. They have a DNA with 4 genes.
Attraction/Repulsion to food
Attraction/Repulsion to poison
How far it can see food
How far it can see poison
They also have a health, which goes down over time. If they eat food, then their health goes up, if they eat poison, then their health suddenly goes down. A good health is 1, and a bad one is 0.
So what was The Everlasting Vehicle’s DNA and health?
Attraction/Repulsion to food 1.9958444373034823
Attraction/Repulsion to poison 1.3554737395594456
How far it can see food 53.31017416626768
How far it can see poison 23.33902221893798
Average health ~397
So it attracts to poison, yet its health is approximately 397 times bigger than a very good health! And better yet, it even lasted for a couple of hours so far!!!
Inspired by Daniel Shiffman’s Evolutionary Steering Behaviors Coding Challenge
Link to the Challenge: https://www.youtube.com/watch?v=flxOkx0yLrY