esolang

Apple Pie

Every command ends with the letter nine places after its own, and one line break turns any program into a quine.

Cortex, 2018 · Turing complete: no · ●●○ moderate · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: HaHaHa

The idea

Cortex made Apple Pie in 2018 to be as hard to read and write as possible. A program has to start with Good luck reading this lol u and end with !!!. Command names are single letters or gibberish such as EepbeepQ, and each one is closed by a space and the letter nine places after its last letter. A ends with J, D with M and EepbeepQ with Z.

Read the story

Printing is no easier. AX J prints the character one before X, so AI J prints H. A variable prints backwards, so 10 comes out as 01. Loop counts are written in base 3. A line break where a command could stand prints the source and deletes everything else, so any program that runs one is a quine.

The machine

CommandDoes
AX JPrint the character one before the first of X
A$vF JPrint the variable v backwards
DvDX MSet the variable v to a number, a variable, an operation or a word
EepbeepQn Z ... C LRepeat n times, n in base 3
FaF+Fba + b, also with - * / ^, nested inside a and b
$vFThe variable v, or the letter L if it has none
GX PRun X as HQ9+
H44vQClear the variable v
BX KA comment
a line breakPrint the program and nothing else

The specification leaves some things open. In this implementation numbers are whole, / rounds toward 0, and HQ9+ prints hello, world as HQ9+ itself does.

Example

10 in base 3 is three, so the loop prints H and a three times.
Expected: 01

10 in base 3 is three, so the loop prints H and a three times. The second sets X to 5 + 5 and prints it backwards.

The specification counts from 1 to 10. The loop runs 100 in base 3, nine times, printing X and adding 1. Then 10 would print as 01, so the program spells it with A2 J and A1 J.

Expected: 12345678910
Expected: Good luck reading this lol uGQ P!!!

Patterns it teaches

  • Hostile design: closing letters that change with the command, and output shifted by one.
  • Quine: HQ9+'s Q, or a single line break.

Further

Also in Hostile

Write your own in Run Convert a program from Apple Pie

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: apple-pie.

Command line

shib run apple-pie -e 'Good luck reading this lol uGQ P!!!'
shib manual apple-pie

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/apple-pie.js

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

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