45 lines
1.2 KiB
Text
45 lines
1.2 KiB
Text
enum trit
|
|
F=-1, M=0, T=1
|
|
end enum
|
|
|
|
dim as string symbol(-1 to 1) = {"F", "?", "T"}, outstr
|
|
dim as trit i
|
|
|
|
operator not ( x as trit ) as trit
|
|
return -x
|
|
end operator
|
|
|
|
operator and (x as trit, y as trit) as trit
|
|
if x>y then return y and x
|
|
return x
|
|
end operator
|
|
|
|
operator or ( x as trit, y as trit ) as trit
|
|
if x<y then return y or x
|
|
return x
|
|
end operator
|
|
|
|
operator eqv ( x as trit, y as trit ) as trit
|
|
return x*y
|
|
end operator
|
|
|
|
operator imp ( x as trit, y as trit ) as trit
|
|
if -y>x then return -y
|
|
return x
|
|
end operator
|
|
|
|
print " (AND) ( OR) (EQV) (IMP) (NOT)"
|
|
print " F ? T F ? T F ? T F ? T "
|
|
print " -------------------------------------------------"
|
|
for i = F to T
|
|
outstr = " "+symbol(i)+" | "
|
|
outstr += symbol(F and i) + " " + symbol(M and i) + " " + symbol(T and i)
|
|
outstr += " "
|
|
outstr += symbol(F or i) + " " + symbol(M or i) + " " + symbol(T or i)
|
|
outstr += " "
|
|
outstr += symbol(F eqv i) + " " + symbol(M eqv i) + " " + symbol(T eqv i)
|
|
outstr += " "
|
|
outstr += symbol(F imp i) + " " + symbol(M imp i) + " " + symbol(T imp i)
|
|
outstr += " " + symbol(not(i))
|
|
print outstr
|
|
next i
|