Coding

# Color Mixing Program in C#. Simon’s own code.

Simon’s own code, a color mixing program in C# that he wrote in Xamarin. Simon also explains why he chose C# for this project and not Processing:

# Back to Python (and C#)!

Simon was preoccupied with vector functions for most of the day on Saturday, compiling what, at first site, looked like a monstrously excessive code in Processing (he recycled some of it from the Processing forum, wrote some it himself and translated the rest from Codea). Originally, he was gong to use the code to expand the 3D vector animation he made into a roller-coaster project he saw on Codea and wanted to create in Processing, but got stuck with the colors. What happened next was fascinating. In the evening I all of a sudden saw Simon write in a new online editor Repl.it – he was translating the vector code into… Python! He hadn’t used Python for quite a while. I don’t know what triggered it, maybe Daniel Shiffman noting last night during the live stream session that “normal people use Python for machine learning”. Simon also said he had sone some reading about Python at Python for Beginners and Tree House!

He isn’t done with his project in Python yet, but here is the link to it online: https://repl.it/JAeQ/13

Here Simon explains what he is writing in Python:

Simon did the 2D, 3D and 4D classes but eventually got stuck with the matrix class in Python. He then opened his old Xamarin IDE and wrote the 2D, the 3D and the 4D classes in C#. In the video below he briefly shows his C# sketch and talks about Cross Product in general:

And this is a video he recorded about vector functions (in Processing, Java) the day before:

# Cellular Automata in Arduino

Yesterday Simon spent the whole day studying the concept of Cellular Automaton (CA), a discrete model of a system of “cell” objects used in physics, math and theoretical biology. He learned a lot from Daniel Shiffman’s tutorials on Cellular Automata and his book The Nature of Code (Chapter 7).

Simon describes Cellular Automaton as a set of rules for getting nature-like patterns. 1D cellular automata are static (think of a pattern resembling the Pascal triangle) and 2D are not static (the most famous example is Conway’s Game of Life).

The mathematician who made cellular automata a big thing (and even Turing-compatible!) was Stephen Wolfram. Simon also looked at some of Wolfram’s writings. Wolfram’s book A New Kind of Science is intimidating (in content and size) but full of graphic illustrations and available for free at http://www.wolframscience.com/nksonline/toc.html

A CA is basically a grid where cells live, each cell in a particular state (the simplest example being “1” or “0”). In Processing, it’s possible to have a CA draw a beautiful pattern this way. Simon tried to write a CA program in another language. He tried writing it in Python on his RaspberryPi first, but I overheard him say “don’t know how classes really work in Python, let’s try Ruby – I know how classes work in Ruby!” Then I saw him move over to the desktop and plug his long forgotten Arduino in. He said he now wanted to translate a CA code into C. Of course, there would be no pattern, but he wanted to have the Arduino “spit out numbers in the console” instead. Eventually he got an error and gave up, but it was intriguing to observe him.

The videos below show Simon talk about CA and program a CA in Arduino (C):

# C# in VisualStudio

Simon downloaded VisialStudio, one of the ide’s in which you can write in C# on a pc, and has played with it writing a programme for a calculator in C#.

# Calculator in C#

Simon has been into learning about C# the last couple of days. Yesterday he built a calculator. He didn’t actually compose the code himself as one might think after watching the video but recalled it from memory – he has seen many C# tutorials. It is very nice to see how well he has mastered it in such a short time though!

And in this video Simon explains the notion of maximum value of a decimal in C#:

# Whiteboard!

Simon loves the new whiteboard. Below are a table of C languages he made up and a functions object to draw an ellipse:

# Learning Process

So how does Simon teach himself to program? He starts by copying open source codes from, for example, the Arduino manual. The code is available in short excerpts. While copying each of them Simon tries to explain what it consists of and what it does. In this video (filmed on September 24) you can see how that happens:

And this is a later stage of the same code. Simon is learning about/explaining the use of the “while” loop and hooking the code up with your gsm:

# Hours of Coding

This is just a part of the list of Arduino sketches Simon has written between 10 if August and now (in just three weeks).

He meticulously copies difficult codes, creates his own (that sometimes work and sometimes don’t and then we either look at the possible flaws together or move on) and listens to hours of Arduino tutorials in English with a funny Italian accent:

He also tries to write Code in Processing: