Gravilang
Gravilang is an programing language so small that it can run on literal balls (i am actually trying to do that btw using Gravitrax), while still being able to to conditions (not necesarelly turing complete because it cannot do nested conditions). It has 2 registers that can store 2 bits, in other words an number between 0 and 3. All the registers start at 0. Each program happens on two rows, called = and ≠. The pointer starts in the = row, and after each command it moves 1 collum to the right. The commands can change the lane before executing the next command. If it reaches the end it will loop back at the first collum, while preserving the row. The avaliable commands are:
- A (A+): Adds 1 to the first register. Normally it switches to the ≠ row but if after incrementing it loops back to 0 then it switches to =
- B (B+): Adds 1 to the second register. The same incrementing row rules applies.
- N (NOP): Doesn't do anything and switches to the = row. Useful for conditions
- O (OA): Ouputs a point (because I dont have enough pieces for the balls to ouput diferent values but i do have to just ouput a single ball with no extra context) and increments A. The same incrementing row rules applies.
- H (HALT): Self explanatory
Notes
In a single collum you cant put both of the commands B N or O H, but you can put both of B O, B H, N O or N H.
Programs
- "Truth machine" (The input is stored at start in the second register (B). If 0 ouputs and halts, if 1 ouputs forever) (= and ≠ are just to show the rows):
=|OBBBBH ≠|OBBBBN
- 4-bit Counter (Before looping the first register represents the 4,8 bits and the second the 1,2 bits after incrementing):
=|BA ≠|BN