esolang

Cheat

Brainfuck, except that the shortest Hello World is no program at all.

None1, 2023 · Turing complete: yes · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello World!

The idea

None1 made Cheat in 2023. It is brainfuck with one change. A program with no characters prints Hello World!, so its Hello World is 0 bytes long. Every other program, even one space, runs as plain brainfuck and so prints nothing without a ..

Read the story

The specification's interpreter is a JavaScript function of 85 lines. Its first statement returns Hello World! when the program is empty, and the rest is a brainfuck interpreter.

The machine

CommandDoes
(nothing)Print Hello World!
+ -Add or take 1 from the cell, wrapping at 256
> <Move to the next or the previous cell
. ,Print the cell; read a byte, 0 at the end of the input
[ ]Skip past ] if the cell is 0; go back to [ if it is not

The tape has 1,000,000 cells, and moving off either end is an error. Brackets are paired before the run, so an unmatched one stops a program before it prints anything.

Example

The last one adds 8 to the second cell 8 times, then 1 more, and prints 65.
Expected: abc
Expected: A

The last one adds 8 to the second cell 8 times, then 1 more, and prints 65.

Patterns it teaches

  • Turing tarpit: eight commands of brainfuck, with one free program on top.

Further

Cheat builds on Brainfuck.

Brainfuck derivatives

Write your own in Run Convert a program from Cheat

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: cheat.

Command line

shib run cheat -e ',[.,]' --input 'abc'
shib manual cheat

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/cheat.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org