Better-machine

From Esolang
Jump to navigation Jump to search

A Better-machine is a derivative of the Truth-machine program type. It was devised from User:ZachMadeAnAltBecauseHeLostThePassword (aka me!) to be a test to see if an esolang is humanly usable. It tests the following capabilities:

  • Addition and Subtraction
  • I/O
  • Control Flow
  • Arrays
  • Bounded and Unbounded Repetition
  • Termination

The format of a Better-machine is like this (made using pseudo-code)

array = [getInput(), getInput()]
difference = betterArray[1] - betterArray[2]
if (difference = 0) {
  repeat array[1] + array[2] times {
    outputToConsole("0")
  }
  endProg
} else {
  repeat forever {
    outputToConsole("1")
  }
}

In languages without array capabilities, a better-machine may use 2 variables in place. In esolangs without input, a better-machine may use a predetermined value in place. If an esolang does not have output, it may fill in memory with 1s. The essence of a better-machine is, similar to it's ancestor, the truth-machine, that some part of it, whether in the memory the program is using or in the program's code, uses a group of variables to decide whether A or B performs, and the program contains the capacity (namely, program code) to do either of two possible things: in case of A the machine/program will perform a varied repetition, in case of B it will run without termination.

Implementations

Python

a, b = int(input()), int(input())
if (a - b) == 0:
    for i in range(a + b):
        print(0)
else:
    while True:
        print(1)