suite et presque fin

This commit is contained in:
Mathieu PROAL 2022-11-28 16:55:10 +01:00
parent e844b95022
commit 7cfa6e09db

View File

@ -4,78 +4,57 @@
#include <time.h> #include <time.h>
#include "images.h" #include "images.h"
/*int aleatoire(int* tab[40]){ int main(void){
InitialiserGraphique();
ChoisirEcran(0);
CreerFenetre(0,0,1024,576);
char tirage[50];
int pos_x, pos_y;
int i, j;
int nb; int nb;
int position[20][4]; int tab[40];
nb=rand()%20; int nb_paires;
if (position[nb][0]<10){
position[nb][0]=pos_x; printf("Combien de paires ? --> ");
position[nb][1]=pos_y; scanf("%d", &nb_paires);
return nb;
ChargerImage("Images/background.png",0,0,0,0,1024,576);
for (i=0;i<40;i++){
tab[i]=0;
} }
else if (position[nb][2]<10){
position[nb][2]=pos_x; srand(time(NULL));
position[nb][3]=pos_y; for (i=0;i<2;i++){
return nb; for (j=0;j<nb_paires+1;j++){
nb=rand()%(nb_paires*2);
if (tab[nb]!=0){
j--;
} }
else{ else{
aleatoire(pos_x, pos_y);
}
return tab[40];
}*/
int main(void){
/*InitialiserGraphique();
ChoisirEcran(0);
CreerFenetre(0,0,1024,576);*/
char tirage[50];
int tire;
int pos_x, pos_y;
int i, j, n;
int nb;
/*int position[20][4];*/
int tab[40];
//ChargerImage("Images/background.png",0,0,0,0,1024,576);
j=1;
n=1;
srand(time(NULL));
for (i=0;i<40;i++){
nb=rand()%40;
while (tab[nb]==0){
nb++;
if (nb==20){
nb=0;
}
}
printf("%d\n", nb);
tab[nb]=j; tab[nb]=j;
n++;
if (n==3){
j++;
n=1;
} }
} }
/* }
for (i=0; i<40; i++){
printf("%d\n", tab[i]);
}*/
/*Tirage des images*/ /*Tirage des images*/
/*srand(time(NULL)); srand(time(NULL));
i=0;
for (pos_y=10;pos_y<380;pos_y=pos_y+90){ for (pos_y=10;pos_y<380;pos_y=pos_y+90){
for (pos_x=10;pos_x<650;pos_x=pos_x+90){ for (pos_x=10;pos_x<650;pos_x=pos_x+90){
snprintf(tirage,50,"Images/image%d.png",tire); if (tab[i]==0){
ChargerImage(tirage,pos_x,pos_y,0,0,80,80); pos_y=1000;
}
snprintf(tirage,50,"Images/image%d.png",tab[i]);
ChargerImage(tirage,pos_x,pos_y,0,0,80,80);
i++;
}
} }
}*/
//Touche(); Touche();
//FermerGraphique(); FermerGraphique();
printf("\n");
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }