esolang

Human Resource Code

The office of the game Human Resource Machine, written out as text. One worker, two conveyor belts and a carpet of numbered cells.

EthanPixelate, 2019 · Turing complete: unknown · ●○○ easy · esolangs.org

Tested with 4 known programs · Test method

Run it

Expected: abc

The idea

EthanPixelate made Human Resource Code in 2019, after the puzzle game Human Resource Machine. In the game you program an office worker with a short list of commands. The worker takes boxes from an inbox conveyor, works on them with the help of the cells on the carpet and drops the results into the outbox. The language keeps the game's commands and is meant to look like game code pasted into a text editor. It adds commands to ask for input, to turn numbers into characters and back, and to halt.

The machine

CommandDoes
ASK ASKSTRINGPut a number, or a line's character codes and then a 0, on the inbox
INBOX OUTBOXTake the next box; drop the held box in the outbox
COPYFROM n COPYTO nPick up a copy of cell n; put a copy in cell n
ADD n SUB nAdd cell n to the held box, or take it away
BUMPUP n BUMPDN nAdd 1 to cell n, or take 1 from it
TOCHAR TONUMTurn a code into its character and back
name:A jump point
JUMP JUMPZ JUMPN JUMPCJump always, or when holding 0, a negative number or a character
STOPHalt

The carpet has cells 0 to 127, all holding 0, and four named cells with the codes of 0, A, a and the space. A number in the outbox is followed by a space.

The specification includes its author's Lua interpreter, and this implementation follows it, quirks too. The interpreter passes over any word it does not know, so COMMENT does nothing. A slip in operator precedence makes a lone ; stop the run with Unknown Command, though the specification calls it a comment. A numbered cell must hold a number from -999 to 999 each time it is used.

Example

The cat, without its blank lines.

The cat, without its blank lines. ASKSTRING ends the line with a 0, and JUMPZ catches it.

A countdown. Cell 0 holds the number and goes down until JUMPZ sees 0.

Expected: 3 2 1

The truth machine. On 0 it prints 0. On 1 it prints 1 a thousand and one times, because cell 2 counts the rounds and the next BUMPUP 2 after it passes 999 stops the run.

Expected: 0

The math example says it prints 3. Its third line misspells BUMPUP, the interpreter passes over the word, and so cell 1 stays 0 and the sum is 2.

Expected: 2

Patterns it teaches

Further

Also in Turing tarpits

Write your own in Run Convert a program from Human Resource Code

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: human-resource-code.

Command line

shib run human-resource-code -e 'BUMPUP 0
BUMPUP 0
BUMBUP 1
COPYFROM 0
ADD 1
OUTBOX'
shib manual human-resource-code

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/human-resource-code.js

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

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