get{return this.deplacement;}
set{this.deplacement=value;}
{Console.WriteLine("Espèce : loup");}
{Console.WriteLine("Espèce : chevreuil");}
{Console.WriteLine("La case est vide");}
Console.WriteLine("Vie :"+this.vie);
Console.WriteLine("Niveau de nourriture :"+this.etat);
Console.WriteLine("Déplacement :"+this.deplacement);
static Cellule[,] RemplissageAleatoire(int tauxLoup, int tauxChevreuil, int nourritInitial)
Console.WriteLine("Saisir la hauteur de la grille !");
int n=Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Saisir la largeur de la grille !");
int m=Convert.ToInt32(Console.ReadLine());
Cellule[,] grille=new Cellule[n,m];
int nombreDeLoup=Convert.ToInt32(n*m*tauxLoup/100);
int nombreDeChevreuil=Convert.ToInt32(n*m*tauxChevreuil/100);
grille[i,j]=new Cellule(0);
while ( nbloup <nombreDeLoup)
Random ligne= new Random();
Random colonne= new Random();
int C=colonne.Next(0,m-1);
grille[L,C]= new Cellule(1);
grille[L,C].Etat=nourritInitial;
while ( nbchevreuil <nombreDeChevreuil)
Random ligne= new Random();
Random colonne= new Random();
int C=colonne.Next(0,m-1);
grille[L,C]= new Cellule(2);
static void Affichage(Cellule[,] plateau)
int n=plateau.GetLength(0);
int m=plateau.GetLength(1);
ligne+=plateau[i,j].Type+";";
Console.WriteLine(ligne);
static int NombreVoisinsVide(Cellule[,] tab,int i, int j)
int nombreDeVoisinsVide=0;
if (tab[i-1,j-1].Type==0)
{ nombreDeVoisinsVide++;}
{ nombreDeVoisinsVide++;}
if (tab[i-1,j+1].Type==0)
{ nombreDeVoisinsVide++;}
{ nombreDeVoisinsVide++;}
{ nombreDeVoisinsVide++;}
if (tab[i+1,j-1].Type==0)
{ nombreDeVoisinsVide++;}
{ nombreDeVoisinsVide++;}
if (tab[i+1,j+1].Type==0)
{ nombreDeVoisinsVide++;}
return nombreDeVoisinsVide;
static void Deplacement(Cellule[,] tab, int nourChevreuil, int ourritNaissance, int minVoisins, int probaNaissChevreuil, int probaNaissLoup, int maxNourriture, int NourritNaissance)
if (NombreVoisinsVide(tab,i,j)>=minVoisins)
Random rand= new Random();
int Naissance=rand.Next(0,100);
if (Naissance<probaNaissChevreuil)
else if(NombreVoisinsVide(tab,i,j)!=0)
{ Random l= new Random();
if (tab[i-1,j-1].Type==2 || tab[i,j-1].Type==2 || tab[i+1,j-1].Type==2 || tab[i,j-1].Type==2 || tab[i,j+1].Type==2 || tab[i+1,j-1].Type==2 || tab[i+1,j].Type==2 || tab[i+1,j+1].Type==2)
tab[i,j].Etat+= nourChevreuil;
if(NombreVoisinsVide(tab,i,j)!=0)
public static void Main()
Cellule[,] tab=RemplissageAleatoire(14,20);