We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

Square

From Esolang
Jump to navigation Jump to search

Square is an esoteric programming language created in 2026 by User:AndrewBayly in which the obfuscation mechanism is a block permutation puzzle. The programmer writes ordinary JavaScript, and an encoder scrambles it into a rectangular grid of 3×3 character blocks. An interpreter must search through all possible arrangements to recover and execute the original program.

The encoding is trivially fast. Decoding is combinatorially explosive. This asymmetry is the point.

Concept

A Square program is a shuffled grid of 3×3 character blocks. Each block contains nine characters of escaped source code. The blocks are arranged into the squarest possible rectangle and separated by blank lines. To execute the program, an interpreter must find the permutation of blocks that reassembles into valid JavaScript, then run it.

The search space is N! where N is the number of blocks. This grows superexponentially with program length: a short program may be decoded in seconds, while a program of modest length may require longer than the age of the universe to decode. The language has a natural complexity hierarchy determined entirely by how many characters the programmer writes.



Implementation

The reference implementation is a self-contained HTML/JavaScript file providing an encoder and interpreter with a browser-based interface. It is available at:

The encoder runs instantly for any program length. The interpreter uses Heap's algorithm with asynchronous batched execution to remain responsive in the browser, with a live permutation counter and estimated time remaining.

See also

  • Malbolge — another esolang where program execution is intentionally difficult
  • JSFuck — valid JavaScript written using only six characters