The site uses cookies that you may not want. Continued use means acceptance. For more information see our privacy policy.

Review of EXAPUNKS

Ghast: I can confirm moss is alive.

EXAPUNKS by Zachtronics is a programming game. You play as Moss, an old hand forced to return to cybercrime to afford meds.

The game uses a limited assembly-style language with the ability to do read and write files, communicate with your other programs, navigate networks, and use special hardware registers, depending on the host.

The game provides you with a couple of zines that detail of some of the systems, and which serve as a manual for the language. They are in PDF form, either for printing or for reading on your computer.

Because you’re trespassing, you have to leave no trace in most levels. This means no files sitting around, no programs still running, no deleted files on foreign systems, and so on.

I’m not sure how the average non-programmer would take to this game. Some of the challenges are hard, even for someone like me who knows a bit of computer programming. I’d say that this is a game for programmers first. People who otherwise pick it up might need some help, but that’s okay. You can always learn.

But for a programmer, this is a fun game. Even for the easier levels, you can try to golf (solution with fewest lines of code), or you can try to use the least cycles. For the harder levels, I was happy to get a solution, even if I knew there were more optimal ways that eluded me. And on some of the hardest, I found myself with no choice but to golf to try to get the number of lines within the budget. (You can proceed if you have a working solution over the line budget, but I’m proud to say I was able to get every one under it, eventually.)

Sights and sounds.

As you load the game, a fast-paced techno beat plays, and as you go through the various levels and side games there are nice background loops keeping you company.

Cool music, nice GUI, a general 1990s cyber vibe complete with an IRC window where others talk about the goings on in the world while you lurk. It’s a nice interface that adds a lot of texture to the game. You’re not just doing programming challenges, you’re stepping into this game world and roleplaying as Moss.

The programming UI also has some nice features to it. You can move the coding panel around. Clicking on a file in the network will highlight it on the sidebar so you can see what it contains. The editor lets you select, copy, paste, and highlights a few errors, including jumps to labels that don’t exist.

You can also make copies of your solution to a level or start a new one without overwriting your previous work. That can be handy if you want to golf or you want to do some testing.

About the language and environment.

You have one general-purpose register, a test register (used for conditional jumps), a file register, and a messaging register (with two modes, one for global talk, the other for host-only talk). You can hold one file at a time.

It’s integers only (-9999–9999) and operations that would overflow simply stick at the maximum or minimum. You can add, subtract, multiply, divide, and take the modulus. You can also swiz. Swizzling is something I was unfamiliar with, but given you store four-digit numbers, swizzing is effectively the ability to address each digit:

copy 1776 x
swiz x 14 x    ; x= 61
addi x 200 x   ; x=261
swiz x 234 x   ; x=620

Note that zeros are implied in empty higher digits.

Swiz can let you do some interesting things, like packing four flags into one piece of data.

There are also strings that come into play, but you can never create strings, only copy them from files. Once copied, you can pass them around or test against them, but you can’t manipulate them.

The instructions and registers are limited but adequate. They make the challenge harder, but also make it more rewarding to figure out. (How many times did I want to have a jump-back type instruction, so I could have outright subroutines?!)

You can execute multiple programs (called exas) at once, either by writing separate code for them or by forking off from an existing one to a specific label. They can talk to each other, but only in a broadcast manner. If you want to have multiple conversations going at once, be prepared to write some complex code to manage it. (Mostly better to avoid this complexity!)

Sidegames.

You can make your own game, and you can also make your own programming levels (or play those from others). I made a simple game just to try it, where the screen would fill up one dot at a time, and you pressed the button to try to stop it at a peak. I only briefly looked at some of the levels of other players.

There’s a tetris-ish game called “Hack*Match” where you have to match four-or-more of a kind to clear them. This was fun for a bit, but it has a 100 000 points achievement associated with it. This took me many tries. My natural skill capped out where I could easily get around 40 000 without a sweat, and more if I pushed it or got luckier with the PRNG. I’d get the one-offs in the 70s, and then in the 90s, but 100K was elusive. (I don’t think I ever had a game end in the 80s, oddly.)

And there’s also a solitaire variant (you have to beat it 100 times for the achievement). It’s not that hard, it’s decently fun.

Achievements.

Aside from the five side-game achievements (two for Hack*Match and three for solitaire), there are a number of achievements requiring you to revisit the programming challenges with an eye to doing a different programming challenge in the same space. These weren’t too hard, but are fun little alternatives to do later in the game.


It took me about 100 hours to beat the whole game and get all 16 achievements. Without the solitaire and Hack*Match, I’d guess it was 85 hours. I really enjoyed the programming challenge, and I’d recommend you take a look if you’re decently familiar with coding and want to take on a challenge.

Note, if you’re on Linux you may have a problem running the game. I did. The fix is to add TERM=xterm %command% as the command-line so that it doesn’t try to use an incompatible version of terminfo. Github: Mono: Issue 6752 has some details.

Working on a Local Single Page Application.

If only my editor’s highlighter supported template literals.

I’ll surely post about it more detail as I get it fully built, but I thought I’d write about it as I’ve been working on it.

As I’ve written before (diehealthy.org: 19 September 2020: “How I Track Games to Buy”) about how I track games to buy, using bookmarks, it occurred to me that I’d like something a little more defined than using bookmark titles to store data. And when I say a little, I mean that. I don’t want a relational database (though there is one built in the browser, if I want to use it). I don’t want a server to configure.

I do want a simple web application, often called a SPASingle-Page Application (Wikipedia: “Single-page application”). But as I said, no server. That makes it an LSPA, or Local Single-Page Application. And single-page really means single file, as in one HTML document that contains all the markup, all the code, and all the styles in one package.

