Modification de la condition de fin du jeu
- Le jeu se termine désomrais lorsque toutes les paires ont été trouvées
This commit is contained in:
parent
44dc496861
commit
866ff56793
@ -27,7 +27,7 @@ int update_coups(int coups) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int game(int colonnes, int lignes) {
|
int game(int colonnes, int lignes) {
|
||||||
int i, j, t, used, r, l, c, case_max_width, case_max_height, case_max_dimensions, case_margin, boucle, coups;
|
int i, j, t, used, r, l, c, case_max_width, case_max_height, case_max_dimensions, case_margin, boucle, coups, nb_paires_trouvees;
|
||||||
unsigned long int timer;
|
unsigned long int timer;
|
||||||
char *file = (char*)malloc(30 * sizeof(char));
|
char *file = (char*)malloc(30 * sizeof(char));
|
||||||
size_t k, m;
|
size_t k, m;
|
||||||
@ -114,8 +114,8 @@ int game(int colonnes, int lignes) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
boucle = 1;
|
nb_paires_trouvees = 0;
|
||||||
while (boucle) {
|
while (nb_paires_trouvees < ((colonnes * lignes) / 2)) {
|
||||||
update_timer(timer);
|
update_timer(timer);
|
||||||
|
|
||||||
SourisPosition();
|
SourisPosition();
|
||||||
@ -130,6 +130,7 @@ int game(int colonnes, int lignes) {
|
|||||||
if (cards[l][c].id == last_card->id) {
|
if (cards[l][c].id == last_card->id) {
|
||||||
last_card->found = 1;
|
last_card->found = 1;
|
||||||
cards[l][c].found = 1;
|
cards[l][c].found = 1;
|
||||||
|
nb_paires_trouvees++;
|
||||||
} else {
|
} else {
|
||||||
wait(1);
|
wait(1);
|
||||||
cards[l][c] = hide_card(carte0, cards[l][c]);
|
cards[l][c] = hide_card(carte0, cards[l][c]);
|
||||||
|
Loading…
Reference in New Issue
Block a user