Wire flash
TechDeveloper ports Doom to run on regex at 180 seconds per frame
Editorial responsibility
- No named human review is recorded for this page.
- Source reporting is collected, normalized, translated or condensed automatically when needed.
- Automatically published source-backed update
Developer Artem Lytkin has successfully ported the classic 1992 game Doom to run using only regular expressions (regex), a text-matching utility language. The project uses a 96 MB plain-text string containing virtual CPU registers, RAM, video framebuffer, game data, and I/O components. The regex engine performs text substitutions to simulate processor operations, achieving approximately 80,000 substitutions per second. Each frame requires nearly 14 million substitutions, resulting in a frame time of about 180 seconds. Despite the extreme slowness, the output is reportedly byte-identical to the original game. Lytkin implemented memory access via a binary tree structure to avoid scanning the entire 96 MB string. The project is available on GitHub, and the developer describes playing it as 'closer to correspondence chess with a shotgun than to a twitch shooter.'
Source report
Running the 1992 classic Doom on the most unexpected hardware has become a popular unofficial programming challenge. We've seen the game running on everything from toasters to Anker chargers, and even a pregnancy test. Now, enterprising coder Artem Lytkin has taken it a step further by getting Doom to run in regular expressions (regex).
What Makes This So Unusual?
Developers may recoil in horror at that sentence — and for good reason. Regular expressions are a utility language used for finding and replacing text. While incredibly powerful, their syntax is often described as "write-only," resembling gibberish to the untrained eye.
For example, the regex /.*(\d{4}).*/g would find "2026" in the string "Tom's Hardware 2026 articles." Regex can become exceedingly complex, incorporating conditional statements, character-jumping, and substitution rules. However, this complexity also means regex fulfills all the technical requirements to be considered a programming language.
How It Works
Lytkin leveraged these capabilities to create a 96 MB plain-text string containing:
- Sections for the virtual CPU's registers
- RAM
- A video output (framebuffer)
- The game's WAD data
- I/O and other components
Once initiated, the regex engine begins text-matching and substituting characters within the string. This simulates the numbers in each processor's register, accesses and writes to "memory," and so on.
Performance: Spectacularly Slow
As you might expect, this approach is extremely slow. Lytkin reports that it takes approximately 180 seconds to produce a single frame of game output. Each frame requires nearly 14 million substitutions.
Despite the sluggish pace, two key points stand out:
- (a) It actually works.
- (b) Lytkin claims the output is byte-identical to actual Doom output.
You can even control the game with keyboard keys, though as Lytkin poignantly describes, playing it "is closer to correspondence chess with a shotgun than to a twitch shooter."
Technical Details for Developers
For particularly nerdy developers, Lytkin implemented the memory access portion as a binary tree. It jumps from "branch" to branch using standard regex character-jump instructions, avoiding the need to scan the entire 96 MB of text repeatedly just to find the "#M" marker bookending it.
Lytkin notes that the challenge was not about whether it could be done, but whether the game would run "before the heat death of the universe." The engine fires up 80,000 text substitutions per second.
Where to Find It
- The doom-regex repository is available here.
- You can download a demo to run it on your own computer.
- The project's website demonstrates how the regex machine runs in both visual and text format — mesmerizing to watch, reminiscent of watching defragging utilities in action.
Follow Tom's Hardware on Google News or add us as a preferred source to get our latest news, analysis, and reviews in your feeds.
Source
Latest from Tom's HardwareNeutral / independent
Part of this Story
Coder Runs Doom Using Regular Expressions at 180 Seconds Per Frame