echange de pc

This commit is contained in:
2024-11-18 16:15:25 +01:00
parent 16bb47eb28
commit 883aff1bec
6 changed files with 23 additions and 22 deletions

View File

@@ -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);

View File

@@ -2,7 +2,7 @@
#define COMPORTEMENTJCJ_H
void compJCJ(int taille);
int compJCJ(int taille);
#endif

BIN
game

Binary file not shown.

16
jeu.c
View File

@@ -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;
}
}
}

2
jeu.h
View File

@@ -2,7 +2,7 @@
#define JEU_H
void GraphJeu();
int GraphJeu();
#endif

3
main.c
View File

@@ -3,8 +3,9 @@
#include "jeu.h"
int main (void){
int victoire = 0;
InitialiserGraphique();
CreerFenetre(50, 50, 700, 500); /* Initialise la fenetre puis lance le programme jeu.c qui lancera d'autre programme */
EffacerEcran(CouleurParNom("white"));
Jeu();
victoire = Jeu();
}