Commit 061ab694 authored by mrk022's avatar mrk022
Browse files

removed print statements

parent 0a1b62a5
...@@ -20,12 +20,12 @@ class EquationTree: ...@@ -20,12 +20,12 @@ class EquationTree:
def updateNode(self, parent, left, newNode): def updateNode(self, parent, left, newNode):
if left: parent.left = newNode if left: parent.left = newNode
else: parent.right = newNode else: parent.right = newNode
self.printTree() #self.printTree()
def get_expression(self): def get_expression(self):
self.output = "" self.output = ""
self.inorder(self.root) self.inorder(self.root)
print("output is: ", self.output) #print("output is: ", self.output)
return self.output return self.output
def inorder(self, node): def inorder(self, node):
...@@ -51,15 +51,9 @@ class EquationTree: ...@@ -51,15 +51,9 @@ class EquationTree:
# can simplify this to call helper function # can simplify this to call helper function
if left: if left:
if parent.left.canEval(): if parent.left.canEval():
print("parent.left.left is ", parent.left.left.value)
print("parent.left.right is ", parent.left.right)
if isinstance(parent.left.left, NumNode): if isinstance(parent.left.left, NumNode):
print("num node")
print("evaluating", parent.left.eval())
newNode = NumNode(parent.left.eval()) newNode = NumNode(parent.left.eval())
else: else:
print("variable node")
print("evaluating", parent.left.eval())
newNode = VariableNode(str(parent.left.eval()) + "x") newNode = VariableNode(str(parent.left.eval()) + "x")
parent.left = newNode parent.left = newNode
elif parent.left.left != None and parent.left.left.canEval(): elif parent.left.left != None and parent.left.left.canEval():
...@@ -69,10 +63,8 @@ class EquationTree: ...@@ -69,10 +63,8 @@ class EquationTree:
else: else:
if parent.right.canEval(): if parent.right.canEval():
if isinstance(parent.right.left, NumNode): if isinstance(parent.right.left, NumNode):
print("evaluating", parent.right.eval())
newNode = NumNode(parent.right.eval()) newNode = NumNode(parent.right.eval())
else: else:
print("evaluating", parent.right.eval())
newNode = VariableNode(str(parent.right.eval()) + "x") newNode = VariableNode(str(parent.right.eval()) + "x")
parent.right = newNode parent.right = newNode
elif parent.right.left != None and parent.right.left.canEval(): elif parent.right.left != None and parent.right.left.canEval():
...@@ -226,7 +218,7 @@ def infix_to_prefix(formula): ...@@ -226,7 +218,7 @@ def infix_to_prefix(formula):
a = exp_stack.pop() a = exp_stack.pop()
b = exp_stack.pop() b = exp_stack.pop()
exp_stack.append( op+" "+b+" "+a ) exp_stack.append( op+" "+b+" "+a )
print(exp_stack[-1]) #print(exp_stack[-1])
return exp_stack[-1] return exp_stack[-1]
def add_to_tree(q, root, left): def add_to_tree(q, root, left):
...@@ -279,5 +271,5 @@ def generate_tree(equation): ...@@ -279,5 +271,5 @@ def generate_tree(equation):
q2.enqueue(token) q2.enqueue(token)
add_to_tree(q2, t.root, False) # add expression tree to right side of equation tree add_to_tree(q2, t.root, False) # add expression tree to right side of equation tree
t.printTree() #t.printTree()
return t return t
\ No newline at end of file
...@@ -213,27 +213,27 @@ class IntelligentTutor(ACTR): ...@@ -213,27 +213,27 @@ class IntelligentTutor(ACTR):
def init(): def init():
user.get_input() user.get_input()
print("USER STATE IS ", user.state) # need to get user input to translate to state #print("USER STATE IS ", user.state) # need to get user input to translate to state
goal.set(user.state) goal.set(user.state)
def moved_constants(goal="move_constants ?left"): #true if moving constants left def moved_constants(goal="move_constants ?left"): #true if moving constants left
tutorEq = tutor.move_values(bool(int(left)), True) tutorEq = tutor.move_values(bool(int(left)), True)
print("user equation ",user.equation) #print("user equation ",user.equation)
goal.set("check_state " + tutorEq + " 0") goal.set("check_state " + tutorEq + " 0")
def add_constants(goal= "add_constants ?left"): def add_constants(goal= "add_constants ?left"):
tutorEq = tutor.combine_like_terms(bool(int(left))) tutorEq = tutor.combine_like_terms(bool(int(left)))
print("user equation ",user.equation) #print("user equation ",user.equation)
goal.set("check_state " + tutorEq + " 0") goal.set("check_state " + tutorEq + " 0")
def moved_variables(goal="move_variables ?left"): def moved_variables(goal="move_variables ?left"):
tutorEq = tutor.move_values(bool(int(left)), False) tutorEq = tutor.move_values(bool(int(left)), False)
print("user equation ",user.equation) #print("user equation ",user.equation)
goal.set("check_state " + tutorEq + " 0") goal.set("check_state " + tutorEq + " 0")
def add_variables(goal = "add_variables ?left"): def add_variables(goal = "add_variables ?left"):
tutorEq = tutor.combine_like_terms(bool(int(left))) tutorEq = tutor.combine_like_terms(bool(int(left)))
print("user equation", user.equation) #print("user equation", user.equation)
goal.set("check_state " + tutorEq + " 0") goal.set("check_state " + tutorEq + " 0")
def solve(goal = "solve_for_x"): def solve(goal = "solve_for_x"):
...@@ -241,7 +241,6 @@ class IntelligentTutor(ACTR): ...@@ -241,7 +241,6 @@ class IntelligentTutor(ACTR):
goal.set("check_state " + tutorEq + " 1") goal.set("check_state " + tutorEq + " 1")
def check_state(goal = "check_state ?tutorEq ?solved"): def check_state(goal = "check_state ?tutorEq ?solved"):
print("checking state")
if tutor.compare_Equations(tutorEq, user.equation): if tutor.compare_Equations(tutorEq, user.equation):
if bool(int(solved)): if bool(int(solved)):
print("You have solved the equation by isolating x.") print("You have solved the equation by isolating x.")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment