chemistry, Coding, Electricity, JavaScript, Notes on everyday life, Simon makes gamez, Simon's Own Code

Test Tube Games

Simon has had hours of fun with Test Tube Games, a science games portal featuring interactive explanations and dynamic puzzles on Chemistry and Physics. He has created two simulations based on the games he played. The first one is an electromagnetic field simulator:

This project was inspired by the game/explanation “The Electric Shocktopus” on


Press “1” for positive charge, “2” for negative charge, “R” to run. Press “3” and “4” to create magnetic fields/ press “0” to erase them. Press Shift+1 and Shift+2 for “lazy particles”.

Simon’s other TestTubeGames-inspired project is called “Floating Astronaut”:

This project was inspired by the game/explanation “Why Do Astronauts Float?


Haven’t figured out a way to put the astronaut inside the rocket yet though.

One more science game is definitely a hit at our home, “Bond Breaker” (on chemical bonds). At a certain point, it gets so hard you start feeling like a secret agent on a mission.

Simon playing “Bond Breaker”
Coding, Java, Physics, Simon's Own Code

Back to Attractor with ToxicLibs

Simon returned to his old Attractor sketch in Processing once again, now adding some new functions:

The code original came from Daniel Shiffman’s book The Nature of Code, Chapter 5 (Physics Libraries) and from the ToxicLibs library, but Simon has customized it quite a bit.

Coding, Crafty, Java, Milestones, Physics, Simon's Own Code

Cloud Simulation. Simon’s Own Code.

In for a shower? Simon made a beautiful Cloud Simulation in Processing (Java). He wrote this code himself. This is the final version of the project:

The whole project is on GitHub, you can download it at:

The videos below show Simon creating the cloud simulation step by step:







Coding, Geometry Joys, Java, JavaScript, Milestones, Murderous Maths, Physics, Simon makes gamez

Translating Car On Terrain project from into Processing

Today Simon spent hours translating this Car On Terrain project from (where it appears in JavaScript) into Processing (Java). He loved doing it in a form of a lesson for me, while I was filming him and asking questions about loops, arrays, fixtures, shapes and bodies (and there are many things I don’t understand). Simon also spoke about “the three most important properties: density, friction and restitution”. The project involved a lot of Physics, using many Box2D sub-libraries and translating between pixels and mm.

In the end, he got tired of writing all the coordinates for the terrain vertices, but he did get quite far.






Applying Box2D to translate from pixels into mm:

CarOnTerrain translating from pixels into mm

Coding, Java, Murderous Maths, Physics, Simon's Own Code

Path Following (Simon’s own code). Applying restitution.

On Thursday Simon was busy with writing his own code in Java. He called it “Path Following”. The project basically involved simulating different phenomena with a physics particle (having it follow a path, fall and bounce).

The most interesting part of this challenge Simon invented for himself was applying restitution to make the particle bounce in a realistic way (Simon failed several times but eventually succeeded). “If a bound hits the physics particle I’m going to multiply the physics particle’s velocity by -0.8 (0.8 is the arbitrary restitution, so I multiply the velocity by the negative restitution)”, Simon explained.

He also planned to incorporate collision detection in this project but didn’t succeed.

Here the particle is drawing a graph (“noise without a noise function”):

Here Simon adds one more particle and is trying to create collision detection and make the particles restitute:

Debugging and using inheritance for the second particle:

Making the particle remember the graph:

Applying gravity to the physics particle:

Trying to make the physics particle bounce (apply restitution). In this video Simon doesn’t succeed.

Simon manages to control the particle’s bounce (with the mouse) but there’s still no restitution:

In the following video Simon finally won: he figured out how to apply restitution to the bouncing particle making it look like a bouncing ball. After a few bounces however, the particle collapsed (Simon solved the collapsing problem later on: in his code, the < and > should be <= and >=).

In a steering behavior variation, trying to teach a particle to follow a given path (road). Simon hoped to apply a genetic algorithm here but got stuck:

Coding, Geometry Joys, Murderous Maths, Physics

2D and 3D Cloth with ToxicLibs

Simon built this awesome animation that looks and moves like a hammock on Sunday, a coding challenge on Daniel Shiffman’s channel. In this challenge Simon used the toxiclibs physics library to create a 3D cloth in Processing (Java). Creating a 2D cloth involved programming particles and springs, looping them to one single row and later looping them to form a grid.





After the 2D cloth was ready, Simon turned it into a 3D cloth by adding the z-axis.








Coding, Geometry Joys, JavaScript, Milestones, Physics

Matter.js (Physics Library)

Simon got seriously hooked on Matter.js, a a 2D JavaScript physics library that supports rigid body collisions and constraints.

He started with Daniel Shiffman intro to Matter.js, downloaded it using GitBash and then went on by following further Matter.js tutorials on Daniel Shiffman’s channel. Simon built two physics simulations with static shapes and circular bodies: one resembling a waterfall and another resembling a dangling chain. The sketches involved constraints for mouse interaction. Simon also learned how to delete off-screen bodies from the physics world, removing them from both his particle array as well as