summaryrefslogtreecommitdiff
path: root/modeling/productions_math.py
diff options
context:
space:
mode:
Diffstat (limited to 'modeling/productions_math.py')
-rw-r--r--modeling/productions_math.py165
1 files changed, 71 insertions, 94 deletions
diff --git a/modeling/productions_math.py b/modeling/productions_math.py
index 7ac1257..f824466 100644
--- a/modeling/productions_math.py
+++ b/modeling/productions_math.py
@@ -20,23 +20,6 @@ def add_goal(goal, op, arg1, arg2):
goal.add(actr.makechunk("", "math_goal", op=op, task=op, arg1=arg1, arg2=arg2))
-def general_prod(Model):
-
- Model.productionstring(
- name="continue_with_next_op",
- string="""
- =g>
- isa math_goal
- op done
- nextop ~None
- nextop =nextop
- ==>
- =g>
- isa math_goal
- op =nextop
- nextop None
- """,
- )
def wait_input():
@@ -48,88 +31,82 @@ def wait_input():
def add_proc(goal, proc):
# input()
- goal.add(actr.makechunk("", "math_goal", proc=proc, ones_carry="hello"))
+ goal.add(actr.makechunk("", "math_goal", proc=proc, ones_carry=""))
def start():
- loop = True
- while loop:
- loop = False
- # op, arg1, arg2 = wait_input()
- Model, DM, goal, imaginal, env = init()
- # add_goal(goal, op, arg1, arg2)
- add_proc(goal, "proc1")
- envs = model_env.generate_environments()
-
- general_prod(Model)
- prod_procedure.procedures(Model)
- number_prods = prod_numbers.number(Model)
- add_prods = prod_addition.addition(Model)
- sub_prods = prod_subtraction.subtraction(Model)
- greater_prods = prod_comp.greater_than(Model)
- less_prods = prod_comp.lesser_than(Model)
- multi_prods = prod_multi.multiplication(Model)
- motor_prods = prod_motor.procedures(Model)
- visual_prods = prod_vis.procedures(Model)
-
- # for prod in multi_prods:
- # print(prod)
- # print("\n")
-
- print("goal: ", goal)
- # print("imaginal: ", imaginal)
- sim = Model.simulation(
- gui=False,
- environment_process=env.environment_process,
- stimuli=envs,
- # triggers="space",
- triggers="b",
- )
- i = 1
- userinput = ""
- while True:
- sim.step()
- if sim.current_event.time >= 50:
- print(sim.current_event)
- break
- if "KEY PRESSED" in sim.current_event.action:
- userinput = userinput + sim.current_event.action.split(":")[1]
- # if sim.current_event.action == "NO RULE FOUND":
- # print(goal)
- if sim.current_event.action == "KEY PRESSED: SPACE":
- sim._Simulation__env.stimulus["Answer5"]["text"] = "99"
- i += 1
- print(userinput)
- print("NEW PROC")
- if i <= 6:
- goal.add(
- actr.makechunk(
- "", "math_goal", proc=f"proc{i}", ones_carry="hello"
- )
+ condition = "fixed"
+
+ # op, arg1, arg2 = wait_input()
+ Model, DM, goal, imaginal, env = init()
+ # add_goal(goal, op, arg1, arg2)
+ add_proc(goal, "proc1")
+ envs = model_env.generate_environments()
+
+ prod_procedure.procedures(Model)
+ number_prods = prod_numbers.number(Model)
+ add_prods = prod_addition.addition(Model)
+ sub_prods = prod_subtraction.subtraction(Model)
+ greater_prods = prod_comp.greater_than(Model)
+ less_prods = prod_comp.lesser_than(Model)
+ multi_prods = prod_multi.multiplication(Model)
+ motor_prods = prod_motor.procedures(Model)
+ visual_prods = prod_vis.procedures(Model)
+
+ print("goal: ", goal)
+ # print("imaginal: ", imaginal)
+ sim = Model.simulation(
+ gui=False,
+ environment_process=env.environment_process,
+ stimuli=envs,
+ # triggers="space",
+ triggers="b",
+ )
+ i = 1
+ userinput = ""
+ while True:
+ sim.step()
+ if sim.current_event.time >= 50:
+ print(sim.current_event)
+ break
+ if "KEY PRESSED" in sim.current_event.action:
+ userinput = userinput + sim.current_event.action.split(":")[1]
+ # if sim.current_event.action == "NO RULE FOUND":
+ # print(goal)
+ if sim.current_event.action == "KEY PRESSED: SPACE":
+ sim._Simulation__env.stimulus["Answer5"]["text"] = "99"
+ i += 1
+ print(userinput)
+ print("NEW PROC")
+ if i <= 6:
+ goal.add(
+ actr.makechunk(
+ "", "math_goal", proc=f"proc{i}", ones_carry="hello"
)
- elif i == 7:
- goal.add(
- actr.makechunk(
- "", "math_goal", proc="proc_overall", ones_carry="hello"
- )
+ )
+ elif i == 7:
+ goal.add(
+ actr.makechunk(
+ "", "math_goal", proc="proc_overall", ones_carry="hello"
)
- elif i > 7:
- print("DONE")
- break
-
- # sim.run(max_time=25)
- print(userinput)
- print("Simulation time: ", sim.show_time())
- print("goal: ", goal)
- print(sim.current_event)
- pprint(vars(sim))
- pprint(vars(sim._Simulation__env))
- # print(sim.__env)
- # sim.__printenv__()
- # print(envs.stimulus)
- # print("imaginal: ", imaginal)
- math_goals = [sim for sim in list(DM) if sim.typename == "procedure"]
- # print(math_goals)
+ )
+ elif i > 7:
+ print("DONE")
+ break
+
+ # sim.run(max_time=25)
+ print(userinput)
+ print("Simulation time: ", sim.show_time())
+ print("goal: ", goal)
+ print(sim.current_event)
+ pprint(vars(sim))
+ pprint(vars(sim._Simulation__env))
+ # print(sim.__env)
+ # sim.__printenv__()
+ # print(envs.stimulus)
+ # print("imaginal: ", imaginal)
+ math_goals = [sim for sim in list(DM) if sim.typename == "procedure"]
+ # print(math_goals)
if __name__ == "__main__":