Coding

Here you can see some of my programming projects. Click on any one of them to expand. The languages I know are, in order of descending familiarity: C, C++, MATLAB, Processing (including Wiring, Arduino, etc), Python, CUDA C. In addition to working on these projects, I have also solved some problems on Codeforces, Project Euler, Google Code Jam, and Topcoder. Occasionally, I manage to solve a hard problem, which makes me happy.

Rock Paper Scissors

I programmed several bots to play Rock Paper Scissors. While it cannot gain an advantage against a random player, it uses prediction algorithms to defeat deterministic opponents (even humans are not completely random). In an online contest, my bots enjoy a win ratio of almost 80% and are ranked at or near the top (the top 20 bots are roughly equal in strength so the rating list is unstable). Explanation of algorithms and rating list »

Swinging Atwood's Machine

The swinging Atwood's machine is a second order system exhibiting chaotic behaviour, quasiperiodicity, and some other cool things. I implemented a simulator in Processing for my Classical Mechanics class. Using this, I have generated a video of the trajectories for different mass ratios. I have also contributed significantly to the Wikipedia article for the swinging Atwood's machine. Processing applet »

Maze generator

A maze generator that uses either backtracking or a modified version of randomized Prim's algorithm to generate mazes. I generated two videos illustrating maze generation which I contributed to Wikipedia. This is the second time I created a maze generator - my first maze generator, which I made in 2009, generates rather different mazes using a different algorithm. C++ source code »

BML Traffic Model

The Biham-Middleton-Levine traffic model is a simple 2D cellular automaton. The red cars and blue cars take turns to move downwards and leftwards respectively. Every time, all the cars of the same colour try to move one step if there is no car in front of it. Using my own C++ and MATLAB programs, I have generated much content for Wikipedia (I also wrote the article). C++ source code and Processing applet »

Metaballs

A program to draw red and blue metaballs as well as draw lines. The red and blue metaballs are complementary and cancel each other out. The graphical user interface uses FLTK. Screenshot and C++ source code (zip) »