Project 2024
Cell Growth Simulator
React · TypeScript
A simulation of bacterial cell division on a petri dish, drawn as a grid. Every tick, each occupied cell divides into an empty space next to it. The original is a React and TypeScript app, and the same rules run in the demo below.
- Role
- Sole author
Try it
Generation 01 of 400 cells occupied
Click a cell to add or remove bacteria. With the grid in focus, press Space to start or pause, R to reset, the arrow keys to move and Enter to toggle a cell.
The problem
The brief was a grid where each occupied cell divides into a neighbouring space on a timer, with controls to start, pause and reset, a way to change the speed, and cells you can click to add or remove bacteria.
The interesting questions were small ones. Which direction does a cell divide in? What happens when two cells want the same space? How do you pause a clock that every cell depends on?
What I built
- Growth rules that check up, down, left and right, in that order, and divide into the first empty space.
- Each tick reads the old grid and writes a new one, so two cells can never fight over a space and the result does not depend on timing.
- One interval timer drives the whole grid. Changing the speed swaps the interval, and pausing clears it.
- Start, pause and reset buttons, a speed multiplier, a grid size setting, and click to add or remove bacteria.
- Keyboard controls: spacebar to start or pause, and R to reset.
Stack
- App