Simon’s latest Live Stream about Chapter 6 of his “Living Code” Course (particle systems!), loosely based on Daniel Shiffman’s Nature of Code. “I’m also going to live stream a surprise maths video”, – at the beginning of the stream Simon devoted some time to the magic hexagon problem.

# Tag: Coding

# Live Stream #14. 15’s Puzzle Redo continued.

In this live session, Simon continue my 15s puzzle redo live session (“yet again, but I swear this is going to be the last time I do this!” Simon said). Here’s a link to the previous part. This week’s live stream went great, Simon kept it concise, didn’t panic while debugging, largely thanks to a wonderful supportive audience. And he even got some interesting personal questions asked in the end!

# Magic Cards in Base 3!

Simon has developed his version of the Magic Cards, this time in Base 3. He invented this system completely on his own and actually created a program in Processing (Java), using ternary function, to make the cards! The the code for creating the five cards in Processing and exporting the images as png files is available on Simon’s page on GitHub: https://github.com/simon-tiger/browns-criterion-base3

To play the game, have someone think of a number between 0 and 242 and let that person look for his/her number on every card and tell you which colour it is on every card. Every card stands for a power of 3: 81, 27, 9, 3, and 1. There are three grids of numbers on every card, a blue grid (representing the zeros in base 3), a red grid (representing the ones in base 3), and a green grid (representing the twos in base 3). After your friend has found his/her number on all the five cards, you can go ahead and add all the results up to guess the number. Alternatively, if you find working with base 3 too difficult, just sum up all the red numbers in the top left corners (on all the cards where your friend’s number was red), then double all the red numbers in the top left corners (on all the cards where your friend’s number was green) and add all of those together to guess the number.

Simon started out by actually trying to draw the magic cards:

But quickly realised he’s better off writing a computer program to fill in the grids. When the program (pretty tough to write) was finally ready, he tried to print a card out and… ran out of ink on our home printer. Next, we rushed to the print shop, as it was about to close.

“Mom, I can calculate why it says 17 million colours! It’s 256 cubed!” (255 for Red, Green and Blue plus one for alpha).

Simon previously developed a magic card system for Prime Numbers and wrote a Java program that guessed the numbers using powers of two.

# Reds and Greens

Simon has crafted a nice game today, inspired by a video in which mathematician Katie Steckles shows several mathematical games. Simon wasn’t sure what the game was called so he named it “Reds and Greens”. The objective of the game is to accumulate a set of three cards sharing the same property (such as the same number of green dots or red dots, the same total number of reds and greens or a set in which all the three possible variants – one, two and three dots of the same color – would be present). Each player pulls a card from the stack (all the cards are lying face up) and the one who collects a set first wins. Simon has actually programmed the cards in Processing (Java) – quite a strenuous task. Below is the jpeg pic of what he made and his code in Processing.

Simon also explained how the game is very similar to Tic Tac Toe, look at the photo below and you’ll see why:

# Simon and Daniel Shiffman

Today is one of the most beautiful days in Simon’s life: NYU Associate Professor and the creator of Coding Train Daniel Shiffman has been Simon’s guarding angel, role model and source of all the knowledge Simon has accumulated so far (in programming, math, community ethics and English), and today Simon got to meet him for the first time in real life!

Daniel Shiffman posted:

# Simon’s Lecture on Programming Languages

In this video, Simon gives an introduction to the basics of programming languages (what languages there are, which ones are front end and which ones are back end and what libraries and data interchange formats go with different languages):

# Coding everywhere, swimming and popping giant balloons

A few more pics from the coding everywhere series:

Here Simon made a game especially for his sister:

Among the remaining favorites were reading (see an earlier post), swimming (and playing in the water) and, surprisingly still very high up on the list, popping giant balloons. City trips, walking and museums were way down below or even cancelled all together, even though the visit to Park Güell can be rated as successful.

# Hero Game in Processing. Simon’s Own Code.

Simon has created a great new game in Processing: The Hero Game! It is somewhat like the good old Mario, except that Simon has no idea what Mario is and came up with the concept himself. The game is based upon Circle-Rectangle Intersection, something that he was studying for the past several days. It was impressive to see how quickly he wrote the program for the game, I think it took him something like an hour, while waiting for dinner. The game has a hero (Simon), represented by the yellow circle, obstacles (from below and above) and money that the hero collects to get points. The game stops once the hero hits an obstacle. Simon is planning to add extra random obstacles and maybe also create a winning score threshold (around 50 or 65, he says). His own highest score so far has been 35.

Below are the making-of videos, step by step:

Update: Simon added trees!

# Translating Bit Invader from Codea into JavaScript

Simon tried to reconstruct Bit Invader game (from Codea.io) in JavaScript, but got stuck at a certain point when he was programming the enemy to recognize the hero and the bullets. Here is how far he got. The project is available on Simon’s page in Codepen:

https://codepen.io/simontiger/project/editor/AdyVmr/

# Simple Physics. Translating from Lua (the language in the Codea app) into Java

Simon came up with an idea to translate a physics visualization from the Codea app (using a language called Lua) into Processing (Java) by applying Box2D. The first two videos below show him working on that project.

As he got stuck later, Simon decided to do the same project in p5.js instead, applying Matter.js:

This turned out to be quite difficult as well: he got stuck while trying to calculate the exact coordinates for all the shapes involved in the visualization (it was supposed to resemble bricks falling down and rolling down two slopes). So what Simon did as the next step in this “exercise” was switch back to Processing and create a grid with numbered coordinates. When I asked him, why he didn’t make the same grid in p5, he answered that he just loved Processing so much. Eventually though, this grew into a different project:

Confusing as these sidesteps may seem I’m sure Simon got a lot of practice out of this.

Here is a game Simon tried translating from Lua into Processing, it’s called Brickout: