A web version of Daniel Dennett's RAP machine.
The RAP language has three instructions:
INC [register] [instruction]
DEB [register] [instruction] [branch instruction if zero]
Execution begins at instruction 1. Play executes the program until it reaches an END (watch out for infinite loops!)
Step executes one instruction at a time. The highlighted instruction is the next one about to be executed. Restart sets the machine to it's initial state, your instructions will still be there, it just gets rid of the existing register values and sets the program to run at instruction 1 again. You can only have one instruction per line.
Write the program here.
Restart to start over again
The register values are here.
This makes a loop to decrement a register, increment a register. If we can't decrement because zero, we've taken all from that register and added to the other, so branch to end.
Register 0 with your value, register 1 with the other value. The result will be in register 1.
DEB 0 2 3
INC 1 1
END
Like addition, but zeroes out a register, then adds a another register to this one.
Register 0 will get zeroed out then the contents of register 1 will be moved to it.
DEB 0 1 2
DEB 1 3 4
INC 0 2
END