User:FrankPujo/Tritwise

From Esolang
Jump to navigation Jump to search

Everything listed here is just my take on Tritwise Operations. A lot of the gates are taken from TriINTERCAL

Operators

TAND

Corresponds to Bitwise AND. Returns the smallest value.

& 0 1 2
0 0 0 0
1 0 1 1
2 0 1 2

TOR

Corresponds to Bitwise OR. Returns the largest value.

V 0 1 2
0 0 1 2
1 1 1 2
2 2 2 2


BUT

Returns the grade of similarity of the values. It's the opposit of DISTANCE.

_ 0 1 2
0 2 1 0
1 1 2 1
2 0 1 2

SHARKFIN

The name derives from TriINTERCAL, for the ^ symbol. It adds without carrying the trit.

^ 0 1 2
0 0 1 2
1 1 2 0
2 2 0 1

PROD

Stands for product and it's just the result of the multiplication.

. 0 1 2
0 0 0 0
1 0 1 2
2 0 2 1

DIST

Stands for distance and returns the absolute value of the difference of the values. It's the opposite of BUT.

% 0 1 2
0 0 1 2
1 1 0 1
2 2 1 0

Asymmetric operators

All the operators list up to this point were symmetric, as the order of the two inputs is irrelevant. In this section will be listed all the asymmetric operators, in which the order of the inputs is relevant. In the tables the first value will be read from the first column on the left, so that each row has the same first input and varying second input, while each column has varying first input but same second input.

THEN

It shares some similarities with BUT as it aslo returns 2 if the inputs are equal. It returns 1 if the second is greater and 0 if it is smaller.

% 0 1 2
0 2 1 1
1 0 2 1
2 0 0 2