void step(int** grille1, int** grille2) { // grille de taille 60x60
// We can hard-code the different surrounding tiles. For example, the tile directly to the right is the current tile plus one.
int dir[8] = {1, 61, 60, 59, 3599, 3539, 3540, 3541}; // to get the tile above a certain tile, simply consider tile number (t+dir[6])%3600
for (int i = 0; i < 60; ++i) {
for (int j = 0; j < 60; ++j) {
int cntr = 0;
for (int k = 0; k < 8; ++k) {
cntr += (*grille1)[(60*i+j+dir[k])%3600];
}
if ((*grille1)[60*i + j] == 0 && cntr == 3) (*grille2)[60*i+j] = 1;
else if ((*grille1)[60*i+j] == 1 && (cntr == 2 || cntr == 3)) (*grille2)[60*i+j] = 1;
else (*grille2)[60*i+j] = 0;
}
}
int* tmp = *grille1;
*grille1 = *grille2;
*grille2 = tmp;
return;
}
typedef struct couple_t{
int x;
int y;
} couple;
typedef struct graphe_t{
int n;
couple *v;
int **aretes;
} graphe;
couple * def_v(int n){
couple *v = malloc(n*sizeof(couple));
int indice = 0;
for(int i=1; i<n; i +=2){
for(int j=1; j<n; j+=2){
couple c;
c.x = i; c.y = j;
v[indice] = c;
}
}
return v; //v donne croespondance entre i et couple
}
struct gaussint lire(char *s){ //s est de la bonne forme
int i=0;
struct gaussint z;
z.re = 0; z.im =0;
int neg = 0;
if (s[0] == '-'){
neg = 1; i++;
}
while(s[i] != '+' && s[i] != '-'){
z.re = z.re*10 + s[i]-48; //0
i++;
}
if(neg == 1) z.re *= -1;
if (s[i]=='+') neg = 0;
else neg = 1;
i++;
while(s[i]!='i'){
z.im = z.im*10 + s[i]-48;
i++;
}
if(neg ==1) z.im *= -1;
return z;
}