A grid-based cellular automata runtime with live C compilation.
bxl displays a grid of cells and runs user-defined automata logic on them every tick. The automata code is written in C and compiled at runtime using TCC via the ak24 CJIT module.
The main window shows the cell grid. An optional side panel provides control buttons, and a bottom panel displays up to 3 custom buttons defined by the automata code.
Features:
- Click cells to interact with your automata
- Keyboard input forwarded to automata code
- Custom buttons defined in C
- Multi-threaded cell processing
- Symbols and colors per cell
| Dependency | Purpose | Required |
|---|---|---|
| ak24 | Core library (threads, CJIT, logging, etc.) | Yes |
| SDL2 | Window/rendering | Yes |
| TCC | Runtime C compilation | Yes (for CJIT) |
git clone https://github.com/bosley/ak24
cd ak24
cmake -B build
cmake --build build
sudo cmake --install buildmacOS:
brew install tccLinux:
# Debian/Ubuntu
sudo apt install tcc libtcc-dev
# Arch
sudo pacman -S tcccmake -B build
cmake --build build# Run with a project
./build/cmd/bxl/bxl --project examples/game_of_life.bxlproj
# Custom window size and thread count
./build/cmd/bxl/bxl --project examples/game_of_life.bxlproj --width 1024 --height 768 --threads 8
# Run without a project (default behavior, no automata)
./build/cmd/bxl/bxl
# Show all options
./build/cmd/bxl/bxl --help| Option | Description | Default |
|---|---|---|
--project <path> |
Load a .bxlproj manifest | None |
--width <pixels> |
Window width | 640 |
--height <pixels> |
Window height | 480 |
--threads <count> |
Number of processing threads | 2 |
--help |
Show usage information | - |
Grid dimensions are auto-scaled based on window size (16 pixels per cell).
Settings can also be specified in the .bxlproj file—CLI arguments override project settings.
A .bxlproj file defines C source files to compile at runtime. See examples/ABOUT.md for the project format and API reference.
Example project: examples/game_of_life.bxlproj
┌─────────────────────────────────────────────────┐
│ bxl │
├─────────────────────────────────────────────────┤
│ main.c - Application setup, event loop │
│ process.c - Thread pool, CJIT loading │
│ project.c - .bxlproj manifest parser │
│ actions.c - Mouse click handling │
│ inputs.c - Keyboard input handling │
├─────────────────────────────────────────────────┤
│ pkg/grid - Cell grid data structure │
│ pkg/screen - SDL2 window management │
├─────────────────────────────────────────────────┤
│ ak24 - Threads, CJIT, logging, etc. │
└─────────────────────────────────────────────────┘
- bxl loads a
.bxlprojmanifest - Source files are compiled in-memory using TCC
- bxl looks up entry point functions (
bxl_automata, optionallybxl_get_buttons,bxl_on_key) - Every tick,
bxl_automatais called for each cell with neighbor state - The returned output determines the cell's next state, color, and symbol
No restart required to change automata logic—just edit, save, and relaunch.