Evolutionary Steering Behaviors Game

Note: See the update at the bottom of this post!

We’ve had quite a dramatic situation here for the past couple of days, after Simon turned Daniel Shiffman’s Evolutionary Steering Behaviors Coding Challenge into a game in Processing (Java) and then also in JavaScript (with p5). After completing the game in JavaScript, Simon wanted to add a new feature – a checkbox he programmed using the p5.js library. The checkbox would give the player the option to play with or without the timer, adjust the timer and also had a “New game” button. In the end it turned out that the checkbox didn’t really work. Simon was very upset and it took me hours to talk him into putting the game online even though the checkbox didn’t function (he wanted everything to be perfect) and ask for advice. “I have got a problem with a p5 element: In my setup function, I defined my checkbox. In my reset function, my checkbox is undefined. Why?” – Simon asked in the “Share Work” section of the Coding Train Slack channel, where he has the opportunity to communicate with experienced programmers. He received quite a lot of help and was enthusiastic about it at first, but for some reason, he hasn’t tried the solutions he was suggested. Perhaps it’s his gut feeling that the bind function suggested is still too difficult at the moment. I have decided not to push anymore and trust him on this one, although it’s always a dilemma for me whether I should sometimes “force” him into taking instructions from others or let him solely rely on his fantastic intrinsic autodidact mechanisms. The second seems to work better in terms of the learning process, but I do push him into sharing his work.

Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 3Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 4Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 5Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 6Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 7Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 8

Evolutionary Steering Behaviors game. Asking help in Slack 10 Jul 2017 2

Simon’s game is online at: https://simon-tiger.github.io/Game_SteeringBehaviorsEvolution/SteeringBehaviours_EvolutionGame_p5/

In the videos below Simon shows how he made the game. It’s an ecosystem type of genetic algorithm (with no generations), where the organisms (autonomous steering agents) clone themselves. The autonomous steering agents evolve the behavior of eating food (green dots) and avoiding poison (red dots). Simon added two invaders into the game, one giving food and the other randomly spreading poison. The player can control the “good” invader by moving him and making new food. The goal of the game is to make the agents survive for as long as possible.

The Processing (Java) version:

The thinking behind the game (Simon explains everything at the whiteboard):

The JavaScript version (now online):

In the last video, Simon talks about his problem with the p5 element.

 

Evolutionary Steering Behaviors game seek algorithm part 1. DESIRED equals TARGET minus POSITION:

Evolutionary Steering Behaviors game seek algorithm part 1. DESIRED equals TARGET minus POSITION 4 Jul 2017

Evolutionary Steering Behaviors game seek algorithm part 2. STEERING equals DESIRED minus VELOCITY:

Evolutionary Steering Behaviors game seek algorithm part 2. STEERING equals DESIRED minus VELOCITY 10 Jul 2017

UPDATE: When Simon saw Daniel Shiffman’s comment on Slack this morning (Daniel saying Simon did a fantastic job and that he might even include Simon’s game in the next Live Stream), he sat down and applied the bind function as suggested by his older peers above – without any incentive on my behalf! And it worked! I think we’ve hit a true milestone again. Simon has this growing feeling that he’s got friends out there, his tribe, who understand and who are ready to help.

One day later: Simon had another chat with his friends on Slack and got a lot of help with the last remaining small bug in his game (the New Game button didn’t start a new game if the player had chosen to play with no timer but jumped to Game Over instead). In the video below, Simon shows how that problem got solved:

And some of the latest quotes:

Simon talking to himself in English, lying on the floor under his desk, his chair upside down next to him: “Am I also 4D? Probably, because I live through time…”

***

Originally in Russian, very excited: “Mom, did you know it’s a geometrical progression? The A in the first-lined octave is 440Hz, in the second-lined octave it’s 880 Hz and in the third-lined octave – I don’t remember exactly, but how much is 880 times 2? Yes! 1760 Hz!”

Looking for math everywhere

Funny how, even when training some pretty straightforward (and boring) arithmetic or Dutch reading, Simon tries to introduce more complex notions like here,

the floor, ceiling and round functions while solving a simple arithmetic word problem:

DSC_0450

DSC_0452

and lexicographic order, while sequencing Dutch story sentences:

DSC_0457

On Social Development

Last night Simon had this social experience like never before: for the first time in his life, he followed a long (nearly 3 hrs) live programming session and actively participated in the live chat, alongside hundreds of other programmers (most of them university students or professionals). Maybe I should add that the tutorial was about algorithms for neural networks and a lot of it was calculus-related. As the session progressed I watched Simon dance in excitement. Although it was pretty late and he hadn’t completed all the bedtime rituals (like daily piano practice and bath) I let him stay online while I went to the children’s bedroom to read to his little sister and we continuously heard his euphoric yells from the living room. Then, after the session ended, he rushed to me, his whole face glowing with happiness. He suggested something in the chat and Daniel Shiffman (the brilliant assistant professor from NYU whose courses Simon follows on a daily basis and who also gave that live session) mentioned his name and said it was a great suggestion! I started a warm shower for Simon and heard him enthusiastically reflect upon everything that had just happened while he was showering. He was talking to himself out loud in English.

I think Simon is going to follow all the weekly live sessions from now on.

This has made me think that it’s probably time to realize that to Simon, the social opportunities that the technological age offers are much more real than they may seem to an outside observer. And maybe we, his parents, should stop worrying about not being able to find mentors and peers who can match his interest and depth in our geographical area. Being Simon’s mom I begin to realize like never before that there’s a whole world out there.

Slack Chat Neural Networks 2 Jun 2017 2

Slack Chat Neural Networks 2 Jun 2017

2048

We had a great Sunday visiting friends in The Netherlands whose kids resemble Simon in many ways. Simon made his signature bubble solution:

and learned about ray tracing in Java:

After I asked him that evening, what he loved most from the past weekend (that also involved sleeping over at grandparents’ house in Friesland), he said: trying to write code for 2048! I was surprised to hear that as I saw him do several projects in the course of the weekend but no “2048”. What is 2048? It turned out that, after he got tired of playing and snuggled with his laptop in the living room at our friends’ home, Simon tried to write his own code for a game he had played almost two years ago, involving the powers of 2. “It just got into my head!” he explained in the car on the way back. The video below is how far Simon got coding the game: