Binary Insanity

From Esolang
Jump to navigation Jump to search

Binary Insanity is an esolang created by User:TheMCoder

Overview

Binary Insanity has 7 commands

commands
Name Description
111 increment the counter by 1
101 opposite of 111
010 outputs the ASCII value of the counter
100 gets input from user and stores the ASCII value of the first letter of it in the counter
001 quits
110 sets the counter to zero
000 loops back to the beginning

Examples

cat

   100010000

hello world

sorry about the formatting:(


111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111
111111111111111111111111111111111111111010111111111111111111111111111
111111111111111111111111111111111111111111111111
1111111111110101111111111111111111110100101111111110101011011011011011011
01101101101101101101101101101101101101101101
10110110110110110110110110110110110110110110110110110110110110110110110110110
1101101101101101101101101101101101101101
101101101101101101101010101101101101101101101101101101101101010111111111111111111
111111111111111111111111111111111111
1111111111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111111110101111
1111111111111111111111111111111111111111111111111111111111111111111101011111111101010110
11011011011010101011011011011
01101101101010101101101101101101101101101101101101101101101101101101101101101101101101101101
101101101101101101101101
1011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011011
01010

Interpreter

The only (current) known Interpreter is in python:

   maininput = input()
   def runcode(code):
       command = ""
       v = 0
       if code == "":
           print("NOPE.")
           raise SystemExit
       for character in code:
           if not character in "01":
               raise SyntaxError("The Machine will not understand the command")
           command += character
           if len(command) == 3:
               if command == "111":
                   v += 1
               elif command == "101":
                   v -= 1
               elif command == "010":
                   print(chr(int(v)))
               elif command == "001":
                   inputinput = input()
                   v = ord(inputinput[0])
               elif command == "100":
                   raise SystemExit
               elif command == "000":
                   runcode(code)
               elif command == "110":
                   v = 0
               else:
                   raise SyntaxError(f"Unknown command {command!r}")
               command = ""
   runcode(maininput)