Some random programs I wrote (Part I)

March 6, 2019

In late April 2018, I officially went onboard 42 as a ‘cadet‘ and have since ‘climbed the ranks’ all the way to ‘captain‘ by completing various programming projects in the ‘galaxy‘. It has been a uniquely addictive process. I decided to write a post to outline some of the projects as well as sharing my plans on what’s next. Please also feel free to visit my Github for the source code and more detailed descriptions of the projects.

The galaxy

Below are a few of my personal favorites, ordered roughly chronologically.

Note: many of below are team projects done in pairs or triples, I’ll credit my awesome friends and teammate Liam Dehaudt and Charlie Gleason here =)


This was one of the first projects in the curriculum. The goal is to render various fractals in \mathbb{C} in real-time by taking mouse position as parameter. Parallel threads are used to speed up the rendering.

After completing the basic ‘stage set-up’ and the required Mandelbrot and z^2 + c. I had lots of fun coming up with color schemes and implementing rational function Julia sets such as those with locally connected Julia set homeomorphic to the Sierpinski carpet:

As well as those that has a hyperbolic symmetry similar to that of the Poincare disk:


This is an optimal transportation puzzle where one needs to find the minimal number of steps to transport a fixed amount of ants from one point to another through a graph. I had fun designing a retro-style ascii visualizer on top of the algorithm =)

We re-formulated the problem into a max-flow problem on a derived directed graph (we double all vertices and edges and form a larger graph) to apply the Ford–Fulkerson theorem. Project the resulting parallel paths to the original network and resolve overlaps. Then we queue the ants in the resulting set of disjoint paths depending on the length of each path. The result guarantees optimum solution as long as the number of ants is greater than the sum of lengths of paths from Ford–Fulkerson.

A simple example where the flow solution would result in overlapping paths and resolving overlap was required and the queuing can be seen observed


We made a reproduction of the Core War game. Including full implementation of assembly compiler, virtual machine and GUI.

Virtual Machine in action (4 worrier mode)

Core War is a 1984 programming game created by D. G. Jones and A. K. Dewdney, inspired by a malicious virus written in the 80’s. To deal with the self-replicating virus, a white hat hacker invented Reaper. It was a virus designed to spread and eliminate the malware.

The idea was simple. You compete by designing viruses to overtake a computer. You win by protecting your own program and overwriting your opponent’s programs. This is all happening on a virtual machine.

Particle System

An openCL and openGL simulation of movement of millions of particles in space in various gravitational modes. Used GPU for parallel computing.

Change gravity strength

Note: Due to the GPU restrictions, this project records with significant quality and performance loss, highly recommend trying it out!

…More to come in Part II…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: