les bebous

This commit is contained in:
Tom MOGULJAK 2024-10-09 11:47:39 +02:00
commit 80109716a3
5 changed files with 109 additions and 0 deletions

6
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,6 @@
{
"java.project.referencedLibraries": [
"lib/**/*.jar",
"src/API.jar"
]
}

75
Nim/PlateauNim.java Normal file
View File

@ -0,0 +1,75 @@
package Nim;
import java.util.Iterator;
import java.util.ArrayList;
import fr.iut_fbleau.raw_api_body.entity.*;
public class PlateauNim implements Plateau {
int allumette;
Player currrentPlayer;
Result resultat;
public PlateauNim(int allumette) {
this.allumette = allumette;
this.currrentPlayer = currrentPlayer.JOUEUR1;
}
@Override
public Player getPlayer() {
return currrentPlayer;
}
@Override
public Result getResult() {
if (isFinished()) {
if (currrentPlayer == JOUEUR1) {
return Result.GAGNE;
} else {
return Result.PERDU;
}
} else {
throw new NullPointerException("La partie n'est pas terminée");
}
}
@Override
public Iterator<Ply> givePlies() {
ArrayList<Ply> plies = new ArrayList<Ply>();
if (allumette == 1) {
plies.add(new PlyNim(1, currrentPlayer));
} else if (allumette == 2) {
plies.add(new PlyNim(1, currrentPlayer));
plies.add(new PlyNim(2, currrentPlayer));
} else {
plies.add(new PlyNim(1, currrentPlayer));
plies.add(new PlyNim(2, currrentPlayer));
plies.add(new PlyNim(3, currrentPlayer));
}
return plies.iterator();
}
@Override
public boolean isFinished() {
if (allumette == 0) {
return true;
} else {
return false;
}
}
@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'");
}
}

21
Nim/PlyNim.java Normal file
View File

@ -0,0 +1,21 @@
package Nim;
import fr.iut_fbleau.raw_api_body.entity.*;
public class PlyNim extends Ply {
/*
Nombre d'alumettes retirées
*/
int coup;
/*
Joueur actuel
*/
Player joueur;
public PlyNim(int c, Player p){
this.coup = c;
this.joueur = p;
}
}

7
README.md Normal file
View 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
src/API.jar Normal file

Binary file not shown.