WORST

From Esolang
Jump to navigation Jump to search

WORST is an esoteric programming language designed to be as unpleasant, counter-intuitive, and error-prone as possible — a loving satire of languages such as INTERCAL, Brainfuck, Malbolge and Piet. Its goal is not elegance or practicality but to annoy, confuse, and punish the programmer at every turn.

Overview

WORST combines a mix of awkward syntactic requirements, self-modifying behavior, nondeterministic execution, and environment-dependent semantics so that the same file will often behave differently on different systems and even on different runs. Inspiration and design philosophy borrow from classic "make-it-hard" esolangs: the politeness enforcement of INTERCAL, the tiny instruction set and pointer fiddliness of Brainfuck, the deliberate infeasibility of Malbolge, and the visual/artistic obfuscation of Piet. Esolangs +3 Esolangs +3 Esolangs +3

Design goals

Be maximally annoying to write programs in while still being Turing-capable in at least one reasonable implementation.

Force the programmer to think about line endings, file metadata, terminal width, local time, and CPU cache behavior.

Make simple programs long, and long programs brittle.

Encourage weirdness that produces interesting puzzles and community mad-libs.

Execution model

WORST programs are plain text files executed by a WORST interpreter. Execution proceeds in multiple layered phases:

Lexical phase: input is tokenised only if the current system locale is an odd number of bytes per character; otherwise tokens are taken in reverse. (Implementations must check the system locale byte-width at startup.) Preflight phase: the interpreter hashes the file contents with a salted algorithm where the salt is the current minute of the local system time; the hash decides which of several incompatible runtime rulesets to use. Execution phase: statements are executed in linear order except where control flow has been "politely" requested (see Politeness below). Some instructions are address-sensitive and will mutate neighbouring bytes at runtime (self-modification). Finalisation: before exiting, the interpreter may (with probability 1 in 13) exit with a non-zero exit code even on successful output, to keep users humble.

Note: because of the preflight salt and time dependence, programs can be deliberately non-repeatable across minutes. This is by design.

Syntax

WORST uses an odd mixture of symbols and English keywords. Tokens are separated by either a single space, a tab, or the presence of the string ``PLEASE — which counts as both a separator and a semantic modifier.

Basic statement form:

[label:] verb (arguments) PLEASE? %optional-politeness


Where:

label: is an optional numeric label in square brackets (labels are checked in base-7 unless the interpreter detects daylight saving time).

verb is one of a small set of instructions (see Instruction set).

PLEASE? is the politeness marker: the exact capitalization and punctuation matter. For example please, PLEASE, and PLEASE!!! are treated as three distinct politeness levels.

This deliberate sensitivity to trivial orthography is inspired by the politeness rules first seen in INTERCAL. Esolangs

Instruction set (selected)

WORST intentionally keeps a small, ambiguous instruction set. Implementations may add unofficial extensions; many canonical examples rely on a consistent core.

INC — increment the current cell. However, if the system clock's seconds value is prime, INC decrements instead.

MOV x y — move data from cell x to cell y; if x == y the interpreter panics politely and reverses all bits in memory.

READ — read a single character from stdin; if EOF, roll a 6-sided die and read the die face as a character code.

GOTO label — jump to label; if the label is missing, create it by inserting a new line in the source after the current one containing the literal text [label]: ABSTAIN and continue execution.

ABSTAIN / REINSTATE — toggle politeness masks: executed statements may be ignored or reactivated. (This is deliberately confusing by design and is a nod to INTERCAL's abstain/reinstate behavior.)

/comment/ — comments. But: comments are executed as data if the interpreter accidentally parses them as code because the timezone offset is negative.

Many instructions have address-dependent semantics: the same opcode at a different byte offset can do something else entirely (an idea familiar from Malbolge). Esolangs

Politeness

WORST enforces a "politeness" metric similar in spirit to INTERCAL's politeness rules: a program must contain a certain ratio of polite statements (statements that include ``PLEASE`` in some allowed forms) to impolite statements. A very rude program will not run; a very polite program will be refused with a passive-aggressive error message. Implementations often vary the required ratio (one implementation might require 1/7 polite, another 3/14) and may log your offence to a global registry. Esolangs

I/O and environment dependence

WORST deliberately ties program behavior to:

Local time (minute and second).

Locale settings (character width, decimal separator).

Terminal width (wrap rules change which tokens are visible).

Last modified timestamp of the source file (used as an entropy seed).

Environment variables whose names begin with ``WORST_.

Because of this, "Hello, world" may print different strings depending on where or when you run it.

Example: Hello, World

This is a canonical (and intentionally unreliable) Hello World. It uses politeness and time-dependent behavior so it often prints gibberish.

 [1:] MOV 0 1 PLEASE INC PLEASE INC READ PLEASE GOTO 1 PLEASE!!! # If you see
"HELLO, WORLD!" you're lucky. 

Warning: running this program at certain minute values will cause the interpreter to swap stdout and stderr.

See also