echange de pc
This commit is contained in:
@@ -10,7 +10,7 @@
|
|||||||
#include "verificationblock.h"
|
#include "verificationblock.h"
|
||||||
|
|
||||||
|
|
||||||
void compJCJ(int taille){
|
int compJCJ(int taille){
|
||||||
int fin = 0, tabx = 0, taby = 0, tour = 0, initi = 0, SourisX = 0, SourisY = 0, x = 50, y = 100, initialiser = 0;
|
int fin = 0, tabx = 0, taby = 0, tour = 0, initi = 0, SourisX = 0, SourisY = 0, x = 50, y = 100, initialiser = 0;
|
||||||
int maxX = 0, maxY = 0, joueurx1 = 0, joueury1 = 0, joueurx2 = 0, joueury2 = 0, placer = 1;
|
int maxX = 0, maxY = 0, joueurx1 = 0, joueury1 = 0, joueurx2 = 0, joueury2 = 0, placer = 1;
|
||||||
int emplacementcooX1 = 0, emplacementcooX2 = 0, emplacementcooY1 = 0, emplacementcooY2 = 0;
|
int emplacementcooX1 = 0, emplacementcooX2 = 0, emplacementcooY1 = 0, emplacementcooY2 = 0;
|
||||||
@@ -44,12 +44,6 @@ void compJCJ(int taille){
|
|||||||
initialiser++;
|
initialiser++;
|
||||||
SourisX = 0;
|
SourisX = 0;
|
||||||
SourisY = 0;
|
SourisY = 0;
|
||||||
for(tabx = 0; tabx < taille + 2; tabx++){
|
|
||||||
for(taby = 0; taby < taille + 2; taby++){
|
|
||||||
printf("%d", grille[tabx][taby]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
Efface();
|
Efface();
|
||||||
EcrireTexte(30, 40, "Joueur 2 choisissez l'emplacement de base du pion 2", 1);
|
EcrireTexte(30, 40, "Joueur 2 choisissez l'emplacement de base du pion 2", 1);
|
||||||
}
|
}
|
||||||
@@ -68,13 +62,6 @@ void compJCJ(int taille){
|
|||||||
}
|
}
|
||||||
SourisX = 0;
|
SourisX = 0;
|
||||||
SourisY = 0;
|
SourisY = 0;
|
||||||
for(tabx = 0; tabx < taille + 2; tabx++){
|
|
||||||
for(taby = 0; taby < taille + 2; taby++){
|
|
||||||
printf("%d", grille[tabx][taby]);
|
|
||||||
}
|
|
||||||
printf("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -92,8 +79,11 @@ void compJCJ(int taille){
|
|||||||
SourisY = _Y;
|
SourisY = _Y;
|
||||||
}
|
}
|
||||||
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
|
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
|
||||||
|
if(grille[joueury1+1 != 0 && joueury1-1 != 0 && joueurx1+1 != 0 && joueurx1-1 != 0){
|
||||||
|
printf("\n\nechec\n\n");
|
||||||
|
}
|
||||||
if(empperso[0] != 0){
|
if(empperso[0] != 0){
|
||||||
if(grille[empperso[1]][empperso[0]] == 0){
|
if(grille[empperso[1]][empperso[0]] == 0 && (empperso[1] <= joueury1+1 && empperso[1] >= joueury1-1) && (empperso[0] <= joueurx1+1 && empperso[0] >= joueurx1-1)){
|
||||||
grille[joueury1][joueurx1] = 0;
|
grille[joueury1][joueurx1] = 0;
|
||||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||||
RemplirRectangle(emplacementcooX1, emplacementcooY1, 40, 40);
|
RemplirRectangle(emplacementcooX1, emplacementcooY1, 40, 40);
|
||||||
@@ -163,7 +153,7 @@ void compJCJ(int taille){
|
|||||||
}
|
}
|
||||||
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
|
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
|
||||||
if(empperso[0] != 0){
|
if(empperso[0] != 0){
|
||||||
if(grille[empperso[1]][empperso[0]] == 0){
|
if(grille[empperso[1]][empperso[0]] == 0 && (empperso[1] <= joueury2+1 && empperso[1] >= joueury2-1) && (empperso[0] <= joueurx2+1 && empperso[0] >= joueurx2-1)){
|
||||||
grille[joueury2][joueurx2] = 0;
|
grille[joueury2][joueurx2] = 0;
|
||||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||||
RemplirRectangle(emplacementcooX2, emplacementcooY2, 40, 40);
|
RemplirRectangle(emplacementcooX2, emplacementcooY2, 40, 40);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
#define COMPORTEMENTJCJ_H
|
#define COMPORTEMENTJCJ_H
|
||||||
|
|
||||||
|
|
||||||
void compJCJ(int taille);
|
int compJCJ(int taille);
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
16
jeu.c
16
jeu.c
@@ -4,13 +4,23 @@
|
|||||||
#include "comportementJCJ.h"
|
#include "comportementJCJ.h"
|
||||||
#include "comportementJCIA.h"
|
#include "comportementJCIA.h"
|
||||||
|
|
||||||
void Jeu(){
|
int Jeu(){
|
||||||
int choix[2], taille = 0;
|
int choix[2], taille = 0, victoire = 0;
|
||||||
Menu(choix);
|
Menu(choix);
|
||||||
taille = choix[1];
|
taille = choix[1];
|
||||||
if(choix[0] == 1){
|
if(choix[0] == 1){
|
||||||
compJCJ(taille);
|
victoire = compJCJ(taille);
|
||||||
|
if(victoire == 1){
|
||||||
|
return 1;
|
||||||
|
}else if(victoire == 2){
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}else if (choix[0] == 2){
|
}else if (choix[0] == 2){
|
||||||
compJCIA(taille);
|
compJCIA(taille);
|
||||||
|
if(victoire == 1){
|
||||||
|
return 1;
|
||||||
|
}else if(victoire == 3){
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
jeu.h
2
jeu.h
@@ -2,7 +2,7 @@
|
|||||||
#define JEU_H
|
#define JEU_H
|
||||||
|
|
||||||
|
|
||||||
void GraphJeu();
|
int GraphJeu();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
3
main.c
3
main.c
@@ -3,8 +3,9 @@
|
|||||||
#include "jeu.h"
|
#include "jeu.h"
|
||||||
|
|
||||||
int main (void){
|
int main (void){
|
||||||
|
int victoire = 0;
|
||||||
InitialiserGraphique();
|
InitialiserGraphique();
|
||||||
CreerFenetre(50, 50, 700, 500); /* Initialise la fenetre puis lance le programme jeu.c qui lancera d'autre programme */
|
CreerFenetre(50, 50, 700, 500); /* Initialise la fenetre puis lance le programme jeu.c qui lancera d'autre programme */
|
||||||
EffacerEcran(CouleurParNom("white"));
|
EffacerEcran(CouleurParNom("white"));
|
||||||
Jeu();
|
victoire = Jeu();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user