Updated the Factor class with a new utility function. Fixed a few small bugs in it as well.

This commit is contained in:
2020-04-19 23:49:27 -05:00
parent ca47912d05
commit 0d7fe94942
2 changed files with 34 additions and 7 deletions
+12 -5
View File
@@ -4,6 +4,7 @@ import expression
import calc_engine
import factors
import jsonpickle
import itertools
base_list = [2, 4, 6, 12]
@@ -16,7 +17,6 @@ base_list = [2, 4, 6, 12]
with open("expression.json", "r") as f:
#j = json.load(f)
exp = jsonpickle.decode(f.read())
print(exp)
#results = calc_engine.calculate_results(tokens.copy())
#print(results)
@@ -28,9 +28,16 @@ tokens = tokenizer.get_tokens_from_expression_string(exp.expression)
for v in exp.variables:
factor = factors.Factor(v, base_list)
calce_answers(factor, exp.variables[v].starting_point, exp.variables[v].type, exp.wrong_response)
if exp.variables[v].type == "Interest":
factor.calculate_factors(exp.variables[v].starting_point, True, True)
else:
factor.calculate_factors(exp.variables[v].starting_point)
#for result in calc_answers(f, m):
calc_answers(factor, exp.variables[v].starting_point, exp.variables[v].type, exp.wrong_response)
#def calc_answers(factor_object, starting_point, variable_type, wrong_response):
def calc_answers(factor_object, starting_point, variable_type, wrong_response):
pass