Advertisement
Guest User

Untitled

a guest
Apr 26th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.60 KB | None | 0 0
  1. bool estValide (int tab[9][9],int position){
  2.     int i,j,nb;
  3.  
  4.     if(position==81){
  5.         return true;
  6.     }
  7.     i=position/9;
  8.     j=position%9;
  9.     if(tab[i][j]!=0){
  10.         return estValide(tab, position+1);
  11.     }
  12.     else{
  13.             for(nb=1;nb<=9;nb++){
  14.                 if(absentSurLigne(nb,tab,i) && absentSurColonne(nb,tab,j) && absentSurBloc(nb,tab,i,j)){
  15.                     tab[i][j]=nb;
  16.  
  17.                     if(estValide(tab,position+1)){
  18.                     return true;
  19.                     }
  20.                 }
  21.             }
  22.         }
  23.     tab[i][j]=0;
  24.     return false;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement