HUMAN RESOURCE MACHINE
A Simulator
Instructions Programming Reference Custom Levels
Inbox Floor Tiles Outbox Program
Messages:

Instructions

  1. Load a setup file by pressing the "Choose File" button
  2. Type/Paste your code into the "Program" text area
  3. Execute your program:
    • To launch the program, press
      • To break execution of the program, press
    • To execute one command at a time, press
    • To roll back a command (once execution has begun), press
    • To end execution and edit the program again, press
  4. Execution of the program stops automatically if:
    • A runtime error occurs; a description of the error will appear in the "Messages" list
    • There is nothing left to pick up from the Inbox
    • The end of the program is reached

Programming Reference


Input / Output

-- comment Anything following "--" is not considered code, anywhere on a line
INBOX Pick up next value from the Inbox
OUTBOX Put currently held value in the Outbox
COPYFROM address Pick up contents of tile at address
COPYTO address Write currently held value on tile at address


Arithmetic

ADD address Add contents of tile at address to currently held value
NOTE: Only numbers can be added
SUB address Subtract contents of tile at address from currently held value
NOTE: Numbers can only be subtracted from numbers, or letters from letters
BUMPUP address Subtract one to the tile at address and pick up the result
NOTE: Only numbers can be bumped
BUMPDN address Subtract one from the tile at address and pick up the result
NOTE: Only numbers can be bumped


Indirect Addressing

command [address] Access a tile whose address is written on tile at address


Branching

label: Define a jump location named label
JUMP label Continue program execution from label
JUMPZ label Jump to label if currently held value is zero
NOTE: Does nothing unless the value in hand is a number
JUMPN label Jump to label if currently held value is negative
NOTE: Does nothing unless the value in hand is a number


Tile naming

DEFINE LABEL address label Label the tile at address

Custom Levels

Follow the format found in the included file: res/level-data.json. The contents of floor tiles, either as:
  • An array; values beyond the specified size will be ignored
  • An object with tile addresses as keys, e.g.: { "24": 1, ... }
Missing values will be left empty. The Floor Tiles, Inbox and Outbox may only contain the following:
  • Empty values, e.g.: null, ""
  • Integer numbers, e.g.: 10, "10"
  • Characters (A to Z), e.g.: "A", "B", etc.
Your custom level needs at least one example, so it can be played.