2024-11-11 14:47:28 +01:00
|
|
|
#include <graph.h>
|
|
|
|
|
|
2024-11-12 23:57:03 +01:00
|
|
|
#include "menu.h"
|
2024-11-13 11:07:47 +01:00
|
|
|
#include "comportementJCJ.h"
|
|
|
|
|
#include "comportementJCIA.h"
|
2024-11-11 14:47:28 +01:00
|
|
|
|
2024-11-18 16:15:25 +01:00
|
|
|
int Jeu(){
|
|
|
|
|
int choix[2], taille = 0, victoire = 0;
|
2024-11-19 13:36:11 +01:00
|
|
|
Menu(choix); /* Affiche le menu */
|
2024-11-13 11:07:47 +01:00
|
|
|
taille = choix[1];
|
2024-11-19 13:36:11 +01:00
|
|
|
if(choix[0] == 1){ /* Si l'utilisateur choisie Player VS Player */
|
2024-11-18 16:15:25 +01:00
|
|
|
victoire = compJCJ(taille);
|
2024-11-19 13:36:11 +01:00
|
|
|
if(victoire == 1){ /* Si le joueur 1 a gagner alors retourner 1 */
|
2024-11-18 16:15:25 +01:00
|
|
|
return 1;
|
|
|
|
|
}else if(victoire == 2){
|
2024-11-19 13:36:11 +01:00
|
|
|
return 2; /* Si le joueur 2 a gagner alors retourner 2 */
|
2024-11-18 16:15:25 +01:00
|
|
|
}
|
2024-11-19 13:36:11 +01:00
|
|
|
}else if (choix[0] == 2){ /* Si l'utilisateur choisie Player VS IA */
|
2024-11-13 11:07:47 +01:00
|
|
|
compJCIA(taille);
|
2024-11-18 16:15:25 +01:00
|
|
|
if(victoire == 1){
|
2024-11-19 13:36:11 +01:00
|
|
|
return 1; /* Si le joueur 1 a gagner alors retourner 1 */
|
2024-11-18 16:15:25 +01:00
|
|
|
}else if(victoire == 3){
|
2024-11-19 13:36:11 +01:00
|
|
|
return 3; /* Si l'IA a gagner alors retourner 3 */
|
2024-11-18 16:15:25 +01:00
|
|
|
}
|
2024-11-12 23:57:03 +01:00
|
|
|
}
|
2024-11-19 13:36:11 +01:00
|
|
|
return 0;
|
2024-11-11 14:47:28 +01:00
|
|
|
}
|