summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modeling/prod_addition.py3
-rw-r--r--modeling/prod_multi.py41
-rw-r--r--modeling/productions_math.py6
3 files changed, 28 insertions, 22 deletions
diff --git a/modeling/prod_addition.py b/modeling/prod_addition.py
index a56fc73..27a0bcd 100644
--- a/modeling/prod_addition.py
+++ b/modeling/prod_addition.py
@@ -250,6 +250,7 @@ def addition(Model):
isa math_goal
tens_ans =result
ones_carry None
+ ~retrieval>
""",
)
prods.append(add_tens_carry_done)
@@ -443,6 +444,8 @@ def addition(Model):
=g>
isa math_goal
op done
+ ones_carry None
+ tens_carry None
~retrieval>
""",
)
diff --git a/modeling/prod_multi.py b/modeling/prod_multi.py
index 9b55f2a..88c5eed 100644
--- a/modeling/prod_multi.py
+++ b/modeling/prod_multi.py
@@ -123,6 +123,7 @@ def multiplication(Model):
=g>
isa math_goal
mul_counter =counted
+ ~retrieval>
+retrieval>
isa math_op
op add
@@ -149,47 +150,45 @@ def multiplication(Model):
==>
=g>
isa math_goal
- nextop mul
+ nextop mul_fail
op add
arg1 =arg
arg2 =result
+ mem_arg1 =mul
+ mem_arg2 =arg
ones1 None
tens1 None
hundreds1 None
ones2 None
tens2 None
hundreds2 None
- +retrieval>
- isa math_op
- op add
- arg1 =mul_counter
- arg2 1
+ ones_ans None
+ tens_ans None
+ hundreds_ans None
+ result None
+ ~retrieval>
""",
)
- mul_step_failure_return = Model.productionstring(
- name="mul_step_failure_return",
+ # instead of remembering original mult args, maybe should
+ # start from the beginning, with the addition results now
+ # retrievable
+ mul_step_addition_return = Model.productionstring(
+ name="mul_step_addition_return",
string="""
=g>
isa math_goal
- op mul
- arg1 =mul
- arg2 =arg
- ones2 =ones
- tens2 =tens
- hundreds2 =huns
+ op mul_fail
mul_counter =mul_counter
result =result
- =retrieval>
- isa math_op
- op add
- arg1 =arg
- arg2 =result
- result =sum
+ mem_arg1 =mem_arg1
+ mem_arg2 =mem_arg2
==>
=g>
isa math_goal
- result =sum
+ op mul
+ arg1 =mem_arg1
+ arg2 =mem_arg2
+retrieval>
isa math_op
op add
diff --git a/modeling/productions_math.py b/modeling/productions_math.py
index 5687ba9..ca7d95a 100644
--- a/modeling/productions_math.py
+++ b/modeling/productions_math.py
@@ -66,6 +66,8 @@ def init():
"tens_ans",
"ones_ans",
"mul_counter",
+ "mem_arg1",
+ "mem_arg2",
"ones_carry",
"tens_carry",
"vis_counter",
@@ -137,6 +139,8 @@ def init():
# result=min(i, j),
# )
# )
+ for i in range(0, 21):
+ for j in range(0, 21):
DM.add(
actr.makechunk(
f"plus{i}{j}", "math_op", op="add", arg1=i, arg2=j, result=i + j
@@ -215,7 +219,7 @@ def start():
# sim.step()
# if sim.current_event.action == "KEY PRESSED: SPACE":
# break
- sim.run(max_time=8)
+ sim.run(max_time=25)
print("Simulation time: ", sim.show_time())
print("goal: ", goal)
# print(list(env))