30 lines
467 B
C
30 lines
467 B
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <time.h>
|
|
|
|
int* grille(int taille) {
|
|
srand(time(NULL));
|
|
int i,j;
|
|
int coos[2];
|
|
int tab[taille][taille] = {};
|
|
coos[0] = rand()%taille;
|
|
coos[1] = rand()%taille;
|
|
for (i=0;i<6;i++){
|
|
for (j=0;j<6;j++){
|
|
tab[i][j] = -1;
|
|
}
|
|
}
|
|
for (i=0;i<18;i++){
|
|
for (j=0;j<2;j++){
|
|
while (tab[coos[0]][coos[1]] != -1){
|
|
coos[0] = rand()%6;
|
|
coos[1] = rand()%6;
|
|
}
|
|
tab[coos[0]][coos[1]] = i;
|
|
}
|
|
}
|
|
return tab;
|
|
}
|
|
|
|
|