Jump to content
Sign in to follow this  
andruala

Parere joc x si 0?

Recommended Posts

Este cam greu de urmarit cred...Am folosit multe goto-uri, si am chestii inutile pe care nu le-am sters.


#include<iostream>
#include <cstdlib>
#include <ctime>
#include<windows.h>
using namespace std;
/* 32 spatiu
48 0
88 x */
int main()
{
char pauza[5][3]={{32,32,32},
{32,32,32},
{32,32,32},
{32,32,32},
{32,32,32},
};

char model[5][5] {{'1',186,'2',186,'3'},
{205,206,205,206,205},
{'4',186,'5',186,'6'},
{205,206,205,206,205},
{'7',186,'8',186,'9'},
};


cout<<"LastDroid\n";
for(int j=0;j<5;j++){
for(int k=0;k<5;k++){
cout<<model[j][k];}
cout<<endl;}
cout<<"In locul carei cifre pui `x` boss?\n";
start:


string yn;
int mpc,l,y=0,m=0;
char a,b,c,d,e,f,g,h,i,j,k;
a=b=c=d=e=f=g=h=i=32;
xsi0:
fail:


cin>>l;
m++;

if(l==1){
if(a==32) a=88;
else
{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}
}
if(l==2){
if(b==32) b=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==3){
if(c==32) c=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==4){
if(d==32) d=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==5){
if(e==32) e=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==6){
if(f==32) f=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==7){
if(g==32) g=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==8){
if(h==32) h=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
if(l==9){
if(i==32) i=88;
else{
cout<<"Nu poti sa pui peste...Incearca din nou\n";
goto fail;
}}
//////
if(y==1){
cout<<"\aFelicitari, ai castigat!\n";
goto finish;
}
if(y==2){
cout<<"\aNasol...uneori mai si pierzi.\n";
goto finish;
}
if(y!=1 && y!=2 && m>4){
cout<<"E bine, e remiza.\n\a";
m=0;
goto finish;
}

/////
if ( a!=32 &&
b!=32 &&
c!=32 &&
d!=32 &&
e!=32 &&
f!=32 &&
g!=32 &&
h!=32 &&
i!=32 ) {




finish:

cout<<"Jocul s-a terminat"<<endl;
cout<<"Vrei sa joci din nou?(Y/N)";
cin>>yn;
if(yn =="y") goto start;
else return 0;
}

///////////
if( a==b && b==c && c==88) y=1;
if( d==e && e==f && f==88) y=1;
if( g==h && h==i && i==88) y=1;
if( a==d && d==g && g==88) y=1;
if( b==e && e==h && h==88) y=1;
if( c==f && f==i && i==88) y=1;
if( a==e && e==i && i==88) y=1;
if( g==e && e==c && c==88) y=1;

if( a==b && b==c && c==48) y=2;
if( d==e && e==f && f==48) y=2;
if( g==h && h==i && i==48) y=2;
if( a==d && d==g && g==48) y=2;
if( b==e && e==h && h==48) y=2;
if( c==f && f==i && i==48) y=2;
if( a==e && e==i && i==48) y=2;
if( g==e && e==c && c==48) y=2;

///////


//algoritm calculatorul pune x random
random:
srand (time(NULL));
mpc= rand() %9 +1 ;

//cout<<mpc<<endl;
//Sleep(1000);


if (mpc==1) {
if (a==32) a=48;
else{
goto random;
cout<<"merge else";
}
}

if (mpc==2) {
if (b==32) b=48;
else goto random;
}
if (mpc==3) {
if (c==32) c=48;
else goto random;
}
if (mpc==4) {
if (d==32) d=48;
else goto random;
}
if (mpc==5) {
if (e==32) e=48;
else goto random;
}
if (mpc==6) {
if (f==32) f=48;
else goto random;
}
if (mpc==7) {
if (g==32) g=48;
else goto random;
}
if (mpc==8) {
if (h==32) h=48;
else goto random;
}
if (mpc==9) {
if (i==32) i=48;
else goto random;
}







char xsi0[5][5] {{a,186,b,186,c},
{205,206,205,206,205},
{d,186,e,186,f},
{205,206,205,206,205},
{g,186,h,186,i},
};


system("cls");
for(j=0;j<5;j++){
for(k=0;k<5;k++){
cout<<xsi0[j][k];}
for(k=0;k<3;k++){
cout<<pauza[j][k];}
for(k=0;k<5;k++){
cout<<model[j][k];}
cout<<endl;
}

if( a==b && b==c && c==88) y=1;
if( d==e && e==f && f==88) y=1;
if( g==h && h==i && i==88) y=1;
if( a==d && d==g && g==88) y=1;
if( b==e && e==h && h==88) y=1;
if( c==f && f==i && i==88) y=1;
if( a==e && e==i && i==88) y=1;
if( g==e && e==c && c==88) y=1;

if( a==b && b==c && c==48) y=2;
if( d==e && e==f && f==48) y=2;
if( g==h && h==i && i==48) y=2;
if( a==d && d==g && g==48) y=2;
if( b==e && e==h && h==48) y=2;
if( c==f && f==i && i==48) y=2;
if( a==e && e==i && i==48) y=2;
if( g==e && e==c && c==48) y=2;
if(y==1){
cout<<"\aFelicitari, ai castigat!\n";
goto finish;
}
if(y==2){
cout<<"\aNasol...uneori mai si pierzi.\n";
goto finish;
}
if(y!=1 && y!=2 && m>5){
cout<<"E bine, e remiza.\n\a";
m=0;
goto finish;
}
//
//cout<<endl;

cout<<"Unde pui `x` boss?\n";
goto xsi0;


}

Edited by andruala

Share this post


Link to post
Share on other sites

N-am spus ca-mi mare greutate sau ceva...L-am terminat mai mult pt ca profa de la scoala mi-a spus ca-i imposibil, si ca un membru rst a spus ca nu-i practic...

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...