The Square-Sum Problem

Simon has become a full-blown Numberphile fan over the past couple of days. He had already watched two Matt Parker videos before, but it’s this week that he got seriously hooked on the channel, and it all started from the Square-Sum Problem video!

Simon recorded and edited two videos of his own (in OBS) trying to solve the Square-Sum Problem, manually and using JavaScript code:

 

 

Advertisements

Live Stream #6. (Mostly) Chapter 2 of Living Code: Forces.

Simon’s latest live stream on Thursday, January 11 was a blast! For the first time in his programming career he actually had quite a few viewers – largely thanks to Daniel Shiffman, who posted an announcement about Simon’s live session in his Twitter:

During the session, Simon recorded 6 tutorials:

  • a bonus video about vectors,
  • a video about forces in general,
  • a video about mass,
  • a video about the Friction Force,
  • a video about Air Resistance
  • and a video about Gravitational Attraction.

All as part of his “Living Code” Course. The lessons in the course are loosely based on Daniel Shiffman’s book “The Nature of Code“, but focus on JavaScript.

Simon was worried in the beginning, because he had forgotten to prepare for the stream and had no choice but do the theory (on physical forces) on the fly. It was wonderful to see how the competent viewers gave him a helping hand every now and then and generally encouraged him in the live chat. He even got a real Q&A session in the end, something he had always dreamed of:

Schermafbeelding 2018-01-11 om 20.38.49Schermafbeelding 2018-01-11 om 20.39.27Schermafbeelding 2018-01-11 om 20.39.42Schermafbeelding 2018-01-11 om 20.40.01Schermafbeelding 2018-01-11 om 20.40.20Schermafbeelding 2018-01-11 om 20.40.45Schermafbeelding 2018-01-11 om 20.41.01Schermafbeelding 2018-01-11 om 20.41.14Schermafbeelding 2018-01-11 om 20.41.24

Langton’s Ant in p5.js

Simon wrote this JavaScript code for Langton’s Ant (a type of Cellular Automaton) himself, inspired by Daniel Shiffman’s description/version in Processing (Java) during the Coding Train live stream on January 5.

Link to Simon’s sketch: http://alpha.editor.p5js.org/simontiger/sketches/rJeKLICmM

Simon later also made a pixel level version: http://alpha.editor.p5js.org/simontiger/sketches/rJeKLICmM

And a version with multiple ants: http://alpha.editor.p5js.org/simontiger/sketches/r1Ry_FQ4M

(Simon also loves the Numberphile video about how Langton’s Ant works and forms a mysterious “highway” after a certain number of moves).

Tetris Game in JavaScript

Simon built this Tetris game in one day on Wednesday. He didn’t use any libraries. The code largely comes from a Meth Meth Method video tutorial, but Simon made it object oriented and adjusted some parameters.
You increase your score for every row that’s fully populated. However, if you have four rows that are almost fully populated and you get them fully populated at once, you increase your level.
Link to Simon’s code: https://github.com/simon-tiger/tetris-js

Play Simon’s Tetris Game online: https://simon-tiger.github.io/tetris-js/
Link to the Meth Meth Method video: https://www.youtube.com/watch?v=H2aW5V46khA&t=1s

Magic around New Year’s Eve

This magical time of the year, Simon’s craziest, most daring dreams come true! First, his guru from the New York University Daniel Shiffman sends Simon his book and the words he writes there are the most beautiful words anyone has ever told him. Then, on the last day of the awesome year 2017, Simon’s other hero, the glamorous knight of AI Siraj Raval materialises in our living room, directly from YouTube! Happy New Year full of miracles and discoveries everyone!

DSC_3314

Daniel Shiffman’s book “The Nature of Code” that Simon had already largely read online and now also reads before bed. It also comforted him recently when he was in pain, he cuddled up of the sofa with this big friendly tome on his lap.

dsc_33401897498871.jpg

Daniel Shiffman signed the book for Simon:

dsc_33441647117253.jpg

dsc_33421879896746.jpg

