Share Pastebin
Guest
Public paste!

virgil

By: a guest | Mar 16th, 2010 | Syntax: C++ | Size: 0.99 KB | Hits: 47 | Expires: Never
Copy text to clipboard
  1. Etat * courant = new Etat ( L->getorigX()-1, L->getorigY()-1 ) ;
  2.        
  3. while ( ! liste_ouv.empty() ) {
  4.    
  5.     liste_ouv.push_back ( courant ) ;
  6.     successeurs = courant->generer_fils ( L ) ;
  7.    
  8.     if ( courant->est_sorti ( L ) ) {
  9.         return liste_ferm ;
  10.     }
  11.    
  12.     for ( itS = successeurs.begin() ; itS != successeurs.end() ; itS ++ ) {
  13.         if ( ! ( est_dans_liste ( *itS, liste_ferm ) ) ) {
  14.             if ( est_dans_liste ( *itS, liste_ouv ) ) {
  15.                 h = (*itS).getH() ; // recupere l'ancien cout
  16.                 (*itS).setH ( L ) ; // calcule le nouveau cout
  17.                 if ( h < (*itS).getH() ) {
  18.                     (*itS).setH ( h ) ;
  19.                 }
  20.             }
  21.             else {
  22.                 (*itS).setH() ;
  23.                 liste_ouv.push_back ( *itS ) ;
  24.             }
  25.         }    
  26.     }
  27.  
  28.     courant = meilleur_noeud ( liste_ouv ) ;
  29.     liste_ferm.push_back ( courant ) ;
  30.     effacer ( courant, liste_ouv ) ;
  31.        
  32.  
  33. }