Updated the Expression object to include 'wrong_response' and wrote the code needed to start the finding mutations.

This commit is contained in:
2020-04-18 01:13:11 -05:00
parent 58bd836ee2
commit ca47912d05
6 changed files with 54 additions and 37 deletions
+13 -5
View File
@@ -1,14 +1,20 @@
class Expression:
expression = ""
correct_answer = 0
# correct_response = 0
wrong_response = 0
variables = []
def __init__(self, expression_string, variables, correct):
def __init__(self, expression_string, variables, wrong_response):
self.expression = expression_string
self.variables = variables
self.correct_answer = correct
self.wrong_response = wrong_response
class Variable:
name = ""
type = ""
starting_point = 0
ending_point = 0
VARIABLE_TYPES = {
"i" : "Interest",
"I" : "Interest",
@@ -24,6 +30,8 @@ class Variable:
@staticmethod
def get_variable_type(variable_name):
if not variable_name in Variable.VARIABLE_TYPES:
if len(variable_name) == 0:
return "Unknown"
return Variable.VARIABLE_TYPES[variable_name]
if not variable_name[0] in Variable.VARIABLE_TYPES:
return "Unknown"
return Variable.VARIABLE_TYPES[variable_name[0]]