Spare Change

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Spare Change is an esolang inspired by the Money Pieces, by Math Learning Center app on the App Store.

The Commands

This esolang has four registers: the Left Hand (≤), the Right Hand (≥), the Pocket (¢), and the Bank ($). Each one can be modified by using any of the commands below:

  • n>r - Move n dollars into the register, adding onto what is already there.
  • r>n - Take n dollars from the register.
  • r1>r2 - Move the money in register 1 into register 2, adding onto what is already there.
  • r1=r2 - Swap the contents of register 1 with register 2.
  • r=n - Set the register to n.
  • r1+r2>r3 - Add register 1 and 2 together, and store the result into register 3.
  • r1-r2>r3 - Subtract register 2 from register 1, and store the result into register 3.
  • □>r - Take 1 ASCII character of user input and put it into the register as a number.
  • r>□ - Print the register's number as an ASCII character.
  • r1(<=>/)r2>n - Jump to the nth instruction if register 1 is less than (<), equal to (=), greater than (>), or not equal to (/) register 2
  • r(<=>/)m>n - Jump to the nth instruction if the register is less than (<), equal to (=), greater than (>), or not equal to (/) m
  • >>n - Jump to the nth instruction
  • //“string” - Comment

Example Programs

Hello, world!

//"Hello"
72>$
$>□
29>$
$>□
7>$
$>□
$>□
3>$
$>□
//"Space"
$=32
$>□
//"World"
$=119
$>□
$>8
$>□
3>$
$>□
$>6
$>□
$>8
$>□
//"!"
$=33
$>□