Commit 061ab694 authored by mrk022's avatar mrk022

removed print statements

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