Last active
February 6, 2021 03:58
-
-
Save akarve/e63185d7327489e96dc847cd7334e668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def binop(fun: int, x: int, y: int) -> int: | |
val = (x << 1) + y | |
return (fun >> val) & 1 | |
possible = set() | |
# h(x, g(y, z)) | |
for h in range(16): | |
for g in range(16): | |
outputs = 0 | |
for n in range(8): | |
x = n >> 2 & 1 | |
y = n >> 1 & 1 | |
z = n >> 0 & 1 | |
out = binop(h, x, binop(g, y, z)) | |
outputs = outputs | (out << n) | |
possible.add(outputs) | |
print(possible) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment