Commit 4ce4b84e by mrk022

### can solve equation now

parent c8621a3d
 ... @@ -3,4 +3,4 @@ ... @@ -3,4 +3,4 @@ For this project, we had the topic of AI and Education. We decided to create an intelligent tutor to help young children practice algebra problems. Our tutor uses equations of the form ax + b = cx + d to help the user learn how to simplify equations and solve for x. The user is prompted for input, and the tutor matches their input to a step in the expected problem solving process. If the user's input is correct, they will continue solving the problem, and if not then they will be given the correct step and asked to continue. For this project, we had the topic of AI and Education. We decided to create an intelligent tutor to help young children practice algebra problems. Our tutor uses equations of the form ax + b = cx + d to help the user learn how to simplify equations and solve for x. The user is prompted for input, and the tutor matches their input to a step in the expected problem solving process. If the user's input is correct, they will continue solving the problem, and if not then they will be given the correct step and asked to continue. ## Usage Instructions ## Usage Instructions To use the intelligent tutor, you will need python3 and the Python ACTR library. After you have these installed, in the main project folder, simply run ```python tutor.py``` and you will be prompted for input as the user. If you would like to change the algebra problem you are working on, this variable is in the tutor.py file, near the bottom. The initialization of the user state and tutor state takes an equation as an input and will need to be edited accordinly. To use the intelligent tutor, you will need python3 and the Python ACTR library. After you have these installed, in the main project folder, simply run ```python tutor.py``` and you will be prompted for input as the user. If you would like to change the algebra problem you are working on, this variable is in the tutor.py file, near the bottom. The initialization of the user state and tutor state takes an equation as an input and will need to be edited accordingly. \ No newline at end of file \ No newline at end of file
No preview for this file type
 ... @@ -34,6 +34,19 @@ class EquationTree: ... @@ -34,6 +34,19 @@ class EquationTree: self.output += str(node.value) self.output += str(node.value) self.inorder(node.right) self.inorder(node.right) def solve(self): # solves equation assuming there are only a variable node and num node left if isinstance(self.root.left, VariableNode): # variablenode is on left of equation sol = self.root.right.eval() / self.root.left.eval() self.root.left = VariableNode('x') self.root.right = NumNode(int(sol)) else: sol = self.root.left.eval() / self.root.right.eval() self.root.right = VariableNode('x') self.root.left = NumNode(int(sol)) return self.get_expression() def evaluate(self, parent, left): def evaluate(self, parent, left): # can simplify this to call helper function # can simplify this to call helper function if left: if left: ... ...