- int minimax(taulell &t, int color, nat prof, nat metode, coord &cmillor) 
- { 
-   int eval, milloreval_negre=-1000, milloreval_blanc=1000, milloreval; 
-   coord c,caux; 
-   queue<coord> cua = t.coord_pot_jugar(color); 
-     if (prof >= 1){ 
-       for (int i=0;i<cua.size();++i){ 
-         c = cua.front(); 
-         cua.pop(); 
-         taulell t2(t); 
-         t2.posa_fitxa(c,color); 
-         eval = t2.avalua_posicio(); 
-         if (eval > milloreval) { 
-           milloreval = eval; 
-           caux = c; 
-         } 
-       } 
-     } 
-     else { 
-       for (int i=0; i<cua.size();i++){ 
-         c = cua.front(); 
-         cua.pop(); 
-         taulell t2(t); 
-         t2.posa_fitxa(c,color); 
-         color = -color; 
-         if (t2.pot_jugar(color)) eval = minimax(t2,color,prof-1,metode,c); 
-         else eval = minimax(t2,-color,prof-1,metode,c); 
-         if (eval > milloreval){ 
-           milloreval = eval; 
-           caux = c; 
-         } 
-       } 
-     } 
-   //} 
-   cmillor = caux; 
-   return milloreval; 
- } 
-