Trending
High cost of hepatitis care, stressed facilities expose 20m to liver damage is trending now Singapore Firm To Develop ‘Most Promising’ Ebola Vaccine is trending now US, Sierra Leone Launch Advanced Epidemiology Training Programme To Enhance Disease Surve… is trending now Satellite killers: What a war in space might look like is trending now Submersible stumbles upon prehistoric animal 365m deep in Pacific darkness is trending now Study shows prehistoric people targeted female mammoths is trending now Copernicus Sentinel-3C expected to launch in September, helping to monitor Earth is trending now 'Great sadness' - Tributes flow in for Franco Baresi as AC Milan confirm legendary defend… is trending now Maxence Lacroix joins Chelsea - Blues' defensive spending smashes €500m landmark is trending now Transfer news LIVE: Arsenal double deal close; Man Utd eye Igor Thiago is trending now On video: Morocco snatch a last-gasp win over Algeria at the Women's Africa Cup of Nations is trending now ‘I had complicated major surgery’ – Ayra Starr breaks silence over disappearance online is trending now High cost of hepatitis care, stressed facilities expose 20m to liver damage is trending now Singapore Firm To Develop ‘Most Promising’ Ebola Vaccine is trending now US, Sierra Leone Launch Advanced Epidemiology Training Programme To Enhance Disease Surve… is trending now Satellite killers: What a war in space might look like is trending now Submersible stumbles upon prehistoric animal 365m deep in Pacific darkness is trending now Study shows prehistoric people targeted female mammoths is trending now Copernicus Sentinel-3C expected to launch in September, helping to monitor Earth is trending now 'Great sadness' - Tributes flow in for Franco Baresi as AC Milan confirm legendary defend… is trending now Maxence Lacroix joins Chelsea - Blues' defensive spending smashes €500m landmark is trending now Transfer news LIVE: Arsenal double deal close; Man Utd eye Igor Thiago is trending now On video: Morocco snatch a last-gasp win over Algeria at the Women's Africa Cup of Nations is trending now ‘I had complicated major surgery’ – Ayra Starr breaks silence over disappearance online is trending now
Technology

DOOM Using Regular Expressions

DOOM Using Regular Expressions

Regular expressions (regexes) are an amazingly powerful way to perform operations on collections of e.g. text. Regexss can also be considered to be a programming language, even a Turing complete …read more

Regular expressions (regexes) are an amazingly powerful way to perform operations on collections of e.g. text. Regexss can also be considered to be a programming language, even a Turing complete one. Ergo it’s perfectly acceptable to thus design a way to use regexes to run and play a game of DOOM, as [Artem Lytkin] recently did.

The GitHub project page can be found here, containing the Python-based code that allows the demonstration to run, as well as the other components, including the C runtime and the 96.6 MB text string that defines a CPU’s registers, RAM, a framebuffer, the DOOM engine compiled to this custom CPU’s instruction set and the WAD file for the game itself.

The C-based driver applies the fixed, ordered list of find-and-replace rules to this string, which after more than ten-thousand of such substitutions later results in a single frame of the game. At about 80,000 substitutions per second on the given test system, that gets you to a sort-of playable framerate, even.

Naturally, the practical value of playing DOOM like this is pretty low, but as a demonstration of why regexes are awesome it’s hard to beat.

View original source →

Related

More from Hackaday Blog