-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
42 lines (32 loc) · 1 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from sympy import SympifyError
from sympy.logic.boolalg import *
from belief_base import BeliefBase
bb= BeliefBase()
def actions():
print("\n You can chose among these actions: \n * r: Revise belief base with formula \n * p: Print belief base \n * q: Quit \n "
)
def user_input():
actions()
action = input(" What's next? : \n >>> ")
action = action.lower()
print()
if action == 'r':
print(" Enter a formula to revise: ")
print()
formula = input(" >>> ")
try:
formula = to_cnf(formula)
#insert revision call here
bb.revise(formula)
except SympifyError:
print(" \n The formula isn't valid and can't be converted to CNF format")
elif action == 'p':
print(" \n Printing the base:")
print ("\n " + bb.belief_base_to_string())
elif action == 'q':
print("Exiting program")
exit()
else:
print("Unavailable command :/")
user_input()
user_input()