Tested the Factor Engine, first round of testing passed. Fixed a bug in the JSON_Generator to stop expression variables from being added in reverse.

This commit is contained in:
2020-04-20 00:49:32 -05:00
parent 08bb51d68e
commit 7507db75b3
4 changed files with 16 additions and 8 deletions
+6 -2
View File
@@ -6,7 +6,7 @@ import factors
import jsonpickle
import itertools
base_list = [2, 4, 6, 12]
base_list = [1, 2, 4, 6, 12]
#fileLocation = input('File Path to JSON: ')
#json = json.loads(open(fileLocation).read())
@@ -45,4 +45,8 @@ res = list(itertools.product(*ls))
for r in res:
t = tokenizer.replace_variables(tokens, list(r))
#tokenizer.print_token_list(t)
print("Results %f" %(calc_engine.calculate_results(t)))
result = calc_engine.calculate_results(t)
tol = (exp.wrong_response * .01 + exp.wrong_response)
if result <= tol and result >= (exp.wrong_response - exp.wrong_response * .01):
print("Result: %s for expression: " %(format(result, ".8f")))
tokenizer.print_token_list(t)