Created
December 12, 2020 16:00
-
-
Save jack-champagne/1712e5066736b164ce69c38bb63a12c5 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 rulesTrue(m, p ,s, k, b, c): | |
c1 = (c <= (k and m)) | |
c2 = (not p or s) <= (b or c) | |
c3 = (p and c) <= (not m) | |
c4 = (not s) <= (p or not k) | |
c5 = b <= (not k and not p) | |
c6 = (not s or not k) <= c | |
return (c1 and c2 and c3 and c4 and c5 and c6) | |
for i in range(0, 64): | |
num = i | |
out = [1 if num & (1 << (5-n)) else 0 for n in range(6)] | |
for j in range(0, 6): | |
if (out[j] == 1): | |
out[j] = True | |
else: | |
out[j] = False | |
[m, p, s, k, b, c] = out | |
if (rulesTrue(m, p, s, k, b, c)): | |
print('m: ' + str(m) + ' p: ' + str(p) + ' s: ' + str(s) + ' k: ' + str(k) + ' b: ' + str(b) + ' c: ' + str(c)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Brute force logic problem