Skip to content

Commit

Permalink
Change to English the control example.
Browse files Browse the repository at this point in the history
  • Loading branch information
serfrape committed Jun 17, 2019
1 parent 94bf57a commit e2cf5bf
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 29 deletions.
14 changes: 7 additions & 7 deletions examples/control.py
Expand Up @@ -21,18 +21,18 @@ class Modify(PeriodicBehaviour):
async def run(self):
if self.agent.bdi_enabled:
try:
tipo = self.agent.bdi.get_belief_value("tipo")[0]
if tipo == 'inc':
self.agent.bdi.set_belief('tipo', 'dec')
count_type = self.agent.bdi.get_belief_value("type")[0]
if count_type == 'inc':
self.agent.bdi.set_belief('type', 'dec')
else:
self.agent.bdi.set_belief('tipo', 'inc')
self.agent.bdi.set_belief('type', 'inc')
except Exception as e:
self.kill()

class Behav4(TimeoutBehaviour):
async def run(self):
self.agent.bdi.remove_belief('tipo', 'inc')
self.agent.bdi.remove_belief('tipo', 'dec')
self.agent.bdi.remove_belief('type', 'inc')
self.agent.bdi.remove_belief('type', 'dec')


def main(server, password):
Expand All @@ -49,7 +49,7 @@ def main(server, password):
a = MasterAgent("master@{}".format(server), password, "master.asl")
a.bdi.set_belief("slave1", "slave_1@{}".format(server))
a.bdi.set_belief("slave2", "slave_2@{}".format(server))
a.bdi.set_belief('tipo', 'dec')
a.bdi.set_belief('type', 'dec')
future = a.start()
future.result()

Expand Down
22 changes: 11 additions & 11 deletions examples/master.asl
Expand Up @@ -5,30 +5,30 @@
-start;
!obj2.

+!obj2: tipo(inc)
+!obj2: type(inc)
<-
?slave1(X);
?slave2(Y);
.send(X, tell, incrementar(2));
.send(Y, tell, incrementar(5));
.send(X, tell, increase(2));
.send(Y, tell, increase(5));
.wait(2000);
!obj2.

+!obj2: tipo(dec)
+!obj2: type(dec)
<-
?slave1(X);
?slave2(Y);
.send(X, tell, decrementar(2));
.send(Y, tell, decrementar(5));
.send(X, tell, decrease(2));
.send(Y, tell, decrease(5));
.wait(2000);
!obj2.

+!obj2: not tipo(_)
+!obj2: not type(_)
<-
?slave1(X);
?slave2(Y);
.print("Finishing");
.send(X, untell, incrementar(2));
.send(Y, untell, incrementar(5));
.send(X, untell, decrementar(2));
.send(Y, untell, decrementar(5)).
.send(X, untell, increase(2));
.send(Y, untell, increase(5));
.send(X, untell, decrease(2));
.send(Y, untell, decrease(5)).
22 changes: 11 additions & 11 deletions examples/slave.asl
@@ -1,23 +1,23 @@
contador(0).
counter(0).

+incrementar(Inc)[source(S)]: master(M) & .substring(M,S,R)
+increase(Inc)[source(S)]: master(M) & .substring(M,S,R)
<-
.print("increasing");
?contador(X);
?counter(X);
.print(X);
-+contador(X+Inc).
-+counter(X+Inc).

+decrementar(Dec)[source(S)]: master(M) & .substring(M,S,R)
+decrease(Dec)[source(S)]: master(M) & .substring(M,S,R)
<-
.print("decreasing");
?contador(X);
?counter(X);
.print(X);
-+contador(X-Dec).
-+counter(X-Dec).

-incrementar(Inc)[source(S)]: master(M) & .substring(M,S,R)
-increase(Inc)[source(S)]: master(M) & .substring(M,S,R)
<-
.print("DELETING incrementar BELIEF from an untell message").
.print("DELETING increase BELIEF from an untell message").

-decrementar(Dec)[source(S)]: master(M) & .substring(M,S,R)
-decrease(Dec)[source(S)]: master(M) & .substring(M,S,R)
<-
.print("DELETING decrementar BELIEF from an untell message").
.print("DELETING decrease BELIEF from an untell message").

0 comments on commit e2cf5bf

Please sign in to comment.