# Simon’s own little neural network

This is one of Simon’s most enchanting and challenging projects so far: working on his own little AIs. As I’ve mentioned before, when it comes to discussing AI, Simon is both mesmerized and frightened.  He watches Daniel Shiffman’s neural networks tutorials twenty times in a row and practices his understanding of the mathematical concepts   underlying the code (linear regression and gradient descent) for hours. Last week, Simon built a perceptron of his own. It was based on Daniel Shiffman’s code, but Simon added his own colors and physics, and played around with the numbers and the bias. You can see Simon working on this project step by step in the six videos below.

His original plan was to build two neural networks that would be connected to each other and communicate, he has only built one perceptron so far.

# 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:

# Circle-Rectangle Intersection (Collision)

Simon has been studying  various 2D collisions (via the p5.collide2D library and paulbourke.net), especially the Circle-Rectangle Intersection (Collision). He was so busy with this problem that he even put it down in chalk at the playground:

And on the whiteboard at home:

And spent nearly his entire math lesson today talking about the math behind 2D object collision to his math teacher:

Simon also used Circle-Rectangle Collision for his awesome new Hero Game in Processing!

# Snake Game in Codea

We were caught up in the rain and had to wait at a restaurant. What do you do in a situation like this? Simon made a snake game on his iPad, inspired by something he saw on the D3 library:

# Interactive Math Functions

Simon was reading about math functions on Wikipedia and came up with an idea to create an interactive math functions editor in JavaScript that would visualize (i.e. show the graphs for) all the functions. Simon was especially excited about cosecant, secant and cotangent (csc, sec and cot for short), which were new to him:

Simon partially programmed the interactive math functions editor, but it remained unfinished:

# The Sea Game. Simon’s First Own Game.

Simon created his very first video game completely on his own. Everything in this game he came up with by himself – from the original idea and design to the final code. The game is about a little man (actually, Simon himself) jumping over the waves in the sea. Every time he lands on an actual wave it’s game over.

Simon used collision detection (point-rectangle instead of rectangle-circle collision detection) and array lists to duplicate the waves. He created an illusion of 3D by choosing the viewing angle “almost as if it were an orthographic camera”, he explains.

The code for this game (in Processing i.e. Java) is available on GitHub at

https://github.com/simon-tiger/video-games

The making of, step by step:

Simon had trouble with the game over function. Originally, it was only triggered once the player clicked the mouse to jump again while on a wave, instead of reading to the circle-rectangle (little man-wave) collision. Simon asked about this problem in the Coding Train slack channel and got some great responses. Eventually he solved the problem is his own way (see the “Debugged” video):

# ES6, the new syntax

Simon normally uses the old JavaScript syntax but has been looking into the new ES6. Below are Simon’s notes on the new syntax in JavaScript called ES6 for cleaner more concise code (using sets, not arrays):

# Simon trying out the D3 library

Simon spent hours studying the D3 library on Sunday, it’s a very popular JavaScript library using SVG images he had never tried before. He also found it great how the annotations are in English, Russian, Chinese and Japanese and showed it to his Chinese teacher today.

He also created an account on the library website, but couldn’t figure out how to create a new project. We should look at it together this week when I finally have more time.

These are two small videos of Simon trying the D3 library out:

# Fractal Trees Customized

This weekend Simon came back to his old fascination, Fractal Trees. This time he didn’t just follow along Daniel Shiffman’s coding challenges, but created customized versions of Daniel’s trees, adding color and physics in some cases or writing the code in object oriented manner: