ralentissement ia

This commit is contained in:
gwiz 2020-12-06 12:05:38 +01:00
parent e7ee583c2f
commit 1cba55e095

View File

@ -9,17 +9,16 @@ import java.awt.*;
import java.util.Random; import java.util.Random;
public class IA extends RealisateurDeDeplacement { public class IA extends RealisateurDeDeplacement {
int genererInt(int borneInf, int borneSup){ int alt = 0;
Random rand = new Random();
int nb;
nb = borneInf+rand.nextInt(borneSup-borneInf);
return nb;
}
protected boolean realiserDeplacement() { protected boolean realiserDeplacement() {
for (ElementDynamique e : lstEntitesDynamiques) for (ElementDynamique e : lstEntitesDynamiques)
if (e instanceof modele.donnees.IA) { if (e instanceof modele.donnees.IA) {
e.avancerDirectionChoisie(null); if(alt < 3){
alt++;
}else{
e.avancerDirectionChoisie(null);
alt = 0;
}
} }
return false; return false;