The secret of the modern browser is that it has a ton of functionality that it doesn’t get credit for. While (unfortunately) the behavior of localStorage in the file: schema is undefined, at present Firefox makes it a per-file access, so as long as you persist the filename and path, you get the storage back. To be a little more sure of things, you can export the JSON data as a file, and import it from a file.


I’ve used one-off HTML files for other projects before, including years and years ago for some of my Computer Science classes where choice-of-language was wide-open, but it’s been awhile. In general, the browser is a nice platform to write for, but it’s underdeveloped in terms of making these kind of one-file applications widespread. To be fair, there are concerns about users downloading random HTML files and opening up vulnerabilities, but the general shape of browser security seems to guard decently against it such that enabling more local, serverless, in-browser applications would be useful.

People use spreadsheets for all sorts of data storage and simple applications because it’s got all those tools. They could be doing basically the same thing with a browser. (That’s in fact what I am doing with a browser.) In some cases, the numerical prowess of a spreadsheet will make their task easier. In other cases, the web-awareness of the browser makes my task a lot easier.

One place where a spreadsheets take the one-file ideal slightly further: they store the data in the application. Fair enough.


I looked at various libraries to bootstrap building the editing side of things from a JSON schema. There are a bunch of them, but none seemed very easy to integrate or to do what I wanted with it. It took me less time to build the equivalent for my own purposes than I spent looking at and trying to understand the umpteen JSON-to-forms Javascript libraries. And for mine I don’t add dependencies like underscore.js or jQuery.

On the other hand, I’ve spent a bit of my times dusting my ability to write Javascript, wondering what’s canonical these days. There are proper classes with constructors now (but you don’t have to use them). There are things like Map()s that are better than plain objects in some ways, but aren’t as nice to use in other ways.

To save a file, you have to:

  1. Create an anchor (A).
  2. Create a Blob.
  3. Create an object URL for the Blob.
  4. Add the URL as the anchor’s href attribute.
  5. Add the desired filename as the anchor’s download attribute.
  6. Add the anchor to the document.
  7. Call click() on the anchor (the actual download occurs).
  8. Clean up.

Seems like a lot of extra work for a very usual thing. (A roughly similar process to load from a file, except using an input with type of "file" and some other specifics.)


Anyhow, the one feature I’m relying on an extension for that Bookmarks have out of the box is the ability to get the title and URL in a single action. Mozilla Addons: Hiroaki Nakamura: “Format Link” is an add-on I already use to do that for other cases. But it seems like it’s something browsers should support, given how much we all use the web. We still need computers that understand our most-used forms of data as logical objects, but until then there’s nice extensions to help us.

With that ability, the main pieces of data for tracking a game are available with a paste, which isn’t too much more than simply adding a bookmark. The rest of the data was already stuff I was filling in by hand, but it will soon be into my application rather than cramming it all in the bookmark’s title.

Anything else you’d want from a server-provided service can be built locally and only using Javascript. Given I don’t expect to have hundreds of thousands of games to track, I don’t even need to use a relational database. The browser can handle filtering, sorting, search.

For heavier uses, like media databases, solely relying on a LSPA might not be enough power or might not be able to handle some things like creating thumbnails, but for many other uses, it’s a powerful model that I’d like to see more support and frameworks for people to make use of, especially non-programmers or people with only a little knowledge.

Fun with Context Free

Math is a tool that creates order and chaos in equal (or was it inequal?) measure.

Context Free Art is a simple art-generation context-free language that uses recursion (among other things) to generate images (and videos). I recently saw a post about it, and I decided to try it out. Then I found a folder in my files from 2013 where I had previously come across it and forgotten all about it.

While more suited to the abstract, it’s possible to create more traditional art with it, as seen in two of the four examples at the bottom.

Here is a sample input to the program:

// Sample input
// two slashes make a comment

// command to build:
// cfdg -s 1920x1080 -m 1000000 sample.cfdg sample.png

// cfdg the command
// -s set size to 1080p
// -m set the maximum number of shapes; helps in case of too much recursion
// [file].cfdg the input file
// [file].png the output image

// Required to kick things off.
startshape Sample

// Make a default background color (random)
CF::Background = [b rand(-0.5,-0.25) sat rand(0.25,0.75) h randint(360)]
// b is brightness; sat is saturation; h is hue

shape Sample {
    SQUARE [s 100 x -200]
    CIRCLE [s 100]
    TRIANGLE [s 100 x 200]
}

// s is size; x is horizontal position

There are three basic shapes available. Can you guess what they are?

From left, on a pink background: a black square, a black circle, and a black triangle.

And you can make your own shapes, using path declarations:

path ZA {
    MOVETO(-0.5, 0)
    LINETO(0, 1)
    LINETO(0.5, 0)
    ARCTO(-0.5, 0, -1)
    CLOSEPOLY()
    // STROKE()[]
    FILL() []
}

This example path creates a piece of pizza! Notice it has STROKE commented out. If you want, you can make outlined shapes using that.

From left, on a brown background: a white pizza slice shape, a black pizza slice outline, and a white pizza slice shape with a black outline.

Github: MtnViewJohn: context-free: Wiki has most of the details on how to use the tool, though you can also look at the gallery of the official website (linked above), where users have provided samples that include their source code.


Anyway, just a short writeup. Here’s some pictures I made with it:

On a green background, a cone-looking tornado kind of thing with colors shifting from green to yellow to pink to purple.
A misshapen earth-like figure with water, land, and clouds, seen on a space-like background.
A sky with clouds and sun above dirt filled with plants and a few trees.
A psychedelic swirl of green, yellow, orange, red, pink, purple, and blue.