AIThis post was created with the assistance of artificial intelligence (AI).

TL;DR

A programmer has built a chess engine that uses 84,688 regular expressions to play a 2-ply minimax game. This showcases a novel, if impractical, method of encoding game logic through regex sequences. The project raises questions about computational creativity and the boundaries of programming techniques.

A developer has constructed a chess engine that plays using a sequence of 84,688 regular expressions, marking an unusual intersection of regex and game AI. This development highlights a novel, if highly impractical, approach to programming a game engine, drawing attention for its creativity and technical audacity.

The project, shared on Hacker News, involves a list of 84,688 regular expressions that, when executed in order, interpret and modify a chess board state represented as a string. The developer claims this sequence can perform a 2-ply minimax search, effectively making chess moves based solely on regex transformations.

The code is minimalistic in appearance but complex in scope, with the regex list functioning as a makeshift CPU that manipulates the game state. The developer emphasizes that despite the unconventional method, the regex sequences are valid and do perform the intended move calculations.

Why It Matters

This project challenges traditional notions of programming and AI development, illustrating that even simple tools like regular expressions can be repurposed for complex tasks. It raises questions about the limits of code expressiveness and the potential for esoteric programming techniques in game development or computational theory.

While not practical for production or performance-critical applications, the project demonstrates a form of computational creativity and serves as a thought experiment on the boundaries of programming languages and AI logic.

Mastering Regular Expressions

Mastering Regular Expressions

  • Condition: 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 typically used for pattern matching and text processing, not for game logic or AI. This project, shared during the holiday break, builds on previous experiments with unconventional computers and esoteric programming. The developer has previously built computational models using physical computers and code, but this is their first attempt at using regex sequences to simulate a game engine.

The idea of using regex for game logic is not new in theory, but this implementation is notable for its scale—84,688 expressions—and its claim to perform a minimax search, a standard AI technique for two-player games.

“Expressions is possible, and also what the specific regular expressions do.”

— the developer

“This is a fascinating demonstration of how far you can push the boundaries of a programming language.”

— a Hacker News commenter

iCore Electronic Chess Set - Develop Thinking Chess Set for Kids, Memory Electronic Chess Board - Talking Coach 30 Skill Levels Beginners & Adults

iCore Electronic Chess Set – Develop Thinking Chess Set for Kids, Memory Electronic Chess Board – Talking Coach 30 Skill Levels Beginners & Adults

  • Electronic Chess Set: Multiple game modes for all skill levels
  • Chess Education for Kids: Teaches basic chess skills to children
  • Electronic Chess Board: Sensor-equipped digital chessboard with AI

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What Remains Unclear

It is not yet clear how effective or efficient the regex-based engine is at playing chess, or whether it can handle more complex positions beyond the initial 2-ply minimax approach. The actual performance and accuracy of the engine remain untested beyond the theoretical demonstration.

Strange Code: Esoteric Languages That Make Programming Fun Again

Strange Code: Esoteric Languages That Make Programming Fun Again

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

What’s Next

The next steps include testing the engine’s actual gameplay performance, exploring whether the approach can be extended beyond 2-ply minimax, and investigating potential optimizations or applications of regex-based computation in other domains.

Further analysis may also evaluate the practicality and limitations of this approach, and whether similar techniques can be applied to more complex games or AI problems.

C++ Game Development from the Ground Up: Learn Modern C++ and 2D Game Programming Step by Step by Building Five Complete Games with raylib

C++ Game Development from the Ground Up: Learn Modern C++ and 2D Game Programming Step by Step by Building Five Complete Games with raylib

As an affiliate, we earn on qualifying purchases.

As an affiliate, we earn on qualifying purchases.

Key Questions

How does the regex-based chess engine work?

The engine uses a sequence of 84,688 regular expressions that, when executed in order, modify a string representing the chessboard, effectively calculating moves based on pattern matching and string replacement.

Is this approach practical for playing chess?

No. While it demonstrates a creative proof of concept, the method is highly inefficient and not suitable for real gameplay or performance-critical applications.

Can this technique be extended to more complex chess positions?

It is uncertain. The current implementation handles only a simplified 2-ply minimax, and scaling beyond that would likely be impractical due to the exponential growth in regex sequences.

Why is this considered significant or interesting?

It challenges traditional programming paradigms, illustrating that even esoteric tools like regex can be repurposed for complex tasks, and raises questions about the boundaries of computational creativity.

Source: Hacker News

You May Also Like

Measuring AI’s Economic Impact: GDP and Productivity

Understanding AI’s economic impact involves examining productivity and GDP growth, but the full picture remains complex and requires deeper exploration.

Different Game, or Already Lost? Reading Mistral’s Sovereignty Bet

Explore whether Mistral is playing a strategic sovereignty game or falling behind in AI. Discover what sets it apart in Europe’s enterprise AI landscape.

Signal: SAP’s €1 Billion Bet Is On Tables, Not Chatbots — And It Just Closed

SAP has finalized its €1 billion purchase of Prior Labs, a Freiburg-based leader in tabular foundation models, emphasizing enterprise data over chatbots.

Google Books (Or Similar) All Book Scans – $200K Bounty (2025)

Google announces a $200,000 bounty in 2025 for vulnerabilities in its book scanning systems, aiming to improve security and transparency.