LETSGOOOOOOO
This commit is contained in:
parent
80109716a3
commit
060a48f121
3
.idea/.gitignore
vendored
Normal file
3
.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
9
.idea/libraries/API_BUT5_5.xml
Normal file
9
.idea/libraries/API_BUT5_5.xml
Normal file
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="API_BUT5.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/src/API_BUT5.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
6
.idea/misc.xml
Normal file
6
.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
.idea/modules.xml
Normal file
8
.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/5.5-9Octobre.iml" filepath="$PROJECT_DIR$/5.5-9Octobre.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
.idea/vcs.xml
Normal file
6
.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
12
5.5-9Octobre.iml
Normal file
12
5.5-9Octobre.iml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="API_BUT5.5" level="project" />
|
||||
</component>
|
||||
</module>
|
11
Nim/MainNim.java
Normal file
11
Nim/MainNim.java
Normal file
@ -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));
|
||||
}
|
||||
}
|
46
Nim/MinMax.java
Normal file
46
Nim/MinMax.java
Normal file
@ -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<Ply> plies = plateau.givePlies();
|
||||
for (Iterator<Ply> 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<Ply> plies = plateau.givePlies();
|
||||
for (Iterator<Ply> it = plies; it.hasNext(); ) {
|
||||
Ply ply = it.next();
|
||||
plateau.doPly(ply);
|
||||
temp = ExploreMin(plateau);
|
||||
if (temp > max) max = temp;
|
||||
plateau.undoPly(ply);
|
||||
}
|
||||
return max;
|
||||
|
||||
}
|
||||
}
|
@ -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'");
|
||||
}
|
||||
|
||||
}
|
||||
|
3
out/production/5.5-9Octobre/.idea/.gitignore
vendored
Normal file
3
out/production/5.5-9Octobre/.idea/.gitignore
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="API_BUT5.5">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/src/API_BUT5.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
6
out/production/5.5-9Octobre/.idea/misc.xml
Normal file
6
out/production/5.5-9Octobre/.idea/misc.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="21" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
8
out/production/5.5-9Octobre/.idea/modules.xml
Normal file
8
out/production/5.5-9Octobre/.idea/modules.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/5.5-9Octobre.iml" filepath="$PROJECT_DIR$/5.5-9Octobre.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
6
out/production/5.5-9Octobre/.idea/vcs.xml
Normal file
6
out/production/5.5-9Octobre/.idea/vcs.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
6
out/production/5.5-9Octobre/.vscode/settings.json
vendored
Normal file
6
out/production/5.5-9Octobre/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"java.project.referencedLibraries": [
|
||||
"lib/**/*.jar",
|
||||
"src/API.jar"
|
||||
]
|
||||
}
|
12
out/production/5.5-9Octobre/5.5-9Octobre.iml
Normal file
12
out/production/5.5-9Octobre/5.5-9Octobre.iml
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="API_BUT5.5" level="project" />
|
||||
</component>
|
||||
</module>
|
BIN
out/production/5.5-9Octobre/Nim/MainNim.class
Normal file
BIN
out/production/5.5-9Octobre/Nim/MainNim.class
Normal file
Binary file not shown.
BIN
out/production/5.5-9Octobre/Nim/MinMax.class
Normal file
BIN
out/production/5.5-9Octobre/Nim/MinMax.class
Normal file
Binary file not shown.
BIN
out/production/5.5-9Octobre/Nim/PlateauNim.class
Normal file
BIN
out/production/5.5-9Octobre/Nim/PlateauNim.class
Normal file
Binary file not shown.
BIN
out/production/5.5-9Octobre/Nim/PlyNim.class
Normal file
BIN
out/production/5.5-9Octobre/Nim/PlyNim.class
Normal file
Binary file not shown.
7
out/production/5.5-9Octobre/README.md
Normal file
7
out/production/5.5-9Octobre/README.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Journal de bord
|
||||
|
||||
## 09/10/2024
|
||||
|
||||
Aujourd'hui nous avons intégré le code du jeu de Nim à l'API.
|
||||
</br>
|
||||
Par la suite nous avons développé un nouveau jeu en accord avec l'API, le Tic Tac Toe
|
BIN
out/production/5.5-9Octobre/src/API_BUT5.5.jar
Normal file
BIN
out/production/5.5-9Octobre/src/API_BUT5.5.jar
Normal file
Binary file not shown.
BIN
src/API.jar
BIN
src/API.jar
Binary file not shown.
BIN
src/API_BUT5.5.jar
Normal file
BIN
src/API_BUT5.5.jar
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user