# XOṘ Mạchịne

XOṘ Mạchịne is an OISC based on the XOR operation invented by User:A. It is an open question on whether this machine can simulate every logic gate with two parameters.

A B Result
1 1 0
1 0 1
0 1 1
0 0 0

## The Program Execution Process

Input two bits, where the first bit represents a, and the second bit represents b. After processing the program, output whether a is larger than b. If that is true, output 1. Otherwise, output 0.

There is only 1 constant available. That is the constant `1`, which represents the bit 1.

`a` represents the bit a, and `b` represents the bit b.

For every two commands, e.g. `ab`, a XOR b is done and is stored in a.

`abbabb`

`aba1bb`

`bbaa`

`bbaaa1`

`abbb`

`bb`

`bba1`

`aa1`

`b1aa1`

`b1`

`a1`

## C Implementation

```#include <stdio.h>
int main(int argc, char*argv[]) {
FILE *fp=fopen(argv[1],"r");
char code[99999];
int c;
for(int i=0;(c=fgetc(fp))!=EOF;i++)
code[i]=c;
char a,b;
char s[3];
scanf("%s",&s);
a=s[0]-48;
b=s[1]-48;
//debug
for(int i=0;code[i]!='\0';i+=2) {
if(code[i]=='a'&&code[i+1]=='a')
a ^= a;
else if(code[i]=='a'&&code[i+1]=='b')
a ^= b;
else if(code[i]=='a'&&code[i+1]=='1')
a ^= 1;
else if(code[i]=='b'&&code[i+1]=='a')
b ^= a;
else if(code[i]=='b'&&code[i+1]=='b')
b ^= b;
else if(code[i]=='b'&&code[i+1]=='1')
b ^= 1;

}
printf("%d",a>b);
return 0;
}```