-
Notifications
You must be signed in to change notification settings - Fork 1
/
monkeyProblem.py
executable file
·52 lines (44 loc) · 1.41 KB
/
monkeyProblem.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
from rbs.stateMachineClass import FSAHelperFunctions
from rbs.nealCoverClass import NealCoverFunctions
from rbs.narcBuilder import NeuralCognitiveArchitectureBuilder
class MonekyProblem:
def __init__(self, sim, simulator):
self.neal = NealCoverFunctions(simulator, sim)
self.fsa = FSAHelperFunctions(simulator, sim, self.neal)
self.narc = NeuralCognitiveArchitectureBuilder(simulator, sim, self.fsa, self.neal).build()
self.narc.addRule(
"eatFruit",
[
(True, "monkey-has", ("?type",), "a")
],
[
("assert", ("monkey-ate", ("?type",))),
("retract", "a")
]
)
self.narc.addRule(
"monkeyHasFruit",
[
(True, "chairAt", ("?pos",), "a"),
(True, "fruit", ("?type","?pos"),"b")
],
[
("assert",("monkey-has", ("?type",))),
("retract", "b")
]
)
self.narc.addRule(
"pushChair",
# if
[
(True, "fruit", ("?","?pos"), "a"),
(False, "chairAt", ("?pos",), "b")
],
# then
[
("assert", ("chairAt", ("?pos",))),
("retract", "b")
]
)
def printSpikes(self):
self.narc.printSpikes()