echange de pc
This commit is contained in:
@@ -10,7 +10,7 @@
|
||||
#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 maxX = 0, maxY = 0, joueurx1 = 0, joueury1 = 0, joueurx2 = 0, joueury2 = 0, placer = 1;
|
||||
int emplacementcooX1 = 0, emplacementcooX2 = 0, emplacementcooY1 = 0, emplacementcooY2 = 0;
|
||||
@@ -44,12 +44,6 @@ void compJCJ(int taille){
|
||||
initialiser++;
|
||||
SourisX = 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();
|
||||
EcrireTexte(30, 40, "Joueur 2 choisissez l'emplacement de base du pion 2", 1);
|
||||
}
|
||||
@@ -68,13 +62,6 @@ void compJCJ(int taille){
|
||||
}
|
||||
SourisX = 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;
|
||||
}
|
||||
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(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;
|
||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||
RemplirRectangle(emplacementcooX1, emplacementcooY1, 40, 40);
|
||||
@@ -163,7 +153,7 @@ void compJCJ(int taille){
|
||||
}
|
||||
VerifBlock1(SourisX, SourisY, maxX, maxY, taille, empperso);
|
||||
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;
|
||||
ChoisirCouleurDessin(CouleurParNom("white"));
|
||||
RemplirRectangle(emplacementcooX2, emplacementcooY2, 40, 40);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#define COMPORTEMENTJCJ_H
|
||||
|
||||
|
||||
void compJCJ(int taille);
|
||||
int compJCJ(int taille);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
16
jeu.c
16
jeu.c
@@ -4,13 +4,23 @@
|
||||
#include "comportementJCJ.h"
|
||||
#include "comportementJCIA.h"
|
||||
|
||||
void Jeu(){
|
||||
int choix[2], taille = 0;
|
||||
int Jeu(){
|
||||
int choix[2], taille = 0, victoire = 0;
|
||||
Menu(choix);
|
||||
taille = choix[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){
|
||||
compJCIA(taille);
|
||||
if(victoire == 1){
|
||||
return 1;
|
||||
}else if(victoire == 3){
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user