TL;DR
A programmer has built a chess engine that plays a 2-ply minimax game using a sequence of 84,688 regular expressions. The project showcases an unconventional method of programming game logic with regex. The development raises questions about the efficiency and practicality of such approaches.
A developer has built a chess engine that operates entirely through a sequence of 84,688 regular expressions, effectively playing a 2-ply minimax game. This demonstrates an unconventional method of programming game logic using regex, highlighting both novelty and technical curiosity.
The project was shared publicly on GitHub by an individual programmer experimenting with regex as a computational tool. The engine interprets a chessboard state as a string and applies a long list of regular expressions to simulate moves. You can see a similar chess puzzle I found in my dad’s old book for understanding different chess positions. It is capable of playing a valid, though not highly optimized, game of chess by executing these expressions sequentially. The core idea involves encoding chess instructions and game state transformations within regex patterns, effectively creating a custom, regex-based CPU. The entire process is designed as a proof of concept rather than a practical chess engine, but it demonstrates the flexibility of regex in simulating computational processes.
Why It Matters
This development is notable because it pushes the boundaries of what can be achieved with regular expressions, a tool traditionally used for pattern matching rather than computation. It raises questions about the limits of regex-based programming, the potential for unconventional computing models, and the creative exploration of code as a form of computational art. For the broader programming community, it exemplifies how familiar tools can be repurposed in unexpected ways, potentially inspiring novel approaches to problem-solving or educational demonstrations.

Mastering Regular Expressions
Used Book in Good Condition
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Background
Regular expressions are widely used for string matching, data validation, and text processing. Using them as a basis for a chess engine is highly unconventional. Prior projects have explored esoteric computing models, but this is a rare example of applying regex at such a scale for a complex task like chess. The project was shared during the holiday season, reflecting a personal experimentation rather than a commercial or research-driven development. The approach involves encoding game rules, move generation, and evaluation within regex patterns, which are then executed in sequence to simulate gameplay. For more insights, check out this chess puzzle I found in my dad’s old book.
“Expressions is possible, and also what the specific regular expressions do.”
— the developer
“This is a fascinating demonstration of regex as a computational tool, even if not practical.”
— a programming enthusiast

MASTERING REGEX WITH PYTHON: Search, Match, and Manipulate Text
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What Remains Unclear
It remains unclear how efficient or scalable this regex-based engine is for longer or more complex games. The practical applications are limited, and the implementation is primarily a demonstration of concept rather than a competitive chess engine. The full extent of the computational limits of this approach has not been tested or documented. You might find this chess puzzle I found in my dad’s old book interesting for exploring different chess strategies.
chess engine development kit
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
What’s Next
Further experimentation may explore optimizing the regex sequences, expanding the engine to deeper plies, or applying similar techniques to other games. The developer might also analyze the computational complexity and potential for practical use, though current indications suggest this is mainly a creative exploration rather than a practical tool.

Wooden Educational Jigsaw Puzzles for Preschool Kids Ages 3-5, 4-Pack with 20 Pieces Dinosaur, Space, Transportation Wood Puzzles Set, Toddler Brain Teaser Toys, Gifts for Boys Girls Ages 3 4 5 6
Fun & Educational Puzzle Set: Spark curiosity and creativity with our Wooden Jigsaw Puzzle Set, featuring 4 exciting…
As an affiliate, we earn on qualifying purchases.
As an affiliate, we earn on qualifying purchases.
Key Questions
How does regex-based chess work?
The engine encodes the game state and rules as a sequence of regular expressions. Applying these expressions sequentially updates the game state, effectively simulating move generation and evaluation within regex patterns.
Is this approach practical for real chess engines?
No. The method is primarily a proof of concept demonstrating the flexibility of regex rather than a practical solution. It is computationally inefficient compared to traditional chess engines.
What inspired this project?
The developer was motivated by a desire to experiment with regex as a computational medium and to explore its limits in a playful, purpose-free project. For a related exploration, see this chess puzzle I found in my dad’s old book.
Could this method be extended to other games?
In theory, yes. The concept involves encoding game rules within regex patterns, which could be adapted to other turn-based or rule-based games, though practical limitations exist.
Source: Hacker News