diff --git a/merde.soil b/merde.soil index 8effb02..9ba0122 100644 --- a/merde.soil +++ b/merde.soil @@ -6,23 +6,9 @@ !j2 := new Joueur !set j2.nom := 'Beta' -!Bataille.nom1 := j1.nom -!Bataille.nom2 := j2.nom - -!j1.plateau_attaque := new Plateau -!j1.plateau_defense := new Plateau -!j2.plateau_attaque := new Plateau -!j2.plateau_defense := new Plateau - !flotte_j1 := new Flotte !flotte_j2 := new Flotte -!j1.flotte := flotte_j1 -!j2.flotte := flotte_j2 - -!j1.flotte.ajouterBateau{bateau1_j1} - --- ,bateau2_j1,bateau3_j1,bateau4_j1 -- Bateau Joueur1 !bateau1_j1 := new Bateau !bateau1_j1.type := TypeBateau::Torpilleur @@ -61,14 +47,14 @@ !bateau4_j1.y2 := 9 -- Bateau Joueur2 -!bateau1_j2_j1 := new Bateau -!bateau1_j2_j1.type := TypeBateau::Torpilleur -!bateau1_j2_j1.longueur := 2 -!bateau1_j2_j1.etat := EtatBateau::Operationnel -!bateau1_j2_j1.x1 := 2 -!bateau1_j2_j1.y1 := 2 -!bateau1_j2_j1.x2 := 3 -!bateau1_j2_j1.y2 := 2 +!bateau1_j2 := new Bateau +!bateau1_j2.type := TypeBateau::Torpilleur +!bateau1_j2.longueur := 2 +!bateau1_j2.etat := EtatBateau::Operationnel +!bateau1_j2.x1 := 2 +!bateau1_j2.y1 := 2 +!bateau1_j2.x2 := 3 +!bateau1_j2.y2 := 2 !bateau2_j2 := new Bateau !bateau2_j2.type := TypeBateau::Croiseur @@ -97,4 +83,23 @@ !bateau4_j2.x2 := 9 !bateau4_j2.y2 := 6 -! \ No newline at end of file +!insert(flotte_j1, bateau1_j1) into flotte_bateau +!insert(flotte_j1, bateau2_j1) into flotte_bateau +!insert(flotte_j1, bateau3_j1) into flotte_bateau +!insert(flotte_j1, bateau4_j1) into flotte_bateau + +!insert(flotte_j2, bateau1_j2) into flotte_bateau +!insert(flotte_j2, bateau2_j2) into flotte_bateau +!insert(flotte_j2, bateau3_j2) into flotte_bateau +!insert(flotte_j2, bateau4_j2) into flotte_bateau + +!insert(j1,Bataille) into EstEnJeu1 +!insert(j2,Bataille) into EstEnJeu1 + +!insert (j1,flotte_j1) into flotte_joueur +!insert (j2,flotte_j2) into flotte_joueur + +!insert(j1,new Plateau) into Utilise +!insert(j1,new Plateau) into Utilise +!insert(j2,new Plateau) into Utilise +!insert(j2,new Plateau) into Utilise diff --git a/projet.use b/projet.use index 02bdc3c..091c57e 100644 --- a/projet.use +++ b/projet.use @@ -84,6 +84,7 @@ end class Flotte operations ajouterBateau(bateau: Bateau) + pre torpilleur: bateau.type = TypeBateau::Torpilleur implies bateaux->select(b: Bateau | b.type = TypeBateau::Torpilleur)->size() < 1 pre contre_torpilleur: bateau.type = TypeBateau::Contre_Torpilleur implies bateaux->select(b: Bateau | b.type = TypeBateau::Contre_Torpilleur)->size() < 2 pre croiseur: bateau.type = TypeBateau::Croiseur implies bateaux->select(b: Bateau | b.type = TypeBateau::Croiseur)->size() < 1 @@ -154,12 +155,12 @@ Joueur[1] role joueur Plateau[1] role plateau end -composition Joue1 between +composition EstEnJeu1 between Joueur[1] role joueur1 Jeu[1] role jeu1 end -composition Joue2 between +composition EstEnJeu2 between Joueur[1] role joueur2 Jeu[1] role jeu2 end @@ -169,12 +170,12 @@ Joueur[1] role joueur Coup[0..100] role coups end -association Appartient between +association flotte_joueur between Joueur[1] role joueur Flotte[1] role flotte end -composition Appartient2 between +composition flotte_bateau between Flotte[1] role flotte Bateau[5] role bateaux end