public class ParcoursLabyrinthe2 {

  static boolean rechercheSortieLabyrinthe(int lo,int co,int l,int c,int [][] lb) {
    boolean res = false;
    if ( lb[l][c] != 0 ) {
      if ( lb[l][c] == 9 ) {
        Ecran.afficherln(l," ",c);
        res = true; }
        else {
        if ( ( l+1 != lo ) || ( c != co ) ) {
          res = rechercheSortieLabyrinthe(l,c,l+1,c,lb); }
        if ( ( res == false ) && ( ( l-1 != lo ) || ( c != co ) ) ) {
            res = rechercheSortieLabyrinthe(l,c,l-1,c,lb); }
        if ( ( res == false ) && ( ( l != lo ) || ( c+1 != co ) ) ) {
            res = rechercheSortieLabyrinthe(l,c,l,c+1,lb); }
        if ( ( res == false ) && ( ( l != lo ) || ( c-1 != co ) ) ) {
            res = rechercheSortieLabyrinthe(l,c,l,c-1,lb); } } }
    return res;
  }

  static void rechercheSortieLabyrinthe(int l,int c,int [][] lb) {
    rechercheSortieLabyrinthe(0,0,l,c,lb);
  }
  
  public static void main(String [] args) {
    int [][] lb = { { 0,0,0,0,0,0,0,0,0,0,0,0 },
                    { 0,1,0,1,1,1,0,1,1,1,1,0 },
                    { 0,1,0,1,0,0,0,1,0,1,0,0 },
                    { 0,1,1,1,1,1,0,1,0,1,1,0 },
                    { 0,1,0,0,0,1,0,0,0,1,0,0 },
                    { 0,1,0,1,1,1,1,1,1,1,1,0 },
                    { 0,1,0,0,0,1,0,0,1,0,0,0 },
                    { 0,1,1,0,0,1,0,1,1,1,1,0 },
                    { 0,0,0,0,0,1,0,1,0,0,9,0 },
                    { 0,0,0,0,0,0,0,0,0,0,0,0 } };
    rechercheSortieLabyrinthe(1,1,lb);
  }
}