Mise en place de l'opti featherweight
This commit is contained in:
parent
060a48f121
commit
497e966878
@ -5,7 +5,14 @@ import fr.iut_fbleau.raw_api_body.entity.Plateau;
|
||||
public class MainNim {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Plateau p = new PlateauNim(6);
|
||||
|
||||
|
||||
Plateau p = new PlateauNim(5);
|
||||
System.out.println(MinMax.ExploreMax(p));
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,6 +9,13 @@ public class PlateauNim implements Plateau {
|
||||
int allumette;
|
||||
Player currrentPlayer;
|
||||
Result resultat;
|
||||
PlyNim j1_1 = new PlyNim(1,Player.JOUEUR1);
|
||||
PlyNim j1_2 = new PlyNim(2,Player.JOUEUR1);
|
||||
PlyNim j1_3 = new PlyNim(3,Player.JOUEUR1);
|
||||
|
||||
PlyNim j2_1 = new PlyNim(1,Player.JOUEUR2);
|
||||
PlyNim j2_2 = new PlyNim(2,Player.JOUEUR2);
|
||||
PlyNim j2_3 = new PlyNim(3,Player.JOUEUR2);
|
||||
|
||||
public PlateauNim(int allumette) {
|
||||
this.allumette = allumette;
|
||||
@ -37,17 +44,31 @@ public class PlateauNim implements Plateau {
|
||||
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));
|
||||
if (currrentPlayer == Player.JOUEUR1){
|
||||
if (allumette == 1) {
|
||||
plies.add(j1_1);
|
||||
} else if (allumette == 2) {
|
||||
plies.add(j1_1);
|
||||
plies.add(j1_2);
|
||||
} else {
|
||||
plies.add(j1_1);
|
||||
plies.add(j1_2);
|
||||
plies.add(j1_3);
|
||||
}
|
||||
} else {
|
||||
plies.add(new PlyNim(1, currrentPlayer));
|
||||
plies.add(new PlyNim(2, currrentPlayer));
|
||||
plies.add(new PlyNim(3, currrentPlayer));
|
||||
if (allumette == 1) {
|
||||
plies.add(j2_1);
|
||||
} else if (allumette == 2) {
|
||||
plies.add(j2_1);
|
||||
plies.add(j2_2);
|
||||
} else {
|
||||
plies.add(j2_1);
|
||||
plies.add(j2_2);
|
||||
plies.add(j2_3);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return plies.iterator();
|
||||
}
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user