package fr.iut_fbleau.HexGame; import fr.iut_fbleau.GameAPI.*; import java.util.EnumMap; import java.util.LinkedList; public class Simulation extends AbstractGame { //ATTRIBUTS private HexPly bestmove; private float bestoutcome; private int MAXDEPTH = 6; private LinkedList taken = new LinkedList(); //ATTRIBUTS QUE JE NE VOUDRAIS PAS CRÉER IDÉALEMENT private IBoard simCurrentBoard; private EnumMap simmapPlayers; //CONSTRUCTEUR public Simulation(IBoard b, EnumMap m){ super(b, m); simCurrentBoard = b; simmapPlayers = m; } //METHODES private float explMAX(HexBoard position, int depth){ if (position.getResult()==Result.LOSS) { return -1.0f; } else if (position.getResult()==Result.WIN){ return 1.0f; } else if (depth==MAXDEPTH) { return 0f; } else { float bestcase = -1.0f; HexPly bestcasemove; HexPly testmove; for (int i=0; i= bestcase) { //System.out.println(" MAX new best case"); bestcase = val; bestcasemove = testmove; if (depth==0) { this.bestoutcome = bestcase; this.bestmove = bestcasemove; } } position.undoPly(); taken.remove(t); } } } return bestcase; } } private float explMIN(HexBoard position, int depth){ if (position.getResult()==Result.LOSS) { return -1.0f; } else if (position.getResult()==Result.WIN){ return 1.0f; } else if (depth==MAXDEPTH) { return 0f; } else { float bestcase = 1.0f; HexPly bestcasemove; HexPly testmove; for (int i=0; i