Created
September 22, 2021 02:12
-
-
Save TheBlackPlague/65f933792c8957b77f19df5473a0a92c 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
# Goal: Find logical difference between "a AND (b OR NOT c)" and "a AND b OR NOT c" | |
import random | |
chars = ["T", "F"] | |
combinationgram = [] | |
i = 0 | |
while i < 2 ** 3: | |
combination = [] | |
j = 0 | |
while j < 3: | |
rI = round(random.uniform(0, 1)) | |
# print(rI) | |
combination.insert(j, chars[rI]) | |
j = j + 1 | |
if combination in combinationgram: | |
continue | |
combinationgram.insert(i, combination) | |
i = i + 1 | |
print(combinationgram) | |
i = 0 | |
while i < 2 ** 3: | |
combination = combinationgram[i] | |
a = True | |
b = True | |
c = True | |
if combination[0] != 'T': | |
a = False | |
if combination[1] != "T": | |
b = False | |
if combination[2] != "T": | |
c = False | |
if (a and (b or not c)) != (a and b or not c): | |
print("Breaks, a: " + str(a) + ", b: " + str(b) + ", c: " + str(c) + ".") | |
i = i + 1 | |
# OUTPUT: | |
# [['F', 'T', 'F'], ['T', 'F', 'T'], ['F', 'F', 'F'], ['T', 'T', 'F'], | |
# ['F', 'F', 'T'], ['T', 'F', 'F'], ['T', 'T', 'T'], ['F', 'T', 'T']] | |
# Breaks, a: False, b: True, c: False. | |
# Breaks, a: False, b: False, c: False. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment