NYU Researchers Evolve Readable Python Rules That Build Playable Game Levels
A new research paper reframes cellular automata as evolvable Python modules, letting genetic programming discover readable rules for level generation.
- Khalifa et al. introduce Programmable Cellular Automata, representing CA rules as evolvable Python modules.
- Rules split into local, global, and decision functions, all readable source code.
- Genetic programming drives search; an LLM is used only for mutation to write novel candidate functions.
- One global function raised Zelda playability from ~0% to ~100% versus local-only rules.
- Sokoban iterations dropped from ~98 to 7-24 once global observations were allowed.
- Evolved global functions were dominated by counting, connectivity, and distribution helpers.
Programmable cellular automata turn evolved rules into readable Python
Cellular automata update a grid by applying the same rule to every cell, usually in synchronized steps. Simple rules can produce complex behavior, but designing useful ones becomes difficult as the number of cell states and neighborhood size grow. In a new preprint, researchers from NYU and the University of the Witwatersrand, led by Ahmed Khalifa, introduce Programmable Cellular Automata (PCA), a framework that evolves modular Python rules and tests them on procedural game-level generation.
Why richer rules become opaque
In a lookup-table cellular automaton, every possible neighborhood configuration maps to a cell’s next state. For a neighborhood containing n cells with s possible states, the table may need to cover sn configurations. Larger neighborhoods and richer state spaces therefore make explicit tables unwieldy.
Neural cellular automata replace the table with a learned network, gaining expressive capacity while making the resulting behavior harder to inspect. PCA preserves an evolutionary search process while expressing each discovered rule as source code that a researcher can read, test, and modify.
A rule set assembled from programs
PCA divides each cellular automaton rule into three kinds of Python functions:
| Function | Input | Role |
|---|---|---|
| Local | A neighborhood window | Extracts information near the cell being updated |
| Global | The complete grid | Computes optional board-wide information such as counts or connectivity |
| Decision | Outputs from the other functions |
This story is for Pro members
You've reached the end of the free preview. Upgrade to AlphaSignal Pro to read the full article - and everything else behind the paywall.