#include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <windows.h>
using namespace std;
int f[4][5];
int a =0;
int b =0;
int c =0;
int d =0;
int y =0;
int r =0;
int t1=0;
int z,x,p,t,m2;
int m1=0;
string tt;
string name;
void start()
{
system("Color E0");
cout<<"\n \n \n \n \n \n \n \n \n ";
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\t @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ @ "<<endl;
cout<<"\n \n \n \n";
cout<<" -----------------------------------press any key to start----------------------------------------";
_getch();
}
void win(){
system("Color 27");
cout<<"\t "<<endl;
cout<<"\t 00 00 00 00 00 00 00 "<<endl;
cout<<"\t 00 00 00 00 00 00 00 "<<endl;
cout<<"\t 00 0000 00 00 00 00 00 "<<endl;
cout<<"\t 00 00 00 00 00 00 00 "<<endl;
cout<<"\t "<<endl;
}
void lose()
{
system("Color 47");
cout<<"\t $ $ $ $ $ $ $ $ $ "<<endl;
cout<<"\t $ $ $ $ $ $ "<<endl;
cout<<"\t $ $ $ $ $ $ $ "<<endl;
cout<<"\t $ $ $ $ $ "<<endl;
cout<<"\t $ $ $ $ $ $ "<<endl;
cout<<"\t $ $ $ $ $ $ $ $ $ $ $ "<<endl;
}
int main()
{
start();
system("cls");
for(int i = 0 ; i < 4 ; i++)
{
for(int u = 0 ; u < 5 ; u++)
{
f[i][u] = rand() % 2;
}
}
for(int u = 0 ; u < 5 ; u++)
{
if (f[0][u] == 1)
a=a+1;
}
for(int u = 0 ; u < 5 ; u++)
{
if (f[1][u] == 1)
b=b+1;
}
for(int u = 0 ; u < 5 ; u++)
{
if (f[2][u] == 1)
c=c+1;
}
for(int u = 0 ; u < 5 ; u++)
{
if (f[3][u] == 1)
d=d+1;
}
a= a * 1000;
b= b * 100;
c= c * 10;
r=a+b+c+d;
system("Color E0");
cout <<"\n\n\n \t enter your name : \n \t";
cin>>name;
cout << "\n \t -------------Press any key to continue-------------" << endl;
_getch();
system("cls");
cout<<"\n \t ok "<<name<<" try to get into the house \n \t let's look around the house \n\t where we should look";
cout<<" \n \t 1.west \n\t 2.east \n\t 3.north \n\t 4.south \n\t";
retry:
cin>>z;
if(z==1){
cout<<" \t 1 locked door 4 locked windows \n\t try to look some where else";//end
goto retry;
}
else if(z==2){
cout<<"\t no doors 2 locked window \n\t try to look some where else";//end
goto retry;
}
else if(z==3){
cout<<"\t 1 locked door 3 locked window \n\t try to look some where else";//end
goto retry;
}
else if(z==4){
cout<<" \t1 locked door one open window \n\t # i will try to get in from this window";
cout << "\n \t -------------Press any key to continue-------------" << endl;
_getch();
system("cls");
cout << "\n\n\n \t # I did it I'm in the house \n\t # it's dark but i think I'm in the warehouse \n ";
cout << "\t 1. search for some usable things \n\t 2. go out the room and try to find the box \n";
sos:
cin>>x;
if (x == 2){
ff:
system("cls");
cout << "\n\n\n \t # there is 2 rooms here where i should go ? \n";
cout<< "\t 1. right \n 2.left";
cin>>p;
if (p==1){
ss:
cout<<"\t the door is locked we have to enter the password \n ";
if (m1==1){
cout<<"\t Maybe we could use the paper \n \n \n";
for(int i = 0 ; i < 4 ; i++)
{
for(int u = 0 ; u < 5 ; u++)
{
cout << f[i][u] << " ";
}
cout<<endl;
}
}
gg:
cout << "\n \t enter the password : " ;
cin>>m2;
if (m2==r)
{
cout<<"\t correct";
cout << "\n \t -------------Press any key to continue-------------" << endl;
_getch();
system("cls");
win();
}
else{
cout<<"\n \t wrong!!";
t1=t1+1;
if (t1==1)
tt="\n \t look at the '1'";
else if (t==2)
tt="\n \t how many '1' in the row ";
else if (t1==3)
{
cout << "\n \t -------------Press any key to continue-------------" << endl;
_getch();
system("cls");
lose();
}
cout<<tt;
goto gg;
}
}
else if (p==2){
cout<<"\t this room is empty I should go to the other room";
goto ss;
}
}
else if (x == 1){
cout<<"\t I found this piece of paper with weird code \n";
cout<<"\n \n";
for(int i = 0 ; i < 4 ; i++)
{
for(int u = 0 ; u < 5 ; u++)
{
cout << f[i][u] << " ";
}
cout<<endl;
}
m1=1;
cout<<"\n \t I will keep it , it might be useful \n\t # I will go and try to find the box ";
cout << "\n \t -------------Press any key to continue-------------" << endl;
_getch();
goto ff;
}
else{
cout << "\t you are doing it wrong pick 1 or 2";
goto sos;
}
}
else{
cout << "\t you are doing it wrong pick 1 , 2 , 3 or 4";
goto retry;
}
}