Why "visually intuitive"?

Most of us are familiar with the basic ideas of genetics. We know that genetic principles, to a large extent, can determine physical characteristics of cells and organisms, and even govern patterns of behavior and interactivity. Genetic simulations armed with this knowledge have become ubiquitous in today's computing age, but they are generally laden with complicated numbers, terms, and abbreviations.

ChromoSim is an attempt to make these genetic processes visual, colorful, and perhaps even aesthetic.

What does it do?

ChromoSim is built on the core principles of mutation and competition, in such a way that the physical character (phenotype) of each cell can be represented natively by color, in 24-bit RGB space. Cells on a grid are programmed to multiply, mutate, die, and attack one other, according to probabilistic models. Mutations are handled by alterations of a relatively simple genetic code, which approximates the process of genetic mutation in real organisms, like humans. With this simple set of rules, complex patterns of growth, destruction, competition, niches, and predatory behavior can be observed -- all by looking at a vibrant dance of colors across a screen.

What does it really do?

ChromoSim was built in 36 hours. It is by no means an adequate representation of actual genetic processes. It fails to capture the depth, complexity, and molecular intricacies of real biology. (The human genome is more than 3 billion base pairs long -- ChromoSim uses a genome of length 12.) Yet, even with such a simple set of rules, we can still observe behaviors and dynamics that we would expect of genetically active populations. It's also pretty to watch.

I believe that the most powerful application of ChromoSim lies in education. As a student studying molecular biology, I have often felt consumed by details of metabolic and biochemical theory. Simulations like ChromoSim allow students to learn by toying with and perturbing systems, thereby actively engaging in the learning process. The ultimate goal for ChromoSim is to deploy it as an educational tool in secondary and post-secondary education in understanding the fundamentals of genetic processes.


It was not an easy task to develop a novel genetic code that (1) is based on real molecular biology, (2) natively encodes color information, (3) admits mutations with realistic phenotypic effects, and (4) is still simple and intuitive. Additionally, the invasion and competition system proved to be quite difficult to balance so that populations would remain dynamic over time. A GUI allowing the user to control simulation parameters, pause, and save/load simulation states was planned, but was unfortunately scrapped due to time constraints. A major constraint of the simulation (which will likely be addressed in a later iteration) is that its algorithms are entirely serial -- this is by design, in order to maximize interactions between cells -- however, the simulation runs a tad slow. And, as always, debugging was an irksome process.


I have worked extensively with MATLAB in my research, but this project is the first time I have developed a specification document for a MATLAB program and executed those specifications without a hitch, on my first try. The data visualizations presented alongside the main simulation are helpful, I feel, in conveying the nature of the interactions between populations. Also, with a little magic (i.e. killing cells with extreme color saturation), the colors depicted are vivid and quite pleasant.

I had a blast developing ChromoSim. It was a very fun and pedagogical experience, and the looming 8 AM deadline motivated high productivity. Free food and drink during development was greatly appreciated.

What's next?

I hope to continue developing ChromoSim, perhaps adding new functionalities and ways to visualize data, along with a GUI, the ability to save and load states, and an overhaul of the competition algorithm (which should significantly increase speed). In particular, I would like to add the features of dominant and recessive genes, viruses (which can "hijack" genetic code of host cells), and environmental factors, such as limited resources or toxic areas. In addition, I would like to make the interface more visually appealing, which may be aided by a departure from MATLAB for graphics.

In the meantime, you can watch with bated breath as your favorite colony of crimson cells is wiped out by a rogue bunch of chartreuse crusaders.

Built With

Share this project: