Comme le titre l'indique c un jeu de puissance 4....Il est en couleur et relativement beau ;-)
Il se joue à 2...Par contre l'ordinateur ne détermine pas lorsque un joueur gagne..c au joueur de le voir..
Source / Exemple :
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<time.h>
/*****************************/
/* */
/* PUISSANCE 4 */
/* BY DJMACOU */
/*****************************/
void main()
{
int x,y, pion1,pion2,n=24,a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,i=0,j=0,k=0,l=0,m=0,numero;
int pos1,pos2,pos3,pos4,pos5,pos6,pos7,pos8,pos9,pos10,pos11,pos12,pos13;
for (x=10;x<50;x++)
{
for (y=5;y<26;y++)
{
gotoxy(x,y);
cprintf("%c",205);
y++;
}
}
/*******AFFICHAGE DES BARRES VERTICALE ET HORIZONTAL*************/
for (y=6;y<25;y++)
{
for (x=10;x<50;x++)
{
gotoxy(x,y);
cprintf("%c",186);
x=x+2;
}
}
/*************AFFICHAGE DES 4 COINS*************************/
gotoxy(10,5);
cprintf("%c",201);
gotoxy(49,5);
cprintf("%c",187);
gotoxy(10,25);
cprintf("%c",200);
gotoxy(49,25);
cprintf("%c",188);
for (x=13;x<47;x++)
{
gotoxy(x,5);
cprintf("%c",203);
gotoxy(x,25);
cprintf("%c",202);
x=x+2;
}
for (y=7;y<25;y++)
{
gotoxy(10,y);
cprintf("%c",204);
gotoxy(49,y);
cprintf("%c",185);
y++;
}
for (x=13;x<47;x++)
{
for (y=7;y<25;y++)
{
gotoxy(x,y);
cprintf("%c",206);
y++;
}
x=x+2;
}
numero=1;
for (x=11;x<49;x++)
{
gotoxy(x,26);
cprintf("%d",numero);
numero++;
x=x+2;
}
/*************FIN DU DESSIN DU CADRE***************/
do
{
gotoxy(4,30);
printf(" ");
gotoxy(4,30);
textcolor(15);
cprintf("joueur *1* placer votre pions (1-13): ");
gotoxy(10,32);
cprintf("*********BY DJMACOU****************");
scanf("%d",&pion1);
textcolor(BLUE);
/****PLACEMENT DES PIONS DANS LA GRILLE*********/
n=24;
if (pion1==1)
{x=11;
if (pos1==1)
{if (a!=0){n=a;}
n=n-2;
a=n;
}
pos1=1;
}
if (pion1==2)
{x=14;
if (pos2==2)
{if (b!=0){n=b;}
n=n-2;
b=n;
}
pos2=2;
}
if (pion1==3)
{x=17;
if (pos3==3)
{if (c!=0){n=c;}
n=n-2;
c=n;
}
pos3=3;
}
if (pion1==4)
{x=20;
if (pos4==4)
{if (d!=0){n=d;}
n=n-2;
d=n;
}
pos4=4;
}
if (pion1==5)
{x=23;
if (pos5==5)
{if (e!=0){n=e;}
n=n-2;
e=n;
}
pos5=5;
}
if (pion1==6)
{x=26;
if (pos6==6)
{if (f!=0){n=f;}
n=n-2;
f=n;
}
pos6=6;
}
if (pion1==7)
{x=29;
if (pos7==7)
{if (g!=0){n=g;}
n=n-2;
g=n;
}
pos7=7;
}
if (pion1==8)
{x=32;
if (pos8==8)
{if (h!=0){n=h;}
n=n-2;
h=n;
}
pos8=8;
}
if (pion1==9)
{x=35;
if (pos9==9)
{if (i!=0){n=i;}
n=n-2;
i=n;
}
pos9=9;
}
if (pion1==10)
{x=38;
if (pos10==10)
{if (j!=0){n=j;}
n=n-2;
j=n;
}
pos10=10;
}
if (pion1==11)
{x=41;
if (pos11==11)
{if (k!=0){n=k;}
n=n-2;
k=n;
}
pos11=11;
}
if (pion1==12)
{x=44;
if (pos12==12)
{if (l!=0){n=l;}
n=n-2;
l=n;
}
pos12=12;
}
if (pion1==13)
{x=47;
if (pos13==13)
{if (m!=0){n=m;}
n=n-2;
m=n;
}
pos13=13;
}
y=n;
gotoxy(x,y);
cprintf("%c%c",219,219);
n=24;
gotoxy(4,30);
printf(" ");
gotoxy(4,30);
textcolor(15);
cprintf("joueur *2* placer votre pions (1-13): ");
scanf("%d",&pion2);
textcolor(RED);
if (pion2==1)
{x=11;
if (pos1==1)
{if (a!=0){n=a;}
n=n-2;
a=n;
}
pos1=1;
}
if (pion2==2)
{x=14;
if (pos2==2)
{if (b!=0){n=b;}
n=n-2;
b=n;
}
pos2=2;
}
if (pion2==3)
{x=17;
if (pos3==3)
{if (c!=0){n=c;}
n=n-2;
c=n;
}
pos3=3;
}
if (pion2==4)
{x=20;
if (pos4==4)
{if (d!=0){n=d;}
n=n-2;
d=n;
}
pos4=4;
}
if (pion2==5)
{x=23;
if (pos5==5)
{if (e!=0){n=e;}
n=n-2;
e=n;
}
pos5=5;
}
if (pion2==6)
{x=26;
if (pos6==6)
{if (f!=0){n=f;}
n=n-2;
f=n;
}
pos6=6;
}
if (pion2==7)
{x=29;
if (pos7==7)
{if (g!=0){n=g;}
n=n-2;
g=n;
}
pos7=7;
}
if (pion2==8)
{x=32;
if (pos8==8)
{if (h!=0){n=h;}
n=n-2;
h=n;
}
pos8=8;
}
if (pion2==9)
{x=35;
if (pos9==9)
{if (i!=0){n=i;}
n=n-2;
i=n;
}
pos9=9;
}
if (pion2==10)
{x=38;
if (pos10==10)
{if (j!=0){n=j;}
n=n-2;
j=n;
}
pos10=10;
}
if (pion2==11)
{x=41;
if (pos11==11)
{if (k!=0){n=k;}
n=n-2;
k=n;
}
pos11=11;
}
if (pion2==12)
{x=44;
if (pos12==12)
{if (l!=0){n=l;}
n=n-2;
l=n;
}
pos12=12;
}
if (pion2==13)
{x=47;
if (pos13==13)
{if (m!=0){n=m;}
n=n-2;
m=n;
}
pos13=13;
}
y=n;
gotoxy(x,y);
cprintf("%c%c",219,219);
}
while (1);
}
Conclusion :
Je pensse que ce prog peut etre optimiser, alors faite vous plaisir si vous voulez le retoucher...
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.