diff options
Diffstat (limited to 'modeling/productions_math.py')
-rw-r--r-- | modeling/productions_math.py | 131 |
1 files changed, 126 insertions, 5 deletions
diff --git a/modeling/productions_math.py b/modeling/productions_math.py index 5e490a3..b1c131b 100644 --- a/modeling/productions_math.py +++ b/modeling/productions_math.py @@ -37,14 +37,14 @@ imaginal.add( "", "math_op", op="add", - arg1=39, - arg2=59, + arg1=249, + arg2=159, ones1=9, tens1=3, - hundreds1=0, + hundreds1=2, ones2=9, tens2=5, - hundreds2=0, + hundreds2=1, ) ) @@ -358,9 +358,130 @@ def addition(): arg2 =sum """, ) - prods.append(add_tens_carry) + + process_carry_tens = Model.productionstring( + name="process_carry_tens", + string=""" + =g> + isa math_goal + task calc + =imaginal> + isa math_op + op add + hundreds1 =num1 + hundreds2 =num2 + carry_tens busy + tens_ans =tens + =retrieval> + isa math_op + op add + arg1 10 + result =tens + arg2 =remainder + ==> + =imaginal> + isa math_op + op add + carry_tens 1 + hundreds_ans busy + tens_ans =remainder + +retrieval> + isa math_op + op add + arg1 =num1 + arg2 =num2 + """, + ) + prods.append(process_carry_tens) + + no_carry_tens = Model.productionstring( + name="no_carry_tens", + string=""" + =g> + isa math_goal + task calc + =imaginal> + isa math_op + op add + hundreds1 =num1 + hundreds2 =num2 + tens_ans =tens + carry_tens busy + ?retrieval> + state error + ==> + =imaginal> + isa math_op + carry_tens None + hundreds_ans busy + +retrieval> + isa math_op + arg1 =num1 + arg2 =num2 + """, + ) + prods.append(no_carry_tens) + + add_hundreds_done = Model.productionstring( + name="add_tens_done", + string=""" + =g> + isa math_goal + task calc + =imaginal> + isa math_op + op add + hundreds_ans busy + carry_tens None + =retrieval> + isa math_op + op add + result =sum + ==> + =g> + isa math_goal + task done + =imaginal> + isa math_op + hundreds_ans =sum + """, + ) + prods.append(add_hundreds_done) + + add_hundreds_carry = Model.productionstring( + name="add_hundreds_carry", + string=""" + =g> + isa math_goal + task calc + =imaginal> + isa math_op + op add + hundreds_ans busy + hundreds1 =num1 + hundreds2 =num2 + carry_tens 1 + =retrieval> + isa math_op + op add + result =sum + arg1 =num1 + arg2 =num2 + ==> + =imaginal> + isa math_op + carry_tens None + ~retrieval> + +retrieval> + isa math_op + op add + arg1 1 + arg2 =sum + """, + ) + prods.append(add_hundreds_carry) # addition_done = Model.productionstring( # name="addition_done", # string=""" |