Siraj Raval stepped out of the YouTube screen straight into our Antwerp apartment on December 31. Simon has been following Siraj’s channel for months, learning about the types of neural networks and the math behind machine learning. It is thanks to Siraj’s explanations that Simon has been able to build his first neural nets :

DSC_3370

DSC_3364

Schermafbeelding 2018-01-05 om 02.07.56

Simon writes CodePen blog on for-loops

Simon has authored a comprehensive post about For-Loops (in JavaScript ES5 and ES6) in the CodePen blog, nice for anyone learning about loops syntax:

https://codepen.io/simontiger/post/for-loops

Simon’s update: I now also have a post about While-Loops: https://codepen.io/simontiger/post/while-loops

Simon’s Fibonacci function and Fibonacci counter in p5.js

Simon came up with this Fibonacci function while taking a walk downtown:

Schermafbeelding 2017-12-23 om 02.41.53

f(0) = 0

f(1) = 1

f(n) = f(n-1)+f(n-2)

When we got home, he used the function to build a Fibonacci counter in p5.js:

You can play with Simon’s Fibonacci counter online at: https://alpha.editor.p5js.org/simontiger/sketches/Skhr3o8Gf

The idea about the Fibonacci function struck Simon when he was looking down at the cobbles under his feet. “Look, Mom! It’s a golden rectangle!”, he shouted:

DSC_3157

He had read that golden ratio has a direct connection to the Fibonacci sequence. The same evening, he took out his compasses to draw a golden rectangle (this time not his own invention, but following the steps from his Murderous Math book):

DSC_3168

DSC_3169

If you turn the page, the smaller rectangle is a golden rectangle as well, and if you slice a square off of it, the remaining rectangle will also have the golden proportions. You can continue doing this infinitely. The sizes of the rectangles will exactly correspond to the numbers in the Fibonacci sequence, which makes these drawings an illustration to the sequence.

DSC_3170

The next day, Simon showed his function to his math teacher. Below are the Fibonacci sequence numbers he got through his selfmade JavaScript program. After a certain number, the computer started taking too long to compute the following number in the sequence (several seconds per number), but didn’t crash.

DSC_3164

Live Stream #4 on December 14. Living Code > Vectors.

Simon debuted with his own coding course last week! The course is called “Living Code” and Simon has already planned all its sessions for the year ahead. He is going to teach the course as part of his live streams (once in two weeks on Thursday evenings at 17 CET), although not every live stream will include Living Code sessions.

In the first Living Code session (that was live on December 14), Simon introduced the course and its Chapter 1: Vectors. He talked about mathematical operations with vectors, their magnitude, acceleration and normalisation.

There were no crashes or technical issues this time and Simon remained amazingly focused and organised during the stream, he had actually created a schedule for himself beforehand (without any incentive on my behalf):

Timestamps for this live session (new):
0:00:00 – 0:05:00: Announcements
0:05:00 – 0:15:00: Starting Question & Answer
0:15:00 – 0:20:00: Intro to Living Code
0:20:00 – 0:30:00: What is a Vector?
0:30:00 – 0:40:00: Vector math: subtract, multiply, divide
0:40:00 – 0:50:00: Vector math: magnitude, heading, normalize
0:50:00 – 1:00:00: Physics: acceleration, (maybe) jerk
1:00:00 – 1:10:00: Ending Question & Answer

Please subscribe to our YouTube channel  and you won’t miss a video or a live session!

Below is the archived version of Simon’s first Living Code course lessons:

Simon’s Music Random Walker

Link to Simon’s project in progress: https://codepen.io/simontiger/pen/LOg…

The walk begins with a white grid. Every time the walker first visits a cell, it first turns purple and the green number inside the cell increments with every next visit. Simon wants to assign a musical tone to each cell as a next step.

 

He started working on his own database for the tone frequencies (7 octaves in the 7 x 7 grid), but later lost all his (unsaved) work when his laptop froze. Not sure anymore whether this project will ever get finished 😦 as Simon doesn’t feel like retyping the database again.