2021-12-04 08:47:10 +00:00
|
|
|
module Game2PetriNet;
|
|
|
|
create OUT: petrinet from IN: game;
|
|
|
|
|
|
|
|
|
2021-12-09 15:39:41 +00:00
|
|
|
|
|
|
|
|
2022-01-18 08:20:03 +00:00
|
|
|
helper context String
|
2021-12-09 15:39:41 +00:00
|
|
|
def: getJeu() : game!Jeu =
|
|
|
|
game!Jeu.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
2022-01-16 13:05:58 +00:00
|
|
|
helper context String
|
|
|
|
def: getTaille() : Integer =
|
|
|
|
game!Objet.allInstances()
|
|
|
|
->asSequence()
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(o | o.name = self)
|
2022-01-16 13:05:58 +00:00
|
|
|
->first().taille;
|
|
|
|
|
2021-12-09 15:39:41 +00:00
|
|
|
helper context game!Lieu
|
|
|
|
def : estDepart() : Integer =
|
|
|
|
self.depart.condition
|
|
|
|
->select(ce | ce.conditionTest
|
|
|
|
->select(ct | ct.oclIsTypeOf(game!ConditionBoolean))
|
|
|
|
->select(ct | ct.valeur = 'true')
|
|
|
|
->size() > 0)
|
|
|
|
->size();
|
|
|
|
|
|
|
|
-- Obtenir la taille de l'explorateur
|
2022-01-16 13:05:58 +00:00
|
|
|
helper context String
|
2021-12-09 15:39:41 +00:00
|
|
|
def: getTailleExp() : Integer =
|
|
|
|
game!Explorateur.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->first().tailleInventaire;
|
|
|
|
|
2022-01-16 13:05:58 +00:00
|
|
|
helper context String
|
|
|
|
def: getTransition() : petrinet!Transition =
|
|
|
|
petrinet!Transition.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->select(t | t.name = self)
|
|
|
|
->first();
|
|
|
|
|
2021-12-09 15:39:41 +00:00
|
|
|
-- Nombre d'objets initiaux de l'explo
|
|
|
|
helper context game!Objet
|
|
|
|
def : getNombreInit() : Integer =
|
|
|
|
game!Explorateur.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->first().objets
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(o | o.name = self.name)
|
2021-12-09 15:39:41 +00:00
|
|
|
->size();
|
|
|
|
|
|
|
|
-- Nombre de connaissances initiaux de l'explo
|
|
|
|
helper context game!Connaissance
|
|
|
|
def : getNombreInit() : Integer =
|
|
|
|
game!Explorateur.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->first().connaissances
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(c | c.name = self.name)
|
2021-12-09 15:39:41 +00:00
|
|
|
->size();
|
|
|
|
|
|
|
|
-- Nombre de place libre itiale de l'explo
|
|
|
|
helper context game!Explorateur
|
|
|
|
def : getNombreInit() : Integer =
|
|
|
|
game!Objet.allInstances()
|
|
|
|
->asSequence()
|
|
|
|
->iterate(o; res : Integer = self.tailleInventaire | res - o.getNombreInit() * o.taille);
|
|
|
|
|
|
|
|
|
|
|
|
helper context game!Lieu
|
|
|
|
def: getPlace(): petrinet!Place =
|
|
|
|
petrinet!Place.allInstances()
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(p | p.name = 'lieu_' + self.name)
|
2021-12-09 15:39:41 +00:00
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
2022-01-16 13:05:58 +00:00
|
|
|
helper context game!Interaction
|
|
|
|
def: getPersonne(): game!Personne =
|
|
|
|
game!Personne.allInstances()
|
|
|
|
->select(p | (p.interactions
|
|
|
|
->select(i | i = self)
|
|
|
|
->size()
|
|
|
|
) > 0)
|
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
2021-12-10 16:58:42 +00:00
|
|
|
helper context String
|
|
|
|
def : getObjet() : game!Objet =
|
|
|
|
game!Objet.allInstances()
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(o | o.name = self)
|
2021-12-10 16:58:42 +00:00
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
2021-12-09 15:39:41 +00:00
|
|
|
helper context game!Personne
|
|
|
|
def: getLieu(): game!Lieu =
|
|
|
|
game!Lieu.allInstances()
|
|
|
|
->select(l | l.personnes
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(p | p.name = self.name)
|
2021-12-09 15:39:41 +00:00
|
|
|
->asSequence()
|
|
|
|
->size() > 0)
|
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
|
|
|
helper context game!Action
|
|
|
|
def : getInteraction() : game!Interaction =
|
|
|
|
game!Interaction.allInstances()
|
|
|
|
->select(i | i.actions
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(a | a.name = self.name)
|
2021-12-09 15:39:41 +00:00
|
|
|
->asSequence()
|
|
|
|
->size() > 0)
|
|
|
|
->asSequence()
|
|
|
|
->first();
|
|
|
|
|
2022-01-18 08:20:03 +00:00
|
|
|
helper context String
|
|
|
|
def : getPlace() : petrinet!Place =
|
2021-12-10 14:31:43 +00:00
|
|
|
petrinet!Place.allInstances()
|
2022-01-18 08:20:03 +00:00
|
|
|
->select(p | p.name = self)
|
2021-12-10 14:31:43 +00:00
|
|
|
->asSequence()
|
|
|
|
->first();
|
2021-12-09 15:39:41 +00:00
|
|
|
|
2021-12-04 08:47:10 +00:00
|
|
|
|
|
|
|
rule Game2PetriNet {
|
|
|
|
from p: game!Jeu
|
|
|
|
to pn: petrinet!Network (name <- 'jeu')
|
|
|
|
}
|
|
|
|
|
2021-12-09 15:39:41 +00:00
|
|
|
rule Explorateur2Petrinet {
|
|
|
|
from e: game!Explorateur
|
|
|
|
to
|
|
|
|
p: petrinet!Place(
|
|
|
|
name <- 'taille',
|
|
|
|
tokens <- e.getNombreInit(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu())
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Objet2PetriNet {
|
|
|
|
from o: game!Objet
|
|
|
|
to
|
|
|
|
p_obj: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'objet_' + o.name,
|
2021-12-09 15:39:41 +00:00
|
|
|
tokens <- o.getNombreInit(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu()),
|
2021-12-09 15:39:41 +00:00
|
|
|
|
|
|
|
p_objneg: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'objet_' + o.name + '_neg',
|
2022-01-16 13:05:58 +00:00
|
|
|
tokens <- ''.getTailleExp() div o.taille - o.getNombreInit(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu())
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Connaissance2PetriNet {
|
|
|
|
from c: game!Connaissance
|
|
|
|
to
|
|
|
|
p_con: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'connaissance_' + c.name,
|
2021-12-09 15:39:41 +00:00
|
|
|
tokens <- c.getNombreInit(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu()),
|
2021-12-09 15:39:41 +00:00
|
|
|
|
|
|
|
p_conneg: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'connaissance_' + c.name + '_neg',
|
2021-12-09 15:39:41 +00:00
|
|
|
tokens <- 1 - c.getNombreInit(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu())
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Personne2PetriNet {
|
|
|
|
from p: game!Personne
|
|
|
|
to
|
|
|
|
pers: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'personne_' + p.name,
|
2021-12-09 15:39:41 +00:00
|
|
|
tokens <- 0,
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu())
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
2021-12-04 08:47:10 +00:00
|
|
|
rule Lieu2PetriNet {
|
|
|
|
from l: game!Lieu
|
|
|
|
to
|
|
|
|
p: petrinet!Place(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'lieu_' + l.name,
|
2021-12-09 15:39:41 +00:00
|
|
|
tokens <- l.estDepart(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu())
|
2021-12-04 08:47:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Chemin2PetriNet {
|
|
|
|
from c: game!Chemin
|
2022-01-18 08:20:03 +00:00
|
|
|
using {
|
|
|
|
index : Integer = 0;
|
|
|
|
}
|
|
|
|
do {
|
|
|
|
index <- 0;
|
|
|
|
for (condVis in c.visible.condition) {
|
|
|
|
for (condOuv in c.ouvert.condition) {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.newChemin(c, index, condVis.conditionTest.union(condOuv.conditionTest));
|
2022-01-18 08:20:03 +00:00
|
|
|
index <- index + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule newChemin(c : game!Chemin, index : Integer, conditions : game!ConditionTest) {
|
2021-12-04 08:47:10 +00:00
|
|
|
to
|
|
|
|
t: petrinet!Transition(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'chemin_' + c.name + '_' + index.toString(),
|
|
|
|
network <- ''.getJeu()),
|
2021-12-09 15:39:41 +00:00
|
|
|
|
2021-12-04 08:47:10 +00:00
|
|
|
arcIn: petrinet!Arc(
|
2022-01-18 11:08:49 +00:00
|
|
|
place <- ('lieu_' + c.lieuIn.name).getPlace(),
|
2021-12-04 08:47:10 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
2021-12-09 15:39:41 +00:00
|
|
|
|
2021-12-04 08:47:10 +00:00
|
|
|
arcOut: petrinet!Arc(
|
2022-01-18 11:08:49 +00:00
|
|
|
place <- ('lieu_' + c.lieuOut.name).getPlace(),
|
2021-12-04 08:47:10 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1)
|
2021-12-10 16:58:42 +00:00
|
|
|
do {
|
|
|
|
for (o in c.objetsConso) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.consoObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
for (o in c.objetsRecus) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.recuObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
for (con in c.connaissances) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.recuConn(t, con.name);
|
2022-01-16 13:05:58 +00:00
|
|
|
}
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.Condition2PetriNet(t, conditions);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Interaction2PetriNet {
|
|
|
|
from i: game!Interaction
|
2022-01-18 08:20:03 +00:00
|
|
|
using {
|
|
|
|
index : Integer = 0;
|
|
|
|
}
|
2022-01-18 11:08:49 +00:00
|
|
|
do {
|
|
|
|
index <- 0;
|
|
|
|
for (condVis in i.getPersonne().visible.condition) {
|
|
|
|
thisModule.newInteraction(i, index, condVis.conditionTest);
|
|
|
|
index <- index + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule newInteraction(i : game!Interaction, index : Integer, conditions : game!ConditionTest) {
|
2021-12-09 15:39:41 +00:00
|
|
|
to
|
|
|
|
t: petrinet!Transition(
|
2022-01-18 11:08:49 +00:00
|
|
|
name <- 'interaction_' + i.name + '_' + i.getPersonne().name + '_' + index.toString(),
|
2022-01-18 08:20:03 +00:00
|
|
|
network <- ''.getJeu()),
|
2022-01-18 11:08:49 +00:00
|
|
|
|
|
|
|
arcIn: petrinet!Arc(
|
|
|
|
place <- ('personne_' + i.getPersonne().name).getPlace(),
|
2021-12-09 15:39:41 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1),
|
2022-01-18 11:08:49 +00:00
|
|
|
|
|
|
|
arcOut: petrinet!Arc(
|
|
|
|
place <- ('lieu_' + i.getPersonne().getLieu().name).getPlace(),
|
2021-12-09 15:39:41 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1)
|
2021-12-10 16:58:42 +00:00
|
|
|
do {
|
|
|
|
for (o in i.objetsConso) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.consoObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
for (o in i.objetsRecus) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.recuObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
2022-01-18 11:08:49 +00:00
|
|
|
for (con in i.connaissances) {
|
|
|
|
thisModule.recuConn(t, con.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.Condition2PetriNet(t, conditions);
|
2022-01-18 08:20:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-18 11:08:49 +00:00
|
|
|
|
2022-01-18 08:20:03 +00:00
|
|
|
rule Condition2PetriNet(t : petrinet!Transition, c : game!Condition) {
|
|
|
|
do {
|
|
|
|
for (cond in c) {
|
|
|
|
if (cond.oclIsKindOf(game!ConditionObjet)) {
|
|
|
|
if (cond.comparateur = '==') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readObjetEga(t, cond.objet.name, cond.nombre);
|
2022-01-18 08:20:03 +00:00
|
|
|
} else if (cond.comparateur = '>') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readObjetSup(t, cond.objet.name, cond.nombre);
|
2022-01-18 08:20:03 +00:00
|
|
|
} else if (cond.comparateur = '>=') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readObjetSup(t, cond.objet.name, cond.nombre - 1);
|
2022-01-18 08:20:03 +00:00
|
|
|
} else if (cond.comparateur = '<') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readObjetInf(t, cond.objet.name, cond.nombre);
|
2022-01-18 08:20:03 +00:00
|
|
|
} else if (cond.comparateur = '<=') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readObjetInf(t, cond.objet.name, cond.nombre + 1);
|
2022-01-18 08:20:03 +00:00
|
|
|
}
|
2022-01-18 11:08:49 +00:00
|
|
|
} else if (cond.oclIsKindOf(game!ConditionConnaissance)) {
|
2022-01-18 08:20:03 +00:00
|
|
|
if (cond.negation = '!') {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readConnNeg(t, cond.connaissance.name);
|
2022-01-16 13:05:58 +00:00
|
|
|
} else {
|
2022-01-18 11:08:49 +00:00
|
|
|
thisModule.readConn(t, cond.connaissance.name);
|
2022-01-16 13:05:58 +00:00
|
|
|
}
|
2022-01-18 11:08:49 +00:00
|
|
|
} else {
|
2022-01-16 13:05:58 +00:00
|
|
|
}
|
|
|
|
}
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule Action2PetriNet {
|
|
|
|
from a: game!Action
|
2022-01-18 11:08:49 +00:00
|
|
|
using {
|
|
|
|
index : Integer = 0;
|
|
|
|
}
|
|
|
|
do {
|
|
|
|
index <- 0;
|
|
|
|
for (condVis in a.visible.condition) {
|
|
|
|
thisModule.newAction(a, index, condVis.conditionTest);
|
|
|
|
index <- index + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule newAction(a : game!Action, index : Integer, conditions : game!ConditionTest) {
|
2021-12-09 15:39:41 +00:00
|
|
|
to
|
|
|
|
t: petrinet!Transition(
|
2022-01-18 08:20:03 +00:00
|
|
|
name <- 'action_' + a.name,
|
|
|
|
network <- ''.getJeu()),
|
2021-12-09 15:39:41 +00:00
|
|
|
|
|
|
|
arcIn: petrinet!Arc(
|
|
|
|
place <- a.getInteraction().getPersonne(),
|
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcOut: petrinet!Arc(
|
|
|
|
place <- a.getInteraction().getPersonne().getLieu().getPlace(),
|
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1)
|
2021-12-10 16:58:42 +00:00
|
|
|
do {
|
|
|
|
for (o in a.objetsConso) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.consoObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
for (o in a.objetsRecus) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.recuObjet(t, o.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
for (c in a.connaissances) {
|
2022-01-18 08:20:03 +00:00
|
|
|
thisModule.recuConn(t, c.name);
|
2021-12-10 16:58:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
rule consoObjet(t : game!Transition, s : String) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcNeg : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcTaille : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- 'taille'.getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- s.getObjet().taille)
|
2021-12-09 15:39:41 +00:00
|
|
|
}
|
2021-12-10 16:58:42 +00:00
|
|
|
|
2022-01-16 13:05:58 +00:00
|
|
|
rule readObjetEga(t : game!Transition, s : String, n : Integer) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- n),
|
|
|
|
|
|
|
|
arc2 : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- n),
|
|
|
|
|
|
|
|
arc_neg : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
2022-01-18 08:20:03 +00:00
|
|
|
weight <- (''.getTailleExp() div s.getTaille()) - n),
|
2022-01-16 13:05:58 +00:00
|
|
|
|
|
|
|
arc2_neg : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
2022-01-18 08:20:03 +00:00
|
|
|
weight <- (''.getTailleExp() div s.getTaille()) - n)
|
2022-01-16 13:05:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
rule readObjetSup(t : game!Transition, s : String, n : Integer) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- n + 1),
|
|
|
|
|
|
|
|
arc2 : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- n + 1)
|
|
|
|
}
|
|
|
|
|
2022-01-18 08:20:03 +00:00
|
|
|
rule readObjetInf(t : game!Transition, s : String, n : Integer) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- (s.getTailleExp() div s.getTaille()) - n + 1),
|
|
|
|
|
|
|
|
arc2 : petrinet!Arc(
|
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- (s.getTailleExp() div s.getTaille()) - n + 1)
|
|
|
|
}
|
|
|
|
|
2022-01-16 13:05:58 +00:00
|
|
|
rule readConn(t : game!Transition, s : String) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arc2 : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s).getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1)
|
|
|
|
}
|
|
|
|
|
|
|
|
rule readConnNeg(t : game!Transition, s : String) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s + '_neg').getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arc2 : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s + '_neg').getPlace(),
|
2022-01-16 13:05:58 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1)
|
|
|
|
}
|
|
|
|
|
2021-12-10 16:58:42 +00:00
|
|
|
rule recuObjet(t : game!Transition, s : String) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s).getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcNeg : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('objet_' + s + '_neg').getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcTaille : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- 'taille'.getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- s.getObjet().taille)
|
|
|
|
}
|
|
|
|
|
|
|
|
rule recuConn(t : game!Transition, s : String) {
|
|
|
|
to
|
|
|
|
arc : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s).getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- true,
|
|
|
|
weight <- 1),
|
|
|
|
|
|
|
|
arcNeg : petrinet!Arc(
|
2022-01-18 08:20:03 +00:00
|
|
|
place <- ('connaissance_' + s + '_neg').getPlace(),
|
2021-12-10 16:58:42 +00:00
|
|
|
transition <- t,
|
|
|
|
outgoing <- false,
|
|
|
|
weight <- 1)
|
|
|
|
}
|