diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/.idea/libraries/API_BUT5_5.xml b/.idea/libraries/API_BUT5_5.xml
new file mode 100644
index 0000000..ef81233
--- /dev/null
+++ b/.idea/libraries/API_BUT5_5.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..20f033c
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..7f1db09
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/5.5-9Octobre.iml b/5.5-9Octobre.iml
new file mode 100644
index 0000000..021568d
--- /dev/null
+++ b/5.5-9Octobre.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Nim/MainNim.java b/Nim/MainNim.java
new file mode 100644
index 0000000..5d63562
--- /dev/null
+++ b/Nim/MainNim.java
@@ -0,0 +1,11 @@
+package Nim;
+
+import fr.iut_fbleau.raw_api_body.entity.Plateau;
+
+public class MainNim {
+
+ public static void main(String[] args) {
+ Plateau p = new PlateauNim(6);
+ System.out.println(MinMax.ExploreMax(p));
+ }
+}
diff --git a/Nim/MinMax.java b/Nim/MinMax.java
new file mode 100644
index 0000000..8f1edbb
--- /dev/null
+++ b/Nim/MinMax.java
@@ -0,0 +1,46 @@
+package Nim;
+
+import fr.iut_fbleau.raw_api_body.entity.Plateau;
+import fr.iut_fbleau.raw_api_body.entity.Ply;
+
+import java.util.Iterator;
+
+public class MinMax {
+
+ public static int ExploreMin(Plateau plateau){
+ int min = 1;
+ int temp;
+ if (plateau.isFinished()){
+ return plateau.getResult();
+ }
+ Iterator plies = plateau.givePlies();
+ for (Iterator it = plies; it.hasNext(); ) {
+ Ply ply = it.next();
+ plateau.doPly(ply);
+ temp = ExploreMax(plateau);
+ if (temp < min) min = temp;
+ plateau.undoPly(ply);
+ }
+ return min;
+
+
+ }
+
+ public static int ExploreMax(Plateau plateau){
+ int max = -1;
+ int temp;
+ if (plateau.isFinished()){
+ return plateau.getResult();
+ }
+ Iterator plies = plateau.givePlies();
+ for (Iterator it = plies; it.hasNext(); ) {
+ Ply ply = it.next();
+ plateau.doPly(ply);
+ temp = ExploreMin(plateau);
+ if (temp > max) max = temp;
+ plateau.undoPly(ply);
+ }
+ return max;
+
+ }
+}
diff --git a/Nim/PlateauNim.java b/Nim/PlateauNim.java
index d7e733c..7741e1c 100644
--- a/Nim/PlateauNim.java
+++ b/Nim/PlateauNim.java
@@ -12,7 +12,7 @@ public class PlateauNim implements Plateau {
public PlateauNim(int allumette) {
this.allumette = allumette;
- this.currrentPlayer = currrentPlayer.JOUEUR1;
+ this.currrentPlayer = Player.JOUEUR1;
}
@Override
@@ -21,9 +21,9 @@ public class PlateauNim implements Plateau {
}
@Override
- public Result getResult() {
+ public int getResult() {
if (isFinished()) {
- if (currrentPlayer == JOUEUR1) {
+ if (currrentPlayer == Player.JOUEUR1) {
return Result.GAGNE;
} else {
return Result.PERDU;
@@ -51,6 +51,28 @@ public class PlateauNim implements Plateau {
return plies.iterator();
}
+ @Override
+ public void doPly(Ply ply) {
+ PlyNim plynim = (PlyNim) ply;
+ allumette -= plynim.coup;
+ if (currrentPlayer == Player.JOUEUR1){
+ currrentPlayer = Player.JOUEUR2;
+ } else {
+ currrentPlayer = Player.JOUEUR1;
+ }
+ }
+
+ @Override
+ public void undoPly(Ply ply) {
+ PlyNim plynim = (PlyNim) ply;
+ allumette += plynim.coup;
+ if (currrentPlayer == Player.JOUEUR1){
+ currrentPlayer = Player.JOUEUR2;
+ } else {
+ currrentPlayer = Player.JOUEUR1;
+ }
+ }
+
@Override
public boolean isFinished() {
if (allumette == 0) {
@@ -60,16 +82,5 @@ public class PlateauNim implements Plateau {
}
}
- @Override
- public void doo(Ply arg0) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("Unimplemented method 'doo'");
- }
-
- @Override
- public void undo(Ply arg0) {
- // TODO Auto-generated method stub
- throw new UnsupportedOperationException("Unimplemented method 'undo'");
- }
}
diff --git a/out/production/5.5-9Octobre/.idea/.gitignore b/out/production/5.5-9Octobre/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/out/production/5.5-9Octobre/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/out/production/5.5-9Octobre/.idea/libraries/API_BUT5_5.xml b/out/production/5.5-9Octobre/.idea/libraries/API_BUT5_5.xml
new file mode 100644
index 0000000..ef81233
--- /dev/null
+++ b/out/production/5.5-9Octobre/.idea/libraries/API_BUT5_5.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/.idea/misc.xml b/out/production/5.5-9Octobre/.idea/misc.xml
new file mode 100644
index 0000000..20f033c
--- /dev/null
+++ b/out/production/5.5-9Octobre/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/.idea/modules.xml b/out/production/5.5-9Octobre/.idea/modules.xml
new file mode 100644
index 0000000..7f1db09
--- /dev/null
+++ b/out/production/5.5-9Octobre/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/.idea/vcs.xml b/out/production/5.5-9Octobre/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/out/production/5.5-9Octobre/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/.vscode/settings.json b/out/production/5.5-9Octobre/.vscode/settings.json
new file mode 100644
index 0000000..bee4b7d
--- /dev/null
+++ b/out/production/5.5-9Octobre/.vscode/settings.json
@@ -0,0 +1,6 @@
+{
+ "java.project.referencedLibraries": [
+ "lib/**/*.jar",
+ "src/API.jar"
+ ]
+}
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/5.5-9Octobre.iml b/out/production/5.5-9Octobre/5.5-9Octobre.iml
new file mode 100644
index 0000000..021568d
--- /dev/null
+++ b/out/production/5.5-9Octobre/5.5-9Octobre.iml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/out/production/5.5-9Octobre/Nim/MainNim.class b/out/production/5.5-9Octobre/Nim/MainNim.class
new file mode 100644
index 0000000..4a64a73
Binary files /dev/null and b/out/production/5.5-9Octobre/Nim/MainNim.class differ
diff --git a/out/production/5.5-9Octobre/Nim/MinMax.class b/out/production/5.5-9Octobre/Nim/MinMax.class
new file mode 100644
index 0000000..d82c8d0
Binary files /dev/null and b/out/production/5.5-9Octobre/Nim/MinMax.class differ
diff --git a/out/production/5.5-9Octobre/Nim/PlateauNim.class b/out/production/5.5-9Octobre/Nim/PlateauNim.class
new file mode 100644
index 0000000..1156201
Binary files /dev/null and b/out/production/5.5-9Octobre/Nim/PlateauNim.class differ
diff --git a/out/production/5.5-9Octobre/Nim/PlyNim.class b/out/production/5.5-9Octobre/Nim/PlyNim.class
new file mode 100644
index 0000000..47e3d3e
Binary files /dev/null and b/out/production/5.5-9Octobre/Nim/PlyNim.class differ
diff --git a/out/production/5.5-9Octobre/README.md b/out/production/5.5-9Octobre/README.md
new file mode 100644
index 0000000..5b9f491
--- /dev/null
+++ b/out/production/5.5-9Octobre/README.md
@@ -0,0 +1,7 @@
+# Journal de bord
+
+## 09/10/2024
+
+Aujourd'hui nous avons intégré le code du jeu de Nim à l'API.
+
+Par la suite nous avons développé un nouveau jeu en accord avec l'API, le Tic Tac Toe
diff --git a/out/production/5.5-9Octobre/src/API_BUT5.5.jar b/out/production/5.5-9Octobre/src/API_BUT5.5.jar
new file mode 100644
index 0000000..68420c4
Binary files /dev/null and b/out/production/5.5-9Octobre/src/API_BUT5.5.jar differ
diff --git a/src/API.jar b/src/API.jar
deleted file mode 100644
index 2da12bb..0000000
Binary files a/src/API.jar and /dev/null differ
diff --git a/src/API_BUT5.5.jar b/src/API_BUT5.5.jar
new file mode 100644
index 0000000..68420c4
Binary files /dev/null and b/src/API_BUT5.5.jar differ