diff --git a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl index 9137744..1ad32a5 100755 --- a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl +++ b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl @@ -114,6 +114,13 @@ def: getPlace(): petrinet!Place = ->asSequence() ->first(); +helper context String +def : getObjet() : game!Objet = + game!Objet.allInstances() + ->select(o | o.nom.nom = self) + ->asSequence() + ->first(); + helper context game!Personne def: getLieu(): game!Lieu = game!Lieu.allInstances() @@ -230,6 +237,17 @@ rule Chemin2PetriNet { transition <- t, outgoing <- true, weight <- 1) + do { + for (o in c.objetsConso) { + thisModule.consoObjet(t, o.nom); + } + for (o in c.objetsRecus) { + thisModule.recuObjet(t, o.nom); + } + for (con in c.connaissances) { + thisModule.recuConn(t, con.nom); + } + } } rule Interaction2PetriNet { @@ -250,6 +268,17 @@ rule Interaction2PetriNet { transition <- t, outgoing <- false, weight <- 1) + do { + for (o in i.objetsConso) { + thisModule.consoObjet(t, o.nom); + } + for (o in i.objetsRecus) { + thisModule.recuObjet(t, o.nom); + } + for (c in i.connaissances) { + thisModule.recuConn(t, c.nom); + } + } } rule Action2PetriNet { @@ -270,4 +299,72 @@ rule Action2PetriNet { transition <- t, outgoing <- true, weight <- 1) + do { + for (o in a.objetsConso) { + thisModule.consoObjet(t, o.nom); + } + for (o in a.objetsRecus) { + thisModule.recuObjet(t, o.nom); + } + for (c in a.connaissances) { + thisModule.recuConn(t, c.nom); + } + } } + +rule consoObjet(t : game!Transition, s : String) { + to + arc : petrinet!Arc( + place <- t.getPlace('objet_' + s), + transition <- t, + outgoing <- false, + weight <- 1), + + arcNeg : petrinet!Arc( + place <- t.getPlace('objet_' + s + '_neg'), + transition <- t, + outgoing <- true, + weight <- 1), + + arcTaille : petrinet!Arc( + place <- t.getPlace('taille'), + transition <- t, + outgoing <- true, + weight <- s.getObjet().taille) +} + +rule recuObjet(t : game!Transition, s : String) { + to + arc : petrinet!Arc( + place <- t.getPlace('objet_' + s), + transition <- t, + outgoing <- true, + weight <- 1), + + arcNeg : petrinet!Arc( + place <- t.getPlace('objet_' + s + '_neg'), + transition <- t, + outgoing <- false, + weight <- 1), + + arcTaille : petrinet!Arc( + place <- t.getPlace('taille'), + transition <- t, + outgoing <- false, + weight <- s.getObjet().taille) +} + +rule recuConn(t : game!Transition, s : String) { + to + arc : petrinet!Arc( + place <- t.getPlace('connaissance_' + s), + transition <- t, + outgoing <- true, + weight <- 1), + + arcNeg : petrinet!Arc( + place <- t.getPlace('connaissance_' + s + '_neg'), + transition <- t, + outgoing <- false, + weight <- 1) +} \ No newline at end of file diff --git a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net index 799d2c0..5c0c63d 100644 --- a/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net +++ b/runtime-workspace/fr.n7.petrinet.examples/src-gen/jeu.net @@ -11,5 +11,5 @@ pl lieu_Echec (0) tr chemin_win lieu_Enigme*1 -> lieu_Succes*1 tr chemin_loose lieu_Enigme*1 -> lieu_Echec*1 tr interaction_Parler lieu_Enigme*1 -> personne_Sphinx*1 -tr action_Reponse_1 personne_Sphinx*1 -> lieu_Enigme*1 -tr action_Reponse_2 personne_Sphinx*1 -> lieu_Enigme*1 invalid*1 +tr action_Reponse_1 personne_Sphinx*1 connaissance_Reussite_neg*1 -> lieu_Enigme*1 connaissance_Reussite*1 +tr action_Reponse_2 personne_Sphinx*1 objet_tentative*1 -> lieu_Enigme*1 objet_tentative_neg*1 taille*1 diff --git a/workspace/fr.n7.game.toPrototype/bin/.gitignore b/workspace/fr.n7.game.toPrototype/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.game.toPrototype/bin/.gitignore @@ -0,0 +1 @@ +/fr/ diff --git a/workspace/fr.n7.petrinet.toTINA/bin/.gitignore b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore new file mode 100644 index 0000000..44fde90 --- /dev/null +++ b/workspace/fr.n7.petrinet.toTINA/bin/.gitignore @@ -0,0 +1 @@ +/fr/