diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/.idea/uiDesigner.xml b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/.idea/uiDesigner.xml
new file mode 100644
index 0000000..2b63946
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/.idea/uiDesigner.xml
@@ -0,0 +1,124 @@
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+
+
+ -
+
+
+ -
+
+
+
+
+
\ No newline at end of file
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/data/Stub.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/data/Stub.class
index bc30cca..912a609 100644
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/data/Stub.class and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/data/Stub.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/launcher/ConsoleGame.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/launcher/ConsoleGame.class
index e2f5c31..004e269 100644
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/launcher/ConsoleGame.class and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/launcher/ConsoleGame.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Case.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Case.class
deleted file mode 100644
index 9329091..0000000
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Case.class and /dev/null differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/De.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/De.class
new file mode 100644
index 0000000..5ca5931
Binary files /dev/null and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/De.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/DeSimple.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/DeSimple.class
new file mode 100644
index 0000000..b1ee838
Binary files /dev/null and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/DeSimple.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/GestionnaireJoueur.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/GestionnaireJoueur.class
new file mode 100644
index 0000000..a030c35
Binary files /dev/null and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/GestionnaireJoueur.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Jeu.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Jeu.class
index 658b924..241c934 100644
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Jeu.class and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Jeu.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Joueur.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Joueur.class
new file mode 100644
index 0000000..477f06a
Binary files /dev/null and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Joueur.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Pion.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Pion.class
deleted file mode 100644
index 0823653..0000000
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Pion.class and /dev/null differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Plateau.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Plateau.class
index fcea6ce..bdcddbb 100644
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Plateau.class and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/models/Plateau.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/view/Fenetre.class b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/view/Fenetre.class
index 16a888c..1e8e05b 100644
Binary files a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/view/Fenetre.class and b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/out/production/Oie/view/Fenetre.class differ
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/data/Stub.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/data/Stub.java
index 42bcf22..473366f 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/data/Stub.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/data/Stub.java
@@ -1,15 +1,14 @@
package data;
import models.Jeu;
-import models.Pion;
+import models.Joueur;
import models.Plateau;
public class Stub {
public Jeu loadPions() {
- Plateau myPlateau = new Plateau(5);
- Jeu game = new Jeu(myPlateau);
- game.addPion(new Pion("rouge"));
- game.addPion(new Pion("bleu"));
+ Jeu game = new Jeu(5, 6);
+ game.getMyAdminPlayer().ajouterJoueur(new Joueur("rouge"));
+ game.getMyAdminPlayer().ajouterJoueur(new Joueur("bleu"));
return game;
}
}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/launcher/ConsoleGame.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/launcher/ConsoleGame.java
index e9118db..abaf5a3 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/launcher/ConsoleGame.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/launcher/ConsoleGame.java
@@ -2,23 +2,23 @@ package launcher;
import data.Stub;
import models.Jeu;
-import models.Pion;
+import models.Joueur;
public class ConsoleGame {
public static void main(String[] args) {
final Jeu game = new Stub().loadPions();
System.out.println(game.getPlateau().toString());
- Pion currentPion = game.getCurrentPion();
- System.out.println(currentPion.toString());
- System.out.println("Changement de Pion");
- currentPion = game.changePion();
- System.out.println(currentPion.toString());
- game.avancerPion();
- System.out.println(currentPion.toString());
+ Joueur currentPlayer = game.getMyAdminPlayer().getCurrentJoueur();
+ System.out.println(currentPlayer.toString());
+ System.out.println("Changement de Joueur");
+ currentPlayer = game.getMyAdminPlayer().nextPlayer();
+ System.out.println(currentPlayer.toString());
+ game.getMyAdminPlayer().getCurrentJoueur().setMyCase(game.getPlateau().getCaseList().get(0));
+ System.out.println(currentPlayer.toString());
System.out.println(game.getPlateau().toString());
- game.avancerPion();
- System.out.println(currentPion.toString());
+ game.getMyAdminPlayer().getCurrentJoueur().setMyCase(game.getPlateau().getCaseList().get(0));
+ System.out.println(currentPlayer.toString());
System.out.println(game.getPlateau().toString());
}
}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Case.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Case.java
index 759a91d..2d4f701 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Case.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Case.java
@@ -2,20 +2,16 @@ package models;
public class Case {
private int idCase;
- private boolean presence;
- public Case(int i){
- idCase = i;
- presence = false;
- }
- public boolean getPresence() {
- return this.presence;
- }
- public void setPresence(boolean presence) {
- this.presence = presence;
+ private Joueur myJoueur = null;
+ public Case(int idCase) {
+ this.idCase = idCase;
}
@Override
public String toString() {
- return this.idCase + " " + this.presence + "\n";
+ if(myJoueur){
+ return this.idCase + " " + this.myJoueur.toString() + "\n";
+ }
+ return this.idCase + " " + "\n";
}
}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/De.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/De.java
new file mode 100644
index 0000000..30904f1
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/De.java
@@ -0,0 +1,19 @@
+package models;
+
+import java.util.Random;
+
+public abstract class De {
+ private int valeur;
+ private int nbFaces;
+ Random RANDOM = new Random();
+ public De(int nbFaces) {
+ this.nbFaces = nbFaces;
+ }
+
+ public int getValeur() {
+ return valeur;
+ }
+ public void setValeur(int valeur) {
+ this.valeur = RANDOM.nextInt(nbFaces) + 1;
+ }
+}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeSimple.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeSimple.java
new file mode 100644
index 0000000..17b320b
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeSimple.java
@@ -0,0 +1,16 @@
+package models;
+
+public class DeSimple extends De {
+ public DeSimple(int nbFaces){
+ super(nbFaces);
+ }
+ @Override
+ public int getValeur() {
+ return super.getValeur();
+ }
+
+ @Override
+ public void setValeur(int valeur) {
+ super.setValeur(valeur);
+ }
+}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeplaceurJoueur.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeplaceurJoueur.java
new file mode 100644
index 0000000..172212b
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/DeplaceurJoueur.java
@@ -0,0 +1,17 @@
+//package models;
+//
+//public class DeplaceurJoueur {
+// private boolean verifPresenceJoueur(Joueur currentJoueur, int valeurDe) {
+// if((currentJoueur.getCurrentIdCase() + valeurDe )!= 0) {
+// myPlateau.getCaseList().get(currentJoueur.getCurrentIdCase() - 1).setPresence(false);
+// }
+// return false;
+// }
+// private void alternerJoueurs(Joueur joueur1, Joueur joueur) {
+//
+// }
+// public void avancerJoueur(Joueur currentJoueur, Plateau myPlateau) {
+// currentJoueur.setCurrentIdCase();
+// myPlateau.getCaseList().get(currentJoueur.getCurrentIdCase()-1).setPresence(true);
+// }
+//}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/GestionnaireJoueur.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/GestionnaireJoueur.java
new file mode 100644
index 0000000..740c763
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/GestionnaireJoueur.java
@@ -0,0 +1,25 @@
+package models;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class GestionnaireJoueur {
+ private int currentIdJoueur = 0;
+ private List lesJoueurs = new ArrayList<>();
+
+ public List getLesJoueurs() {
+ return this.lesJoueurs;
+ }
+ public Joueur getCurrentJoueur() {
+ return this.lesJoueurs.get(currentIdJoueur);
+ }
+ public void ajouterJoueur(Joueur joueur) {
+ lesJoueurs.add(joueur);
+ }
+ public Joueur nextPlayer() {
+ return lesJoueurs.get(++currentIdJoueur % lesJoueurs.size());
+ }
+// public void next() {
+// this.currentIdJoueur++;
+// }
+}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Jeu.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Jeu.java
index 7cfdb4e..e18b2c1 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Jeu.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Jeu.java
@@ -5,32 +5,38 @@ import java.util.List;
public class Jeu {
private Plateau myPlateau;
- private List pionsList = new ArrayList<>();
- private int currentPionId = 0;
- public Jeu(Plateau myPlateau) {
- this.myPlateau = myPlateau;
+ private De myDe;
+ private GestionnaireJoueur myAdminPlayer = new GestionnaireJoueur();
+// private DeplaceurJoueur myMovePlayer = new DeplaceurJoueur();
+ public Jeu(int nbCases, int nbFaces) {
+ myPlateau = new Plateau(nbCases);
+ myDe = new DeSimple(nbFaces);
}
public Plateau getPlateau() {
return this.myPlateau;
}
- public List getPionsList() {
- return this.pionsList;
- }
- public Pion getCurrentPion() {
- return pionsList.get(currentPionId);
- }
- public Pion changePion() {
- return pionsList.get(++currentPionId % pionsList.size());
- }
- public void avancerPion() {
- Pion currentPion = pionsList.get(currentPionId);
- if(currentPion.getCurrentIdCase() != 0) {
- this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase() - 1).setPresence(false);
- }
- currentPion.setCurrentIdCase();
- this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase()-1).setPresence(true);
- }
- public void addPion(Pion pion) {
- pionsList.add(pion);
+
+ public GestionnaireJoueur getMyAdminPlayer() {
+ return myAdminPlayer;
}
+ // public List getPionsList() {
+// return this.pionsList;
+// }
+// public Joueur getCurrentPion() {
+// return pionsList.get(currentPionId);
+// }
+// public Joueur changePion() {
+// return pionsList.get(++currentPionId % pionsList.size());
+// }
+// public void avancerPion() {
+// Joueur currentPion = pionsList.get(currentPionId);
+// if(currentPion.getCurrentIdCase() != 0) {
+// this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase() - 1).setPresence(false);
+// }
+// currentPion.setCurrentIdCase();
+// this.myPlateau.getCaseList().get(currentPion.getCurrentIdCase()-1).setPresence(true);
+// }
+// public void addPion(Joueur pion) {
+// pionsList.add(pion);
+// }
}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Joueur.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Joueur.java
new file mode 100644
index 0000000..34dfd95
--- /dev/null
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Joueur.java
@@ -0,0 +1,22 @@
+package models;
+
+public class Joueur {
+ private String color;
+ private Case myCase = null;
+ public Joueur(String myColor) {
+ this.color = myColor;
+ }
+ public String getColor() {
+ return color;
+ }
+ public Case getMyCase() {
+ return this.myCase;
+ }
+ public void setMyCase(Case myCase) {
+ this.myCase = myCase;
+ }
+ @Override
+ public String toString() {
+ return "Je suis le Joueur de couleur " + this.color + " et je suis sur la case " + this.myCase.getClass();
+ }
+}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Pion.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Pion.java
deleted file mode 100644
index c819143..0000000
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Pion.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package models;
-
-public class Pion {
- private String color;
- private int idCase = 0;
- public Pion(String myColor) {
- this.color = myColor;
- }
- public String getColor() {
- return color;
- }
- public int getCurrentIdCase() {
- return this.idCase;
- }
- public void setCurrentIdCase() {
- this.idCase++;
- }
- @Override
- public String toString() {
- return "Je suis le Pion de couleur " + this.color + " et je suis sur la case " + this.idCase;
- }
-}
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Plateau.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Plateau.java
index a214333..b818b57 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Plateau.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/models/Plateau.java
@@ -13,12 +13,6 @@ public class Plateau {
public List getCaseList() {
return this.CaseList;
}
- public boolean addCaseList(Case myCase) {
- return this.CaseList.add(myCase);
- }
- public boolean removeCaseList(Case myCase) {
- return this.CaseList.remove(myCase);
- }
@Override
public String toString() {
diff --git a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/view/Fenetre.java b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/view/Fenetre.java
index 3048642..1db859b 100644
--- a/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/view/Fenetre.java
+++ b/2A/Java/tp/JavaFX/tpJeuDeL_oie/Oie/src/view/Fenetre.java
@@ -5,19 +5,17 @@ import javafx.fxml.FXML;
import javafx.scene.control.Button;
import javafx.scene.layout.BorderPane;
import models.Jeu;
-import models.Pion;
-
-import java.awt.*;
+import models.Joueur;
public class Fenetre {
- @FXML
- private BorderPane myBorderPane = new BorderPane();
- private final Jeu game = new Stub().loadPions();
- Pion currentPion = game.getCurrentPion();
-
- public void initialize() {
- for(int i = 0; i < game.getPlateau().getCaseList().size(); i++) {
- myBorderPane.setCenter(new Button().setText("hello"));
- }
- }
+// @FXML
+// private BorderPane myBorderPane = new BorderPane();
+// private final Jeu game = new Stub().loadPions();
+// Joueur currentPion = game.getCurrentPion();
+//
+// public void initialize() {
+// for(int i = 0; i < game.getPlateau().getCaseList().size(); i++) {
+// myBorderPane.setCenter(new Button().setText("hello"));
+// }
+// }
}