From c4f41f6f2248c21e52a26cc345e024577e1ae87b Mon Sep 17 00:00:00 2001 From: Laurent Fainsin Date: Tue, 7 Dec 2021 21:57:49 +0100 Subject: [PATCH] avancement MTL prototype --- .../src-gen/Prototype.java | 1 + .../ATL Transformation (game2petrinet).launch | 2 +- .../fr.n7.game2petrinet/Game2PetriNet.atl | 4 +- .../n7/game/toPrototype/main/toPrototype.emtl | 4667 ++++++++++++----- .../n7/game/toPrototype/main/toPrototype.mtl | 169 +- .../n7/game/toPrototype/main/toPrototype.mtl | 169 +- .../xtext/tests/.GameParsingTest.xtendbin | Bin 3389 -> 3389 bytes .../xtext/generator/.GameGenerator.xtendbin | Bin 2284 -> 2284 bytes 8 files changed, 3514 insertions(+), 1498 deletions(-) diff --git a/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java b/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java index faaa959..532e7be 100644 --- a/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java +++ b/runtime-workspace/fr.n7.game.examples/src-gen/Prototype.java @@ -17,6 +17,7 @@ List jeu_objets = new ArrayList<>(); false ); ); + conditions_ET_objet_tentative_description_1.add(conditions_TEST_objet_tentative_description_1); Condition condition_objet_tentative_description_1 = new Condition(conditions_ET_objet_tentative_description_1); diff --git a/runtime-workspace/fr.n7.game2petrinet/ATL Transformation (game2petrinet).launch b/runtime-workspace/fr.n7.game2petrinet/ATL Transformation (game2petrinet).launch index ad41721..1bccae9 100644 --- a/runtime-workspace/fr.n7.game2petrinet/ATL Transformation (game2petrinet).launch +++ b/runtime-workspace/fr.n7.game2petrinet/ATL Transformation (game2petrinet).launch @@ -19,7 +19,7 @@ - + diff --git a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl index 7e2b854..5efae48 100755 --- a/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl +++ b/runtime-workspace/fr.n7.game2petrinet/Game2PetriNet.atl @@ -29,7 +29,7 @@ rule Lieu2PetriNet { p: petrinet!Place( name <- 'lieu_' + l.nom.nom, tokens <- 0, - network <- p.getNetwork('jeu')) + network <- p.getNetwork()) } -- Traduire une WorkDefinition en un motif sur le réseau de Petri @@ -38,7 +38,7 @@ rule Chemin2PetriNet { to -- TRANSITIONS d'un Chemin t: petrinet!Transition( - name <- 'chemin_' + c.nom.nom, + name <- 'chemin_' + c.Nom.nom, network <- t.getNetwork()), -- ARCS d'un Chemin arcIn: petrinet!Arc( diff --git a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl index 3818f6b..79543cd 100644 --- a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl +++ b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.emtl @@ -13,119 +13,42 @@ - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + - + - + @@ -137,7 +60,7 @@ - + @@ -147,7 +70,7 @@ - + @@ -157,77 +80,106 @@ - + - + + + + + + + + + + + + + - + - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + @@ -239,42 +191,67 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + + - + - + + - + - + @@ -283,7 +260,7 @@ - + @@ -294,12 +271,12 @@ - + - + - + @@ -308,7 +285,7 @@ - + @@ -331,68 +308,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -405,41 +321,50 @@ - + - + - + + + + + + + + + + + + + + - - - - - + - + - + - + - + @@ -448,26 +373,22 @@ - + - + - - - - - + - + @@ -483,7 +404,7 @@ - + @@ -498,15 +419,15 @@ - + - + - + @@ -515,10 +436,10 @@ - + - + @@ -526,16 +447,12 @@ - - - - - + - + @@ -545,7 +462,7 @@ - + @@ -553,20 +470,20 @@ - + - + - + - + @@ -575,20 +492,33 @@ - + - + + + + + + + + + + + + + + - + @@ -598,22 +528,22 @@ - + - + - + - + @@ -622,11 +552,581 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -689,6 +1189,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -720,47 +1255,37 @@ + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + - - - @@ -772,7 +1297,25 @@ - + + + + + + + + + + + + + + + + + + + @@ -780,30 +1323,9 @@ - - - - - - - - - - - - - - - - - - - - - @@ -835,20 +1357,11 @@ - - - - - - - + - - - @@ -897,30 +1410,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - @@ -951,6 +1440,15 @@ + + + + + + + + + @@ -1031,15 +1529,346 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
-
+
-
+
@@ -1059,1153 +1888,2273 @@
-
+
-
-
+
+
+
+ + +
+
- -
-
-
+ +
+
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
- -
-
+ +
+
+
+ + +
+
+
+ + +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
- -
-
+ +
+
+
+ + +
+
- -
-
+ +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
+ +
+
- +
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
+
- -
+ +
+
+
+ + +
- -
-
+ +
+
- -
-
+ +
+
- + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ +
-
+
- -
-
-
- - -
-
+ +
+
- -
-
+ +
+
- -
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
-
- - -
-
-
- - -
-
-
- - -
-
- -
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
- -
+ +
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
+ +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
- - -
-
+ +
+
- -
-
-
- - -
-
-
- - -
-
-
- - +
-
+
+
+ + +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
+ +
+
+
+ + +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
+ +
+
- -
-
+ +
+
- -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
+ +
+
- -
-
+ +
+
- -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
+ +
+
+
+ + +
+
- -
-
+ +
+
- -
-
-
- - -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - +
- +
- +
- -
-
-
+ +
+
+
- -
-
-
+ +
+
+
- -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
+ +
+
+ + +
+
+
+ + +
+
- + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ +
-
+
- -
-
-
+ +
+
+
- -
-
-
- - -
-
-
- - -
-
+ +
+
- -
-
-
+ +
+
+
- -
-
+ +
+
+
+ + +
+
+
+ + +
+
- -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - -
-
-
- - +
+ +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ + +
+
+
+ diff --git a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.mtl b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.mtl index 8803d59..0b0e02e 100644 --- a/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.mtl +++ b/workspace/fr.n7.game.toPrototype/bin/fr/n7/game/toPrototype/main/toPrototype.mtl @@ -8,72 +8,47 @@ public class Prototype { public static void main(String['['/][']'/] args) { +[comment Objets /] // "Objets" - List jeu_objets = new ArrayList<>(); -[for (o : Objet | jeu.objets)] - List objet_[o.nom.nom/]_descriptions = new ArrayList<>(); - - [for (d : Description | o.descriptions)] - [print(d.condition, 'objet_' + o.nom.nom + '_description_' + i.toString())/] - - objet_[o.nom.nom/]_descriptions.add( - new Description( - "[d.texte/]", - objet_[o.nom.nom/]_description_[i/] - ) - ); - [/for] - +[for (o : Objet | jeu.objets)] + [print(o.descriptions, 'objet_' + o.nom.nom)/] Objet objet_[o.nom.nom/] = new Objet( "[o.nom.nom/]", [o.taille/], vraie, objet_[o.nom.nom/]_descriptions ); + jeu_objets.add(objet_[o.nom.nom/]); - jeu_objets.add(tentative_objet); [/for] +[comment Connaissances /] // "Connaissances" - List jeu_connaissances = new ArrayList<>(); [for (c : Connaissance | jeu.connaissances)] - List connaissance_[c.nom.nom/]_descriptions = new ArrayList<>(); - - [for (d : Description | c.descriptions)] - objet_[c.nom.nom/]_descriptions.add( - new Description( - "[d.texte/]", - vraie - ) - ); - [/for] - + [print(c.descriptions, 'connaissance_' + c.nom.nom)/] + [print(c.visible, 'connaissance_' + c.nom.nom + '_visible')/] Connaissance connaissance_[c.nom.nom/] = new Connaissance( "[c.nom.nom/]", - vraie, + connaissance_[c.nom.nom/]_visible, connaissance_[c.nom.nom/]_descriptions ); - - jeu_connaissances.add(reussite_connaissance); + jeu_connaissances.add(connaissance_[c.nom.nom/]); [/for] - +[comment Explorateur /] // "Explorateur" - List explorateur_inventaire = new ArrayList<>(); - [for (o : Nom | jeu.explorateur.objets)] - explorateur_inventaire.add([o.nom/]); + explorateur_inventaire.add(objet_[o.nom/]); [/for] List explorateur_connaissances = new ArrayList<>(); - [for (c : Nom | jeu.explorateur.connaissances)] - explorateur_inventaire.add([c.nom/]); + explorateur_inventaire.add(connaissance_[c.nom/]); [/for] Jeu.explorateur = new Explorateur( @@ -82,67 +57,125 @@ Jeu.explorateur = new Explorateur( explorateur_inventaire ); -// "Personnes" - -List jeu_personnes = new ArrayList<>(); - -[for (p : Personne | jeu.personnes)] - Personne personne_[p.nom.nom/] = new Personne( - "[p.nom.nom/]", - condition0, - vraie, - personne_[p.nom.nom/]_interactions - ); - - jeu_personnes.add(personne_[p.nom.nom/]); -[/for] - -jeu.jouer(); - -} } [/file] [/template] [template public print(c : Condition, name: String) post (trim()) ] -List conditions_ET_[name/] = new ArrayList<>(); +List [name/]_conditions_ET = new ArrayList<>(); [for (cET : ConditionEt | c.condition)] - List conditions_TEST_[name/] = new ArrayList<>(); + List [name/]_conditions_TEST_[i/] = new ArrayList<>(); [for (cTEST : ConditionTest | cET.conditionTest)] + [name/]_conditions_TEST_[i/].add( [if (cTEST.oclIsTypeOf(ConditionBoolean))] [let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)] - conditions_TEST_[name/].add( - new ConditionBoolean( + new ConditionBoolean( [cBOOL.valeur/], - ); - ); + ) [/let] [elseif (cTEST.oclIsTypeOf(ConditionConnaissance))] [let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)] - conditions_TEST_[name/].add( new ConditionConnaissance( connaissance_[cCONN.connaissance.nom/], [if (cCONN.connaissance.nom.startsWith('!'))]true[else]false[/if] - ); - ); + ) [/let] [elseif (cTEST.oclIsTypeOf(ConditionObjet))] [let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)] - conditions_TEST_[name/].add( new ConditionObjet( objet_[cOBJET.objet.nom/], "[cOBJET.comparateur/]", [cOBJET.nombre/] - ); - ); + ) [/let] [/if] + ); + [name/]_conditions_ET.add([name/]_conditions_TEST_[i/]) [/for] [/for] -Condition condition_[name/] = new Condition(conditions_ET_[name/]); +Condition [name/]_condition = new Condition([name/]_conditions_ET); [/template] +[template public print(ds : OrderedSet(Description), name: String) post (trim()) ] +List [name/]_descriptions = new ArrayList<>(); +[for (d : Description | ds)] + [print(d.condition, name + '_description_condition_' + i.toString())/] + + [name/]_descriptions.add( + new Description( + "[d.texte/]", + [name/]_description_[i/]_condition + ) + ); +[/for] +[/template] + +[template public print(as : OrderedSet(Action), name: String) post (trim()) ] +List [name/]_actions = new ArrayList<>(); + +[for (a : Action | as)] + [print(a.visible, name + '_action_visible_' + i.toString())/] + [print(a.finInteraction, name + '_action_fin_' + i.toString())/] + [print(a.descriptions, name)/] + + List [name/]_action_[i/]_connaissances = new ArrayList<>(); + [for (c : Nom | a.connaissances)] + [name/]_action_[i/]_connaissances.add(connaissance_[c.nom/]); + [/for] + List [name/]_action_[i/]_objets_conso = new ArrayList<>(); + [for (c : Nom | a.objetsConso)] + [name/]_action_[i/]_objets_conso.add(objet_[c.nom/]); + [/for] + List [name/]_action_[i/]_objets_recus = new ArrayList<>(); + [for (c : Nom | a.objetsRecus)] + [name/]_action_[i/]_objets_recus.add(objet_[c.nom/]); + [/for] + + [name/]_actions.add( + new Action( + [name/]_action_visible_[i/]_condition, + [name/]_action_fin_[i/]_condition, + [name/]_action_[i/]_connaissances, + [name/]_action_[i/]_objets_conso, + [name/]_action_[i/]_objets_recus, + [name/]_action_[i/]_descriptions + ) + ); +[/for] +[/template] + +[template public print(is: Interaction, name: String)] +List [name/]_interactions = new ArrayList<>(); + +[for (it : Interaction | is)] + [print(it.visible, name + '_interaction_visible_' + i.toString())/] + [print(it.actions, name + '_' + i.toString())/] + + List [name/]_interaction_[i/]_connaissances = new ArrayList<>(); + [for (c : Nom | it.connaissances)] + [name/]_interaction_[i/]_connaissances.add(connaissance_[c.nom/]); + [/for] + List [name/]_interaction_[i/]_objets_conso = new ArrayList<>(); + [for (c : Nom | it.objetsConso)] + [name/]_interaction_[i/]_objets_conso.add(objet_[c.nom/]); + [/for] + List [name/]_interaction_[i/]_objets_recus = new ArrayList<>(); + [for (c : Nom | it.objetsRecus)] + [name/]_interaction_[i/]_objets_recus.add(objet_[c.nom/]); + [/for] + + [name/]_actions.add( + new Action( + [name/]_interaction_visible_[i/]_condition, + [name/]_interaction_[i/]_connaissances, + [name/]_interaction_[i/]_objets_conso, + [name/]_interaction_[i/]_objets_recus, + [name/]_interaction_[i/]_actions + ) + ); +[/for] +[/template] \ No newline at end of file diff --git a/workspace/fr.n7.game.toPrototype/src/fr/n7/game/toPrototype/main/toPrototype.mtl b/workspace/fr.n7.game.toPrototype/src/fr/n7/game/toPrototype/main/toPrototype.mtl index 8803d59..0b0e02e 100644 --- a/workspace/fr.n7.game.toPrototype/src/fr/n7/game/toPrototype/main/toPrototype.mtl +++ b/workspace/fr.n7.game.toPrototype/src/fr/n7/game/toPrototype/main/toPrototype.mtl @@ -8,72 +8,47 @@ public class Prototype { public static void main(String['['/][']'/] args) { +[comment Objets /] // "Objets" - List jeu_objets = new ArrayList<>(); -[for (o : Objet | jeu.objets)] - List objet_[o.nom.nom/]_descriptions = new ArrayList<>(); - - [for (d : Description | o.descriptions)] - [print(d.condition, 'objet_' + o.nom.nom + '_description_' + i.toString())/] - - objet_[o.nom.nom/]_descriptions.add( - new Description( - "[d.texte/]", - objet_[o.nom.nom/]_description_[i/] - ) - ); - [/for] - +[for (o : Objet | jeu.objets)] + [print(o.descriptions, 'objet_' + o.nom.nom)/] Objet objet_[o.nom.nom/] = new Objet( "[o.nom.nom/]", [o.taille/], vraie, objet_[o.nom.nom/]_descriptions ); + jeu_objets.add(objet_[o.nom.nom/]); - jeu_objets.add(tentative_objet); [/for] +[comment Connaissances /] // "Connaissances" - List jeu_connaissances = new ArrayList<>(); [for (c : Connaissance | jeu.connaissances)] - List connaissance_[c.nom.nom/]_descriptions = new ArrayList<>(); - - [for (d : Description | c.descriptions)] - objet_[c.nom.nom/]_descriptions.add( - new Description( - "[d.texte/]", - vraie - ) - ); - [/for] - + [print(c.descriptions, 'connaissance_' + c.nom.nom)/] + [print(c.visible, 'connaissance_' + c.nom.nom + '_visible')/] Connaissance connaissance_[c.nom.nom/] = new Connaissance( "[c.nom.nom/]", - vraie, + connaissance_[c.nom.nom/]_visible, connaissance_[c.nom.nom/]_descriptions ); - - jeu_connaissances.add(reussite_connaissance); + jeu_connaissances.add(connaissance_[c.nom.nom/]); [/for] - +[comment Explorateur /] // "Explorateur" - List explorateur_inventaire = new ArrayList<>(); - [for (o : Nom | jeu.explorateur.objets)] - explorateur_inventaire.add([o.nom/]); + explorateur_inventaire.add(objet_[o.nom/]); [/for] List explorateur_connaissances = new ArrayList<>(); - [for (c : Nom | jeu.explorateur.connaissances)] - explorateur_inventaire.add([c.nom/]); + explorateur_inventaire.add(connaissance_[c.nom/]); [/for] Jeu.explorateur = new Explorateur( @@ -82,67 +57,125 @@ Jeu.explorateur = new Explorateur( explorateur_inventaire ); -// "Personnes" - -List jeu_personnes = new ArrayList<>(); - -[for (p : Personne | jeu.personnes)] - Personne personne_[p.nom.nom/] = new Personne( - "[p.nom.nom/]", - condition0, - vraie, - personne_[p.nom.nom/]_interactions - ); - - jeu_personnes.add(personne_[p.nom.nom/]); -[/for] - -jeu.jouer(); - -} } [/file] [/template] [template public print(c : Condition, name: String) post (trim()) ] -List conditions_ET_[name/] = new ArrayList<>(); +List [name/]_conditions_ET = new ArrayList<>(); [for (cET : ConditionEt | c.condition)] - List conditions_TEST_[name/] = new ArrayList<>(); + List [name/]_conditions_TEST_[i/] = new ArrayList<>(); [for (cTEST : ConditionTest | cET.conditionTest)] + [name/]_conditions_TEST_[i/].add( [if (cTEST.oclIsTypeOf(ConditionBoolean))] [let cBOOL : ConditionBoolean = cTEST.oclAsType(ConditionBoolean)] - conditions_TEST_[name/].add( - new ConditionBoolean( + new ConditionBoolean( [cBOOL.valeur/], - ); - ); + ) [/let] [elseif (cTEST.oclIsTypeOf(ConditionConnaissance))] [let cCONN : ConditionConnaissance = cTEST.oclAsType(ConditionConnaissance)] - conditions_TEST_[name/].add( new ConditionConnaissance( connaissance_[cCONN.connaissance.nom/], [if (cCONN.connaissance.nom.startsWith('!'))]true[else]false[/if] - ); - ); + ) [/let] [elseif (cTEST.oclIsTypeOf(ConditionObjet))] [let cOBJET : ConditionObjet = cTEST.oclAsType(ConditionObjet)] - conditions_TEST_[name/].add( new ConditionObjet( objet_[cOBJET.objet.nom/], "[cOBJET.comparateur/]", [cOBJET.nombre/] - ); - ); + ) [/let] [/if] + ); + [name/]_conditions_ET.add([name/]_conditions_TEST_[i/]) [/for] [/for] -Condition condition_[name/] = new Condition(conditions_ET_[name/]); +Condition [name/]_condition = new Condition([name/]_conditions_ET); [/template] +[template public print(ds : OrderedSet(Description), name: String) post (trim()) ] +List [name/]_descriptions = new ArrayList<>(); +[for (d : Description | ds)] + [print(d.condition, name + '_description_condition_' + i.toString())/] + + [name/]_descriptions.add( + new Description( + "[d.texte/]", + [name/]_description_[i/]_condition + ) + ); +[/for] +[/template] + +[template public print(as : OrderedSet(Action), name: String) post (trim()) ] +List [name/]_actions = new ArrayList<>(); + +[for (a : Action | as)] + [print(a.visible, name + '_action_visible_' + i.toString())/] + [print(a.finInteraction, name + '_action_fin_' + i.toString())/] + [print(a.descriptions, name)/] + + List [name/]_action_[i/]_connaissances = new ArrayList<>(); + [for (c : Nom | a.connaissances)] + [name/]_action_[i/]_connaissances.add(connaissance_[c.nom/]); + [/for] + List [name/]_action_[i/]_objets_conso = new ArrayList<>(); + [for (c : Nom | a.objetsConso)] + [name/]_action_[i/]_objets_conso.add(objet_[c.nom/]); + [/for] + List [name/]_action_[i/]_objets_recus = new ArrayList<>(); + [for (c : Nom | a.objetsRecus)] + [name/]_action_[i/]_objets_recus.add(objet_[c.nom/]); + [/for] + + [name/]_actions.add( + new Action( + [name/]_action_visible_[i/]_condition, + [name/]_action_fin_[i/]_condition, + [name/]_action_[i/]_connaissances, + [name/]_action_[i/]_objets_conso, + [name/]_action_[i/]_objets_recus, + [name/]_action_[i/]_descriptions + ) + ); +[/for] +[/template] + +[template public print(is: Interaction, name: String)] +List [name/]_interactions = new ArrayList<>(); + +[for (it : Interaction | is)] + [print(it.visible, name + '_interaction_visible_' + i.toString())/] + [print(it.actions, name + '_' + i.toString())/] + + List [name/]_interaction_[i/]_connaissances = new ArrayList<>(); + [for (c : Nom | it.connaissances)] + [name/]_interaction_[i/]_connaissances.add(connaissance_[c.nom/]); + [/for] + List [name/]_interaction_[i/]_objets_conso = new ArrayList<>(); + [for (c : Nom | it.objetsConso)] + [name/]_interaction_[i/]_objets_conso.add(objet_[c.nom/]); + [/for] + List [name/]_interaction_[i/]_objets_recus = new ArrayList<>(); + [for (c : Nom | it.objetsRecus)] + [name/]_interaction_[i/]_objets_recus.add(objet_[c.nom/]); + [/for] + + [name/]_actions.add( + new Action( + [name/]_interaction_visible_[i/]_condition, + [name/]_interaction_[i/]_connaissances, + [name/]_interaction_[i/]_objets_conso, + [name/]_interaction_[i/]_objets_recus, + [name/]_interaction_[i/]_actions + ) + ); +[/for] +[/template] \ No newline at end of file diff --git a/workspace/fr.n7.game.xtext.tests/xtend-gen/fr/n7/game/xtext/tests/.GameParsingTest.xtendbin b/workspace/fr.n7.game.xtext.tests/xtend-gen/fr/n7/game/xtext/tests/.GameParsingTest.xtendbin index 351816d9f8b938fca44c35df276bf596eb7e0880..a2436f15f2c99751207d284b2f86580816713325 100644 GIT binary patch delta 64 zcmdlhwO5Kaz?+#xgn@&DgJExS`$pdPtjs`q^M6)97BC}#OP2}6nB2f)4yJeU*n{am GJdOa8ycR?N delta 64 zcmdlhwO5Kaz?+#xgn@&DgJDH#%SPV!tjs`q^M6)97BC}#OP2}6nB2f)4yJeU*n{am GJdOZ_dKJI` diff --git a/workspace/fr.n7.game.xtext/xtend-gen/fr/n7/game/xtext/generator/.GameGenerator.xtendbin b/workspace/fr.n7.game.xtext/xtend-gen/fr/n7/game/xtext/generator/.GameGenerator.xtendbin index d042664353dc3c1f5bea5600d028c86312270ab1..0a3f81d9b5b71de878eade7b1b7f6215e94149a1 100644 GIT binary patch delta 64 zcmaDO_(qU7z?+#xgn@&DgJDl{`$pc~%*;S~^J(UKCNRU7?LH%jFiWT?( delta 64 zcmaDO_(qU7z?+#xgn@&DgJF4U%SPVa%*;S~^J(UKCNRU7?LH%jF