int inversionPions(int table[8][8], int couleur, int i, int j) { int encadrement(int table[8][8], int couleur, int i, int j, int dir[2]) ; int n, ci, cj, x=0; int dir[8][2]={{-1, -1}, {-1, 0}, {-1, 1}, {0, -1}, {0, 1}, {1, -1}, {1, 0}, {1, 1}}; for ( n=0; n<8; n++ ) { ci=i, cj=j; if ( encadrement(table, couleur, ci+dir[n][0], cj+dir[n][1], dir[n])==kcorrect ) { while ( table[ci+dir[n][0]][cj+dir[n][1]]==!couleur ) { table[ci+dir[n][0]][cj+dir[n][1]]=couleur; ci+=dir[n][0], cj+=dir[n][1]; x++; } } } return x; }
// Fonction racine carr�e double racine_carree(int x, double precision) { double racine; double binf, bsup; bsup = encadrement(x); binf = bsup - 1; racine = (bsup + binf) / 2; while ((bsup - binf) > precision) { if ((racine * racine) > x) bsup = (bsup + binf) / 2; else binf = (bsup + binf) / 2; racine = (bsup + binf) / 2; } return (racine); }