summaryrefslogtreecommitdiff
path: root/modeling/addition.py
blob: a32adbaed018e2c6d3e7657fbfaafa31131ad854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3

import pyactr as actr


addition = actr.ACTRModel()
actr.chunktype("countOrder", ("first", "second"))
actr.chunktype("add", ("arg1", "arg2", "sum", "count"))

dm = addition.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))

addition.productionstring(
    name="init_addition",
    string="""
    =g>
    isa     add
    arg1    =num1
    arg2    =num2
    sum     None
    ==>
    =g>
    isa     add
    sum     =num1
    count   0
    +retrieval>
    isa     countOrder
    first   =num1
""",
)