diff options
Diffstat (limited to 'modeling/addition.py')
-rw-r--r-- | modeling/addition.py | 65 |
1 files changed, 61 insertions, 4 deletions
diff --git a/modeling/addition.py b/modeling/addition.py index a32adba..5e83acc 100644 --- a/modeling/addition.py +++ b/modeling/addition.py @@ -3,18 +3,18 @@ import pyactr as actr -addition = actr.ACTRModel() +Model = actr.ACTRModel() actr.chunktype("countOrder", ("first", "second")) actr.chunktype("add", ("arg1", "arg2", "sum", "count")) -dm = addition.decmem +dm = Model.decmem for i in range(0, 11): dm.add(actr.makechunk("chunk" + str(i), "countOrder", first=i, second=i + 1)) -addition.goal.add(actr.makechunk("", "add", arg1=5, arg2=2)) +Model.goal.add(actr.makechunk("", "add", arg1=5, arg2=2)) -addition.productionstring( +Model.productionstring( name="init_addition", string=""" =g> @@ -32,3 +32,60 @@ addition.productionstring( first =num1 """, ) + +Model.productionstring( + name="terminate_addition", + string=""" + =g> + isa add + count =num + arg2 =num + sum =answer + ==> + ~g>""", +) + +Model.productionstring( + name="increment_count", + string=""" + =g> + isa add + count =count + sum =sum + =retrieval> + isa countOrder + first =count + second =newcount + ==> + =g> + isa add + count =newcount + +retrieval> + isa countOrder + first =sum""", +) + +Model.productionstring( + name="increment_sum", + string=""" + =g> + isa add + count =count + arg2 ~=count + sum =sum + =retrieval> + isa countOrder + first =sum + second =newsum + ==> + =g> + isa add + sum =newsum + +retrieval> + isa countOrder + first =count""", +) + +if __name__ == "__main__": + x = Model.simulation() + x.run() |