Modularité de la taille de la grille et condition de victoire
This commit is contained in:
parent
1c87aaf83e
commit
4dd9b7c9d6
18
affichage.c
18
affichage.c
@ -1,7 +1,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <graph.h>
|
||||
#define GRILLE_X 5
|
||||
#define GRILLE_X 4
|
||||
#define GRILLE_Y 4
|
||||
|
||||
int Trouvee(int* found, int carte){
|
||||
@ -112,7 +112,7 @@ void GenererGrille(int x_grille, int y_grille, int tab[4][5]){
|
||||
}
|
||||
coos[0] = rand()%x_grille;
|
||||
coos[1] = rand()%y_grille;
|
||||
for (i=0;i<10;i++){
|
||||
for (i=0;i<(x_grille*y_grille)/2;i++){
|
||||
for (j=0;j<2;j++){
|
||||
while (1){
|
||||
coos[0] = rand()%x_grille;
|
||||
@ -129,6 +129,13 @@ void Triche(int* triche){
|
||||
*triche = -(*triche);
|
||||
}
|
||||
|
||||
int Victoire(int* found, int x_grille, int y_grille){
|
||||
int i,j;
|
||||
for (i=0;i<(x_grille*y_grille)/2;i++){
|
||||
if (found[i] == 0) return 0;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
void InsereTableau(int val, int* tab){
|
||||
@ -142,7 +149,7 @@ void InsereTableau(int val, int* tab){
|
||||
}
|
||||
|
||||
int main(void){
|
||||
int tab[GRILLE_Y][GRILLE_X] = {{},{},{},{}};
|
||||
int tab[4][5] = {{},{},{},{}};
|
||||
int o;
|
||||
int timerStop;
|
||||
int i,j;
|
||||
@ -210,7 +217,10 @@ int main(void){
|
||||
DessinerGrille(GRILLE_X,GRILLE_Y,1500,844,0,found,tab);
|
||||
|
||||
}
|
||||
|
||||
if (Victoire(found,GRILLE_X,GRILLE_Y)){
|
||||
printf("Victoire !\n");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
FermerGraphique();
|
||||
|
Loading…
Reference in New Issue
Block a user