bonjour
j ai un problème avec l exécution de mon programme j ai le message d erreur suivant

Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 8
at Labyrinthe.TrouverSortie(Labyrinthe.java:45)
at LabyrintheTest.main(LabyrintheTest.java:93)

voila le code source
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
 
import java.util.*;
 
public class Labyrinthe {
 
	// Enum�ration d�finissant les types de planchers 
	public enum TuileLabyrinthe
	{ MUR, LIBRE, VISITE, SORTIE }
 
	// Classe position d�finissant une position dans le labyrinthe
	public static class Position
	{
		private int m_x, m_y;  // Position dans le labyrinthe
 
		// Constructeurs
		public Position()
		{ m_x = -1; m_y = -1;}
		public Position(int x,int y)
		{ m_x = x; m_y = y; }
		public Position(Position p)
		{ m_x = p.m_x; m_y = p.m_y; }
 
		// Accesseurs
		public int getX() { return m_x;}
		public int getY() { return m_y;}
		public void setX(int x) { m_x = x; }
		public void setY(int y) { m_y = y; }
 
		// toString
		public String toString()
		{
			String s = new String("P(" + m_x + "," + m_y + ")");
			return s;
		}
	}
 
	public Position TrouverSortie(Position depart, TuileLabyrinthe[][] map)
	{   
 
		Position sortie = new Position();
		Stack<Position> pile = new Stack<Position>();
		pile.push(depart);
		while(!pile.empty())
		{
	Position	 current = new Position(pile.pop());
			if(map[current.getX()][current.getY()] ==TuileLabyrinthe.SORTIE )
			{	
				sortie=current;
				pile.clear();
			}
			else
				if((map[current.getX()][current.getY()]!=TuileLabyrinthe.MUR ) && (map[current.getX()][current.getY()]!= TuileLabyrinthe.VISITE ))
				{	
					map[current.getX()][current.getY()]=TuileLabyrinthe.VISITE;
					pile.push(new Position(current.getX(),current.getY()-1));
					pile.push(new Position(current.getX(),current.getY()+1));
					pile.push(new Position(current.getX()-1,current.getY()));
					pile.push(new Position(current.getX()+1,current.getY()));
				}
 
 
 
	}
	return sortie;
	}
}