Logic

From Esolang
Jump to navigation Jump to search

Logic by User:PuzzleHunter84 uses binary logic gates to output 1's and 0's. These are then translated into ASCII characters. The cat program below copies an inputed digit 1 or 0 into output by outputting digits 011000I where I is the inputed digit.

0-O
  #-O
1-O |
    !-|
0-| | |
  /-O |
0-|   |
      %-O
I-|   |
  &-| |
1-O | |
    %-|
0-O |
  ?-|
1-|

The - and | symbols are used to connect operands to their operator. I indicates an inputed digit. O indicates an outputed digit which are taken top to bottom, left to right. The operands are as follows:

&: and: 1&1=1
        0&1=0
        1&0=0
        0&0=0
/: or: 1/1=1
       0/1=1
       1/0=1
       0/0=0
%: nand: 1%1=0
         0%1=1
         1%0=1
         0%0=1
!: nor: 1!1=0
        0!1=0
        1!0=0
        0!0=1
?: xor: 1?1=0
        0?1=1
        1?0=1
        0?0=0
#: xnor: 1#1=1
         0#1=0
         1#0=0
         0#0=1

See also