esolang

Thief, Police and the Building

A thief rides the elevator, takes one character from each room he robs, and the police make him empty his bag.

2022 · Turing complete: no · ●○○ easy · esolangs.org

Tested with 2 known programs · Test method

Run it

Expected: Hello,World!

The idea

Thief, Police and the Building is from 2022. A program is a short crime story. It draws a building floor by floor, each room holding one character, and then says where the thief goes. Every room he climbs into puts its character in his bag. When the police come, the bag is printed in the order it was filled and the program ends.

Read the story

There are no loops, no jumps and no input. Movement is all the computing there is. The elevator and the stairs each have a speed in floors per second, so 2 seconds in an elevator at 2F/s is four floors.

The machine

LineDoes
A thief on G/FWhere the thief starts; G is the ground floor and basements are negative
Set SoE -> 3F/s Set SoS -> 1F/sThe speed of the elevator and of the stairs
top: 3-th floor btm: -1-th floorThe highest and the lowest floor
G/F H e l l o ,One row of rooms per floor, top first; the ground floor's row starts with G/F
He gets into the elevator and gets upStep into the elevator (or the stair room) going up or down
He stays in the elevator for 1sMove that many seconds times the speed
He gets outBack on a floor
He climbs into 2-th room and stealsPut room 2's character in the bag
The police have comePrint the bag and stop

The thief steals and steps in only on a floor, and rides only inside. Leaving the building is an error.

Example

Hello World starts on the ground floor and robs its six rooms.

Hello World starts on the ground floor and robs its six rooms. The elevator at 3 floors a second takes the thief down three floors in one second, to the basement where W o r l d ! waits. A room cannot hold a space, so the greeting comes out without one.

The Kiwiscript program plays the two speeds against each other. The thief rides from the basement four floors up to the 3rd floor, takes the stairs down one, robs a k, goes down one more and rides two floors back up for i, w and i.

Expected: kiwi

Patterns it teaches

  • Camouflage: the program reads as a heist, and the building is the data.

Further

Pseudonatural

Write your own in Run Convert a program from Thief, Police and the Building

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: thief-police-and-the-building.

Command line

shib run thief-police-and-the-building program.txt

The program is long; save it as program.txt first.

shib manual thief-police-and-the-building

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/thief-police-and-the-building.js

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

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