import java.util.StringTokenizer;

/**
 * Write a description of class Animer here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */

public class Animer
{
    // instance variables - replace the example below with your own
    private String nom;

    /**
     * An example of a method - replace this comment with your own
     * 
     * @param  y    a sample parameter for a method
     * @return        the sum of x and y 
     */
    public Animer(String nom){
     this.nom=nom;
    }
    
    public String getNom()
    {
      return this.nom;
    }
    public Commande deplacerAleatoire(Piece pc)
    {  
        String[] d=new String[5];
        String direction=pc.descriptionSorties();
        StringTokenizer tok = new StringTokenizer(direction);
        
      int i=0,cpt=0;
		while(tok.hasMoreTokens()) 
		{
		     d[i]=tok.nextToken();
		    i++;
		}	
		for(i=1;i<5;i++)
		  if(!(d[i].equals("")))
		    cpt++;
		    
		if(cpt==0)
		{ 
		   return new Commande("retour","");
		}
		else
		{
		    
           return new Commande("aller","nord");
        }
    }
    public void deplacer(Piece pc,Piece ps)
    {  
       
       if(pc.RechercheSupprime(this.getNom()))
       {
            ps.ajouAnimer(this);
       }
    }
   
    
}

@@ -14,1039 +14,323 @@
 til.
-StringTokenizer;%0A%0A/**%0A * Write a description of class Animer here.%0A * %0A * @author (your name) %0A * @version (a version number or a date)%0A */%0A%0Apublic class Animer%0A%7B%0A    // instance variables - replace the example below with your own%0A    private String nom;%0A%0A    /**%0A     * An example of a method - replace this comment with your own%0A     * %0A     * @param  y    a sample parameter for a method%0A     * @return        the sum of x and y %0A     */%0A    public Animer(String nom)%7B%0A     this.nom=nom;%0A    %7D%0A    %0A    public String getNom()%0A    %7B%0A      return this.nom;%0A    %7D%0A    public Commande deplacerAleatoire(Piece pc)%0A    %7B  %0A        String%5B%5D d=new String%5B5%5D;%0A        String direction=pc.descriptionSorties();%0A        StringTokenizer tok = new StringTokenizer(direction);%0A        %0A      int i=0,cpt=0;%0A%09%09while(tok.hasMoreTokens()) %0A%09%09%7B%0A%09%09     d%5Bi%5D=tok.nextToken();%0A%09%09    i++;%0A%09%09%7D%09%0A%09%09for(i=1;i%3C5;i++)%0A%09%09  if(!(d%5Bi%5D.equals(%22%22)))%0A%09%09    cpt++;%0A%09%09    %0A%09%09if(cpt==0)%0A%09%09%7B %0A%09%09   return new Commande(%22retour%22,%22%22);%0A%09%09%7D%0A%09%09else%0A%09%09%7B%0A%09%09    %0A
+Random;%0A%0Apublic class Animer extends Data %7B%0A    private final static String direction %5B%5D = %7B%22nord%22, %22sud%22, %22est%22, %22ouest%22%7D;%0A    public Animer(String nom, int poids, boolean etat) %7B%0A        this.nom = nom;%0A        this.poids = poids;%0A        this.etat = etat;%0A    %7D%0A%0A    public Commande deplacerAleatoire()%7B%0A 
        
-    
 retu
@@ -350,211 +350,71 @@
 de(%22
-a
+A
 ller%22,
-%22nord%22);%0A        %7D%0A    %7D%0A    public void deplacer(Piece pc,Piece ps)%0A    %7B  %0A       %0A       if(pc.RechercheSupprime(this.getNom()))%0A       %7B%0A            ps.ajouAnimer(this
+direction%5Bnew Random().nextInt(direction.length)%5D
 );%0A    
- 
-  %7D%0A    %7D%0A   %0A    
+%7D
 %0A%7D%0A

Update Animer.java