test_pn_interface.py 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554
  1. import unittest
  2. from utils import run_file, get_constructor
  3. set_inheritance = [
  4. "Which link in the metamodel is the inheritance link?",
  5. "Set inheritance link!",
  6. ]
  7. do_instantiate_simple = [
  8. '"new"', '"PetriNets"', '"abc"',
  9. '"instantiate"', '"Transition"', '"t1"',
  10. '"instantiate"', '"Place"', '"p1"', '"attr_add"', '"p1"', '"tokens"', '5',
  11. '"instantiate"', '"Place"', '"p2"', '"attr_add"', '"p2"', '"tokens"', '0',
  12. '"instantiate"', '"P2T"', '"p2t"', '"p1"', '"t1"', '"attr_add"', '"p2t"', '"weight"', '2',
  13. '"instantiate"', '"T2P"', '"t2p"', '"t1"', '"p2"', '"attr_add"', '"t2p"', '"weight"', '1']
  14. instantiate_node = ["Type to instantiate?",
  15. "Name of new element?",
  16. "Instantiation successful!"]
  17. instantiate_edge = ["Type to instantiate?",
  18. "Name of new element?",
  19. "Source name?",
  20. "Destination name?",
  21. "Instantiation successful!"]
  22. all_files = [ "pn_interface.alc",
  23. "primitives.alc",
  24. "object_operations.alc",
  25. "conformance_scd.alc",
  26. "library.alc",
  27. "metamodels.alc",
  28. "constructors.alc",
  29. "modelling.alc",
  30. "compilation_manager.alc",
  31. ]
  32. greeting = ["Welcome to the Model Management Interface, running live on the Modelverse!",
  33. "Use 'help' command for a list of possible commands"]
  34. new = ["Metamodel to instantiate?",
  35. "Name of model?"]
  36. prompt = ["Please give your command."]
  37. loaded = ["Model loaded, ready for commands!",
  38. "Use 'help' command for a list of possible commands"] + prompt
  39. load = ["Model to load?"]
  40. instantiate = ["Type to instantiate?"]
  41. instantiate_name = ["Name of new element?"]
  42. instantiate_ok = ["Instantiation successful!"]
  43. instantiate_source= ["Source name?"]
  44. instantiate_destination = ["Destination name?"]
  45. def list_menu(defined):
  46. defined.append(("PetriNets", "SimpleClassDiagrams"))
  47. defined.append(("SimpleClassDiagrams", "SimpleClassDiagrams"))
  48. defined.append(("LTM_bottom", "LTM_bottom"))
  49. return ["Found models:",
  50. set([" %s : %s" % (m, mm) for m, mm in defined])]
  51. def list_model(defined):
  52. return ["List of all elements:",
  53. set([" %s : %s" % (m, mm) for m, mm in defined])]
  54. def read_node(name, t, defs, attrs):
  55. return ["Element to read?",
  56. "Name: %s" % name,
  57. "Type: %s" % t,
  58. "Defines attributes:"] + \
  59. ([set([" %s : %s" % (m, mm) for m, mm in defs])] if defs else []) + \
  60. ["Attributes:"] + \
  61. ([set([' "%s" : "%s" = %s' % (m, mm, v) for m, mm, v in attrs])] if attrs else [])
  62. def read_edge(name, t, src, dst, defs, attrs):
  63. return ["Element to read?",
  64. "Name: %s" % name,
  65. "Type: %s" % t,
  66. "Source: %s" % src,
  67. "Destination: %s" % dst,
  68. "Defines attributes:"] + \
  69. ([set([" %s : %s" % (m, mm) for m, mm in defs])] if defs else []) + \
  70. ["Attributes:"] + \
  71. ([set([' "%s" : "%s" = %s' % (m, mm, v) for m, mm, v in attrs])] if attrs else [])
  72. def enabled(enableds):
  73. return ["Enabled transitions:"] + \
  74. [set(enableds)]
  75. def fire(fired):
  76. return ["Transition to fire?"] + \
  77. [set([" %s: %s" % (p, v) for p, v in fired])] + \
  78. ["Transition fired!"]
  79. delete = ["Model to delete?", "Deleted!"]
  80. rename = ["Old name?", "New name?", "Rename complete!"]
  81. attr_add = ["Which model do you want to assign an attribute to?",
  82. "Which attribute do you wish to assign?",
  83. "Value of attribute?",
  84. "Added attribute!"]
  85. attr_del = ["Which model do you want to remove an attribute of?",
  86. "Which attribute do you want to delete?",
  87. "Attribute deleted!",
  88. ]
  89. help_root = ["Currently no model is loaded, so your operations are limited to:",
  90. " new -- Create a new model and save it for future use"
  91. " load -- Load a previously made model",
  92. " rename -- Rename a previously made model",
  93. " delete -- Delete a previously made model",
  94. " list -- Show a list of all stored models",
  95. " help -- Show a list of possible commands"]
  96. verify_fail_weight= ["Natural number not larger than or equal to zero"]
  97. verify_fail_tokens= ["Natural number not larger than or equal to zero"]
  98. verify_fail_structure = ["Source of model edge not typed by source of type: p2t"]
  99. init = greeting + prompt
  100. did_instantiate_simple = init + \
  101. new + \
  102. loaded +\
  103. instantiate_node + \
  104. prompt + \
  105. instantiate_node + \
  106. prompt + \
  107. attr_add + \
  108. prompt + \
  109. instantiate_node + \
  110. prompt + \
  111. attr_add + \
  112. prompt + \
  113. instantiate_edge + \
  114. prompt + \
  115. attr_add + \
  116. prompt + \
  117. instantiate_edge + \
  118. prompt + \
  119. attr_add + \
  120. prompt
  121. def list_types(t):
  122. return ["List of types:"] + \
  123. [set([" %s : %s" % (m, mm) for m, mm in t])]
  124. modify = ["Element to modify?",
  125. "Attribute to modify?",
  126. "New value?",
  127. "Modified!",]
  128. class TestPetrinetInterface(unittest.TestCase):
  129. def test_po_pn_interface_manage(self):
  130. self.pn_interface_manage("PO")
  131. def test_co_pn_interface_manage(self):
  132. self.pn_interface_manage("CO")
  133. def pn_interface_manage(self, mode):
  134. self.assertTrue(run_file(all_files,
  135. ['"list"',
  136. '"new"', '"PetriNets"', '"abc"', '"exit"',
  137. '"list"',
  138. '"new"', '"PetriNets"', '"def"', '"exit"',
  139. '"list"',
  140. '"delete"', '"def"',
  141. '"list"',
  142. '"rename"', '"abc"', '"a"',
  143. '"list"',
  144. '"delete"', '"a"',
  145. '"list"',
  146. ],
  147. init + \
  148. list_menu([]) + prompt + \
  149. new + loaded + prompt + list_menu([("abc", "PetriNets")]) + prompt + \
  150. new + loaded + prompt + list_menu([("abc", "PetriNets"), ("def", "PetriNets")]) + prompt + \
  151. delete + prompt + list_menu([("abc", "PetriNets")]) + prompt + \
  152. rename + prompt + list_menu([("a", "PetriNets")]) + prompt + \
  153. delete + prompt + list_menu([]) + prompt,
  154. mode))
  155. def test_po_pn_interface_new_reload(self):
  156. self.pn_interface_new_reload("PO")
  157. def test_co_pn_interface_new_reload(self):
  158. self.pn_interface_new_reload("CO")
  159. def pn_interface_new_reload(self, mode):
  160. self.assertTrue(run_file(all_files,
  161. ['"new"', '"PetriNets"', '"abc"', '"exit"', '"load"', '"abc"'],
  162. init + new + loaded + prompt + load + loaded,
  163. mode))
  164. def test_po_pn_interface_instantiate_place(self):
  165. self.pn_interface_instantiate_place("PO")
  166. def test_co_pn_interface_instantiate_place(self):
  167. self.pn_interface_instantiate_place("CO")
  168. def pn_interface_instantiate_place(self, mode):
  169. self.assertTrue(run_file(all_files,
  170. ['"new"', '"PetriNets"', '"abc"',
  171. '"instantiate"', '"Place"', '"p1"',
  172. '"attr_add"', '"p1"', '"tokens"', '5',
  173. '"list"',
  174. '"read"', '"p1"',
  175. '"instantiate"', '"Transition"', '"t1"',
  176. '"list"',
  177. '"read"', '"t1"'],
  178. init + new + loaded + \
  179. instantiate_node + prompt + \
  180. attr_add + prompt + \
  181. list_model([("p1", "Place")]) + prompt + \
  182. read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
  183. instantiate_node + prompt + \
  184. list_model([("p1", "Place"), ("t1", "Transition")]) + prompt + \
  185. read_node("t1", "Transition", [], []) + prompt,
  186. mode))
  187. def test_po_pn_interface_instantiate_arcs(self):
  188. self.pn_interface_instantiate_arcs("PO")
  189. def test_co_pn_interface_instantiate_arcs(self):
  190. self.pn_interface_instantiate_arcs("CO")
  191. def pn_interface_instantiate_arcs(self, mode):
  192. self.assertTrue(run_file(all_files,
  193. do_instantiate_simple + [
  194. '"read"', '"p1"',
  195. '"read"', '"p2"',
  196. '"read"', '"t1"',
  197. '"read"', '"p2t"',
  198. '"read"', '"t2p"',
  199. ],
  200. did_instantiate_simple + \
  201. read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
  202. read_node("p2", "Place", [], [("tokens", "Natural", 0)]) + prompt + \
  203. read_node("t1", "Transition", [], []) + prompt + \
  204. read_edge("p2t", "P2T", "p1", "t1", [], [("weight", "Natural", 2)]) + prompt + \
  205. read_edge("t2p", "T2P", "t1", "p2", [], [("weight", "Natural", 1)]) + prompt,
  206. mode))
  207. def test_po_pn_interface_enabled(self):
  208. self.pn_interface_enabled("PO")
  209. def test_co_pn_interface_enabled(self):
  210. self.pn_interface_enabled("CO")
  211. def pn_interface_enabled(self, mode):
  212. self.assertTrue(run_file(all_files,
  213. do_instantiate_simple + ['"enabled"'],
  214. did_instantiate_simple + enabled(["t1"]) + prompt,
  215. mode))
  216. def test_po_pn_interface_fire(self):
  217. self.pn_interface_fire("PO")
  218. def test_co_pn_interface_fire(self):
  219. self.pn_interface_fire("CO")
  220. def pn_interface_fire(self, mode):
  221. self.assertTrue(run_file(all_files,
  222. do_instantiate_simple + ['"fire"', '"t1"'],
  223. did_instantiate_simple + fire([("p1", 3), ("p2", 1)]) + prompt,
  224. mode))
  225. def test_po_pn_interface_verify_OK(self):
  226. self.pn_interface_verify_OK("PO")
  227. def test_co_pn_interface_verify_OK(self):
  228. self.pn_interface_verify_OK("CO")
  229. def pn_interface_verify_OK(self, mode):
  230. self.assertTrue(run_file(all_files,
  231. do_instantiate_simple + ['"verify"'],
  232. did_instantiate_simple + ["OK"], mode))
  233. def test_po_pn_interface_verify_fail_tokens(self):
  234. self.pn_interface_verify_fail_tokens("PO")
  235. def test_co_pn_interface_verify_fail_tokens(self):
  236. self.pn_interface_verify_fail_tokens("CO")
  237. def pn_interface_verify_fail_tokens(self, mode):
  238. self.assertTrue(run_file(all_files,
  239. do_instantiate_simple + ['"modify"', '"p1"', '"tokens"', '-5', '"verify"'],
  240. did_instantiate_simple + modify + prompt + verify_fail_tokens + prompt, mode))
  241. def test_po_pn_interface_verify_fail_weight(self):
  242. self.pn_interface_verify_fail_weight("PO")
  243. def test_co_pn_interface_verify_fail_weight(self):
  244. self.pn_interface_verify_fail_weight("CO")
  245. def pn_interface_verify_fail_weight(self, mode):
  246. self.assertTrue(run_file(all_files,
  247. do_instantiate_simple + ['"modify"', '"p2t"', '"weight"', '-2', '"verify"'],
  248. did_instantiate_simple + modify + prompt + verify_fail_weight + prompt, mode))
  249. def test_po_pn_interface_verify_fail_structure(self):
  250. self.pn_interface_verify_fail_structure("PO")
  251. def test_co_pn_interface_verify_fail_structure(self):
  252. self.pn_interface_verify_fail_structure("CO")
  253. def pn_interface_verify_fail_structure(self, mode):
  254. self.assertTrue(run_file(all_files,
  255. ['"new"', '"PetriNets"', '"abc"',
  256. '"instantiate"', '"Transition"', '"t1"',
  257. '"instantiate"', '"Place"', '"p1"', '"attr_add"', '"p1"', '"tokens"', '5',
  258. '"instantiate"', '"P2T"', '"p2t"', '"t1"', '"p1"', '"attr_add"', '"p2t"', '"weight"', '2', '"verify"'],
  259. init + new + loaded + \
  260. instantiate_node + prompt + \
  261. instantiate_node + prompt + attr_add + prompt + \
  262. instantiate_edge + prompt + attr_add + prompt + \
  263. verify_fail_structure,
  264. mode))
  265. def test_po_pn_interface_types(self):
  266. self.pn_interface_types("PO")
  267. def test_co_pn_interface_types(self):
  268. self.pn_interface_types("CO")
  269. def pn_interface_types(self, mode):
  270. self.assertTrue(run_file(all_files,
  271. ['"new"', '"PetriNets"', '"abc"', '"types"'],
  272. init + new + loaded + list_types([("Place", "Class"), ("Transition", "Class"), ("P2T", "Association"), ("T2P", "Association"), ("Natural", "Class")]),
  273. mode))
  274. def test_po_pn_interface_modify_place(self):
  275. self.pn_interface_modify_place("PO")
  276. def test_co_pn_interface_modify_place(self):
  277. self.pn_interface_modify_place("CO")
  278. def pn_interface_modify_place(self, mode):
  279. self.assertTrue(run_file(all_files,
  280. ['"new"', '"PetriNets"', '"abc"',
  281. '"instantiate"', '"Place"', '"p1"', '"attr_add"', '"p1"', '"tokens"', '5',
  282. '"read"', '"p1"',
  283. '"modify"', '"p1"', '"tokens"', '1', '"read"', '"p1"'],
  284. init + new + loaded + \
  285. instantiate_node + prompt + attr_add + prompt + \
  286. read_node("p1", "Place", [], [("tokens", "Natural", 5)]) + prompt + \
  287. modify + prompt + \
  288. read_node("p1", "Place", [], [("tokens", "Natural", 1)]) + prompt,
  289. mode))
  290. def test_po_pn_interface_verify_fail_attr_lower_cardinality(self):
  291. self.pn_interface_verify_fail_attr_lower_cardinality("PO")
  292. def test_co_pn_interface_verify_fail_attr_lower_cardinality(self):
  293. self.pn_interface_verify_fail_attr_lower_cardinality("CO")
  294. def pn_interface_verify_fail_attr_lower_cardinality(self, mode):
  295. self.assertTrue(run_file(all_files,
  296. do_instantiate_simple + ['"instantiate"', '"Place"', '"p999"', '"verify"'],
  297. did_instantiate_simple + instantiate_node + prompt + ["Lower cardinality violation for outgoing edge at p999"] + prompt,
  298. mode))
  299. def test_po_pn_interface_verify_fail_attr_upper_cardinality(self):
  300. self.pn_interface_verify_fail_attr_upper_cardinality("PO")
  301. def test_co_pn_interface_verify_fail_attr_upper_cardinality(self):
  302. self.pn_interface_verify_fail_attr_upper_cardinality("CO")
  303. def pn_interface_verify_fail_attr_upper_cardinality(self, mode):
  304. self.assertTrue(run_file(all_files,
  305. do_instantiate_simple + ['"attr_add"', '"p1"', '"tokens"', '5', '"verify"'],
  306. did_instantiate_simple + attr_add + prompt + ["Upper cardinality violation for outgoing edge at p1"] + prompt,
  307. mode))
  308. def test_po_pn_interface_verify_natural(self):
  309. self.pn_interface_verify_natural("PO")
  310. def test_co_pn_interface_verify_natural(self):
  311. self.pn_interface_verify_natural("CO")
  312. def pn_interface_verify_natural(self, mode):
  313. self.assertTrue(run_file(all_files,
  314. ['"new"', '"PetriNets"', '"abc"',
  315. '"instantiate"', '"Place"', '"p1"',
  316. '"attr_add"', '"p1"', '"tokens"', '-5',
  317. '"attr_del"', '"p1"', '"tokens"',
  318. '"attr_add"', '"p1"', '"tokens"', '4',
  319. '"verify"'],
  320. init + new + loaded + \
  321. instantiate_node + prompt + \
  322. attr_add + prompt + \
  323. attr_del + prompt + \
  324. attr_add + prompt + \
  325. ["OK"] + prompt,
  326. mode))
  327. def test_po_pn_interface_verify_PN_OK(self):
  328. self.pn_interface_verify_PN_OK("PO")
  329. def test_co_pn_interface_verify_PN_OK(self):
  330. self.pn_interface_verify_PN_OK("CO")
  331. def pn_interface_verify_PN_OK(self, mode):
  332. self.assertTrue(run_file(all_files,
  333. ['"load"', '"PetriNets"', '"verify"'],
  334. init + load + loaded + ["OK"], mode))
  335. def test_po_rpgame(self):
  336. self.rpgame("PO")
  337. def test_co_rpgame(self):
  338. self.rpgame("CO")
  339. def rpgame(self, mode):
  340. constraint_code = \
  341. """
  342. include "primitives.alh"
  343. include "object_operations.alh"
  344. Element function constraint(model : Element, name : String):
  345. \tElement associations
  346. \tElement back_associations
  347. \tElement association
  348. \tString destination
  349. \tassociations = allOutgoingAssociationInstances(model, name, "tile_left")
  350. \twhile (0 < list_len(associations)):
  351. \t\tassociation = set_pop(associations)
  352. \t\tdestination = readAssociationDestination(model, association)
  353. \t\tback_associations = allOutgoingAssociationInstances(model, destination, "tile_right")
  354. \t\tif (list_len(back_associations) < 1):
  355. \t\t\treturn "Left link does not have a right link back"
  356. \t\telse:
  357. \t\t\tassociation = set_pop(back_associations)
  358. \t\t\tdestination = readAssociationDestination(model, association)
  359. \t\t\tif (destination != name):
  360. \t\t\t\treturn "Right link does not have a left link back to the same tile"
  361. \tassociations = allOutgoingAssociationInstances(model, name, "tile_right")
  362. \twhile (0 < list_len(associations)):
  363. \t\tassociation = set_pop(associations)
  364. \t\tdestination = readAssociationDestination(model, association)
  365. \t\tback_associations = allOutgoingAssociationInstances(model, destination, "tile_left")
  366. \t\tif (list_len(back_associations) < 1):
  367. \t\t\treturn "Right link does not have a left link back"
  368. \t\telse:
  369. \t\t\tassociation = set_pop(back_associations)
  370. \t\t\tdestination = readAssociationDestination(model, association)
  371. \t\t\tif (destination != name):
  372. \t\t\t\treturn "Right link does not have a left link back to the same tile"
  373. \tassociations = allOutgoingAssociationInstances(model, name, "tile_top")
  374. \twhile (0 < list_len(associations)):
  375. \t\tassociation = set_pop(associations)
  376. \t\tdestination = readAssociationDestination(model, association)
  377. \t\tback_associations = allOutgoingAssociationInstances(model, destination, "tile_bottom")
  378. \t\tif (list_len(back_associations) < 1):
  379. \t\t\treturn "Top link does not have a bottom link back"
  380. \t\telse:
  381. \t\t\tassociation = set_pop(back_associations)
  382. \t\t\tdestination = readAssociationDestination(model, association)
  383. \t\t\tif (destination != name):
  384. \t\t\t\treturn "Top link does not have a bottom link back to the same tile"
  385. \tassociations = allOutgoingAssociationInstances(model, name, "tile_bottom")
  386. \twhile (0 < list_len(associations)):
  387. \t\tassociation = set_pop(associations)
  388. \t\tdestination = readAssociationDestination(model, association)
  389. \t\tback_associations = allOutgoingAssociationInstances(model, destination, "tile_top")
  390. \t\tif (list_len(back_associations) < 1):
  391. \t\t\treturn "Bottom link does not have a top link back"
  392. \t\telse:
  393. \t\t\tassociation = set_pop(back_associations)
  394. \t\t\tdestination = readAssociationDestination(model, association)
  395. \t\t\tif (destination != name):
  396. \t\t\t\treturn "Bottom link does not have a top link back to the same tile"
  397. \treturn "OK"
  398. """
  399. constructors = get_constructor(constraint_code)
  400. print(constructors)
  401. self.assertTrue(run_file(all_files,
  402. ['"new"', '"SimpleClassDiagrams"', '"RPGame"',
  403. '"set_inheritance"', '"Inheritance"',
  404. '"instantiate"', '"Class"', '"Scene"',
  405. '"instantiate"', '"Class"', '"Tile"',
  406. '"instantiate"', '"Class"', '"Item"',
  407. '"instantiate"', '"Class"', '"Goal"',
  408. '"instantiate"', '"Class"', '"Character"',
  409. '"instantiate"', '"Class"', '"Hero"',
  410. '"instantiate"', '"Association"', '"scene_has_tiles"', '"Scene"', '"Tile"',
  411. '"instantiate"', '"Association"', '"tile_left"', '"Tile"', '"Tile"',
  412. '"instantiate"', '"Association"', '"tile_right"', '"Tile"', '"Tile"',
  413. '"instantiate"', '"Association"', '"tile_top"', '"Tile"', '"Tile"',
  414. '"instantiate"', '"Association"', '"tile_bottom"', '"Tile"', '"Tile"',
  415. '"instantiate"', '"Association"', '"character_on"', '"Character"', '"Tile"',
  416. '"instantiate"', '"Association"', '"item_on"', '"Item"', '"Tile"',
  417. '"instantiate"', '"Inheritance"', '"hero_is_character"', '"Hero"', '"Character"',
  418. '"instantiate"', '"Inheritance"', '"goal_is_item"', '"Goal"', '"Item"',
  419. '"attr_add"', '"Scene"', '"lower_cardinality"', '1',
  420. '"attr_add"', '"Scene"', '"upper_cardinality"', '1',
  421. '"attr_add"', '"Goal"', '"lower_cardinality"', '1',
  422. '"attr_add"', '"scene_has_tiles"', '"source_lower_cardinality"', '1',
  423. '"attr_add"', '"scene_has_tiles"', '"source_upper_cardinality"', '1',
  424. '"attr_add"', '"scene_has_tiles"', '"target_lower_cardinality"', '1',
  425. '"attr_add"', '"item_on"', '"target_lower_cardinality"', '1',
  426. '"attr_add"', '"item_on"', '"target_upper_cardinality"', '1',
  427. '"attr_add"', '"item_on"', '"source_upper_cardinality"', '1',
  428. '"attr_add"', '"character_on"', '"target_lower_cardinality"', '1',
  429. '"attr_add"', '"character_on"', '"target_upper_cardinality"', '1',
  430. '"attr_add"', '"character_on"', '"source_upper_cardinality"', '1',
  431. '"attr_add"', '"tile_left"', '"source_upper_cardinality"', '1',
  432. '"attr_add"', '"tile_left"', '"target_upper_cardinality"', '1',
  433. '"attr_add"', '"tile_right"', '"source_upper_cardinality"', '1',
  434. '"attr_add"', '"tile_right"', '"target_upper_cardinality"', '1',
  435. '"attr_add"', '"tile_top"', '"source_upper_cardinality"', '1',
  436. '"attr_add"', '"tile_top"', '"target_upper_cardinality"', '1',
  437. '"attr_add"', '"tile_bottom"', '"source_upper_cardinality"', '1',
  438. '"attr_add"', '"tile_bottom"', '"target_upper_cardinality"', '1',
  439. '"constrain"', '"Tile"',
  440. ] + constructors + ['"verify"'] + ['"exit"'] + [
  441. '"new"', '"RPGame"', '"my_game"',
  442. '"instantiate"', '"Scene"', '"scene"',
  443. '"instantiate"', '"Hero"', '"Link"',
  444. '"instantiate"', '"Goal"', '"goal"',
  445. '"instantiate"', '"Tile"', '"tile_00"',
  446. '"instantiate"', '"Tile"', '"tile_01"',
  447. '"instantiate"', '"Tile"', '"tile_10"',
  448. '"instantiate"', '"Tile"', '"tile_11"',
  449. '"instantiate"', '"scene_has_tiles"', '""', '"scene"', '"tile_00"',
  450. '"instantiate"', '"scene_has_tiles"', '""', '"scene"', '"tile_01"',
  451. '"instantiate"', '"scene_has_tiles"', '""', '"scene"', '"tile_10"',
  452. '"instantiate"', '"scene_has_tiles"', '""', '"scene"', '"tile_11"',
  453. '"instantiate"', '"character_on"', '""', '"Link"', '"tile_00"',
  454. '"instantiate"', '"item_on"', '""', '"goal"', '"tile_11"',
  455. '"instantiate"', '"tile_left"', '""', '"tile_01"', '"tile_00"',
  456. '"instantiate"', '"tile_left"', '""', '"tile_11"', '"tile_10"',
  457. '"instantiate"', '"tile_right"', '""', '"tile_00"', '"tile_01"',
  458. '"instantiate"', '"tile_right"', '""', '"tile_10"', '"tile_11"',
  459. '"instantiate"', '"tile_top"', '""', '"tile_10"', '"tile_00"',
  460. '"instantiate"', '"tile_top"', '""', '"tile_11"', '"tile_01"',
  461. '"instantiate"', '"tile_bottom"', '""', '"tile_00"', '"tile_10"',
  462. '"instantiate"', '"tile_bottom"', '""', '"tile_01"', '"tile_11"',
  463. '"verify"',
  464. ],
  465. init + new + loaded + \
  466. set_inheritance + prompt + \
  467. (instantiate_node + prompt) * 6 + \
  468. (instantiate_edge + prompt) * 9 + \
  469. (attr_add + prompt) * 20 + \
  470. ["Element to constrain (empty for global)?",
  471. "Give input to function constructors for LOCAL constraint!",
  472. "Added constraint to model!"] + \
  473. prompt + \
  474. ["OK"] + \
  475. prompt + prompt + new + loaded + \
  476. (instantiate_node + prompt) * 7 + \
  477. (instantiate_edge + prompt) * 14 + \
  478. ["OK"],
  479. mode))