也许你需要直接公式来设置输出位。
x=0 or y=0 or z=0 is equivalent to x*y*z = 0
x=1 or y=1 or z=1 is equivalent to (x-1)*(y-1)*(z-1)=0
x=2 or y=2 or z=2 is equivalent to (x-2)*(y-2)*(z-2)=0
让我们映射到位:
'c':1 'd':0xb10 'e':0xb100 'f':0xb1000
is c(is‘c’)的关系:
if xyz=0 then isc=1 else isc=0
使用数学公式
https://youtu.be/KAdKCgBGK0k?list=PLnI9xbPdZUAmUL8htSl6vToPQRRN3hhFp&t=315
[c]:
(xyz=0 and isc=1) or (((xyz=0 and isc=1) or (isc=0)) and (isc=0))
[d]:
((x-1)(y-1)(z-1)=0 and isc=2) or (((xyz=0 and isd=2) or (isc=0)) and (isc=0))
...
通过以下逻辑连接这些公式:
-
逻辑
and
是方程的平方和
-
逻辑
or
是方程式的乘积
你会得到一个总方程
求和,你有求和的总公式
那么sum&1是c,sum&2是d,sum&4是e,sum&5是f
在此之后,您可以形成预定义的数组,其中字符串元素的索引将对应于就绪字符串。
array[sum]
给你绳子。