L'exemple suivant permet de simuler le dialogue entre un policier et un passant :
Policier | : | Quel est votre nom ? | ?xq |
Passant | : | Cela ne vous regarde pas ! |
![]() |
Policier | : | Je suis policier ! | !xp(x) |
Passant | : | Je m'appelle Dupond. | !yq |
Dans cet exemple le dialogue est instancié de la manière suivante :
x | = | Policier |
y | = | Passant |
q | = | Un renseignement |
Azp | = | << L'agent z est autorisé à p >> |
p(z) | = | << L'agent z est policier >> |
Ici, le jeu réponse est différent. Pour obtenir une réponse, il faut être autorisé à poser la question. Le jeu réponse n'est donc activable qu'à cette condition. Dans le cas où l'autorisation n'est pas prouvée, c'est un jeu mefiance qui sera activé. Dans ce jeu, l'agent ne fait qu'exprimer sa méfiance mais ne donne aucune information. Nous avons aussi besoin d'un jeu conflit qui est activé en cas de conflit entre les croyances d'un agent et des croyances qu'il a de l'autre agent.
/*************************************************************/ /* */ /* Exemple de jeux */ /* */ /*************************************************************/ game jeu_de_base = { perception = { C => x b (C:t) | C\=($ _) }, update = { x b (y ? Q:_) => x b y w y kif Q, x b (y ! P:_) => x b y b P, x b (y ! P:_) and x w x kif P => x b P, x b P => -(x b -P), x b (y ! P:_) => x b y b x a x kif P }, generation = { -(x w _) and -(x b y w _) => $ x # 0.01 }, interdiction = { x b (C:T) => -C | T<t # 100 } }. game question(Q) = { import jeu_de_base, entrance = x w x kif Q, invariant = x w x kif Q, exit = x kif Q, generation = { x w x kif Q => x ? Q # 10 }, update = { x kif Q => -(x w x kif Q) } }. game reponse(Q) = { import jeu_de_base, entrance = x b y w y kif Q and x b y a y kif Q, invariant = x b y w y kif Q, exit = x b y kif Q, generation = { x b Q => x ! Q # 10, -(x b Q) => x '!?' Q }, update = { x b (P->Q) and -(x kif P) => x w x kif P, x b y kif Q => -(x b y w y kif Q), x b (x ! P:_) and x b y w y kif P => x b y b P } }. game conflit(Q) = { import jeu_de_base, entrance = x b y b -Q and x b Q, invariant = x b y b -Q and x b Q, exit = x b y b Q or x b -Q, generation = { x b (P->Q) => x ! P # 100, x b (P->Q) => x ! (P->Q), x b Q => x ! Q }, update = { x b y b Q => -(x b y b -Q), x b -Q => -(x b Q) } }. game mefiance(Q) = { import jeu_de_base, entrance = x b y w Q and -(x b y a Q), invariant = x b y w Q and -(x b y a Q), exit = x b y a Q or -(x b y w Q), update = { x b (y ! P:_) and x b (P -> (y a Q)) => x b P, -(x b y a Q) => x w x kif y a Q }, generation = { -(x b y a Q) => x ! -(y a Q) } }. agent agent_de_base(PROF) = { start = jeu_de_base, games = { question(_), reponse(_) }, depth = PROF, kb = { nonvar(Q) | x b (P->Q) and x b P then x b Q, nonvar(P) | x b (P->Q) and x b -Q then x b -P, x b (p(X)->(X a Q)), nonvar(P) | (x b P) or (x b -P) then x kif P } }. agent agent_evolue(PROF) = { import agent_de_base(PROF), kb = { x b p(a1) } }. agent a1 = { import agent_de_base(1), accointance = agent_de_base(1), games = { conflit(_) }, kb = { x w x kif q, x b p(x) } }. agent a2 = { import agent_de_base(1), games = { mefiance(_) }, kb= { x b q } }. a1 and a2 are speaking. ÿ
Les états mentaux marqués en gras sont ceux qui nous intéressent ici. A chaque étape, on ne reprend pas la totalité des bases de connaissances, mais uniquement les états qui changent.
Remarquons tout d'abord qu'après chaque coup, les agents croient en la réussite du coup (*).
La première ligne du tableau contient les bases de connaissances des agents. Dans cet état, l'agent a1 rentre dans le jeu question(q) (1). L'agent a2 perçoit bien la question mais ne sait pas si a1 est autorisé à savoir si qdonc il ne peut que rentrer dans un jeu de mefiance(KIFa1q) (2). L'agent a1 croit alors que a2 ne sait pas qu'il est policier (3) et doit donc jouer un jeu correction(Aa1KIFa1q) (4). Un moyen de justifier cela, est de dire qu'il est policier (5). Donc a2 croit que a1 est policier, donc autorisé (6). Il sort du jeu méfiance (7) et rentre cette fois dans le jeu reponse(q) (8) (9).