//It's a game!!!
#include<bits/stdc++.h>
#include<windows.h>
using namespace std;
const int N=1e6+5;
const int M=1e3+5;
int n,m,k;
int T;
void change(int &x,int &y){x=5;y=3;}
void GUESS(){//Game I
printf("set:");
int l,r;
cin>>l>>r;
int p=-1;
int x;
if(l==r)x=l;
else x=(rand()-1)%(r-l)+1+l;
int L,R;
L=l;
R=r;
while(p!=x){
printf("guess number:(%d~%d)\n",L,R);
cin>>p;
while(p<L||p>R){
printf("Wrong!\n");
Sleep(1000);
printf("guess number:(%d~%d)\n",L,R);
cin>>p;
}
system("cls");
if(p>x)printf("big\n"),R=p-1;
if(p<x)printf("small\n"),L=p+1;
}
printf("Yes!\n");
Sleep(1000);
}
void BOOM(){//Game II
printf("The CPU is coming!\n");
Sleep(1000);
printf("It wants to kill you!\n");
Sleep(500);
printf("set:");
int l,r;
cin>>l>>r;
int you=-1,cpu=-1;
int x;
if(l==r)x=l;
else x=(rand()-1)%(r-l)+1+l;
int L=l;
int R=r;
while(you!=x&&cpu!=x){
Sleep(1000);
printf("You guess number:(%d~%d)\n",L,R);
cin>>you;
while(you<L||you>R){
printf("Wrong!\n");
Sleep(1000);
printf("You guess number:(%d~%d)\n",L,R);
cin>>you;
}
system("cls");
printf("You guess:%d\n",you);
if(you>x)R=you-1;
else if(you<x)L=you+1;
else break;
Sleep(2000);
printf("CPU guess number:(%d~%d)\n",L,R);
int pppp=(rand()-1)%3000+1+3000;
Sleep(pppp);
if(R==L)cpu=L;
else cpu=(rand()-1)%(R-L)+L+1;
printf("CPU guess:%d\n",cpu);
if(cpu>x)R=cpu-1;
else if(cpu<x)L=cpu+1;
else break;
}
Sleep(1000);
if(you==x){printf("CPU win!\nYou are died!");exit(0);}
else printf("You win!\n");
Sleep(2000);
}
void GUN(){//Game III
printf("Wait!\n");
Sleep(2000);
printf("The CPU doesn't died!\n");
Sleep(2000);
printf("Come to kill it!\n");
Sleep(2000);
int s=5;
int k=3;
int you=4;
int cpu=4;
while(you&&cpu){
bool choose;
int op=3;
while(op==3){
Sleep(1000);
while(1){
choose=rand()%2;
if(choose==0&&k)break;
if(choose==1&&s)break;
}
printf("is:%d\nisn't:%d\nYou:%d\nCPU:%d\n",s,k,you,cpu);
printf("You choose:1,to CPU 2,to you 3,don't\n");
cin>>op;
Sleep(1000);
printf("You choose:%d\n",op);
Sleep(1500);
if(choose)printf("It is!\n"),s--;
else printf("It isn't\n"),k--;
Sleep(2000);
if(s==0)change(s,k);
system("cls");
}
if(op==1){
if(choose)printf("CPU--\n"),cpu--;
if(!cpu)break;
}
else if(op==2){
if(choose)printf("You--\n"),you--;
if(!you)break;
}
Sleep(1000);
system("cls");
op=3;
while(op==3){
Sleep(1000);
printf("is:%d\nisn't:%d\nYou:%d\nCPU:%d\n",s,k,you,cpu);
printf("CPU choose:1,to you 2,to CPU 3,don't\n");
while(1){
choose=rand()%2;
if(choose==0&&k)break;
if(choose==1&&s)break;
}
int pppp=(rand()-1)%3000+1+1000;
Sleep(pppp);
op=(rand()-1)%3+1;
if(k==0)op=1;
printf("CPU choose:%d\n",op);
Sleep(1500);
if(choose)printf("It is!\n"),s--;
else printf("It isn't\n"),k--;
Sleep(2000);
if(s==0)change(s,k);
system("cls");
}
if(op==1){
if(choose)printf("You--\n"),you--;
}
else if(op==2){
if(choose)printf("CPU--\n"),cpu--;
}
Sleep(1000);
system("cls");
}
Sleep(1000);
system("cls");
if(cpu){printf("CPU win!\nYou are died!");exit(0);}
else printf("You win!\n");
Sleep(2000);
}
signed main(){//1,2,3
ios::sync_with_stdio(0);
srand(time(0));
GUESS();
system("cls");
Sleep(1500);//GUESS猜中进入下一场
BOOM();
system("cls");
Sleep(1500);//BOOM胜利进入下一场
GUN();
system("cls");
Sleep(3000);//GUN胜利游戏结束
printf("CPU is died!\n");
Sleep(2000);
printf("You are hero!!!!\n");
Sleep(3000);
system("cls");
Sleep(2000);
printf("Thanks for your playing!\n");
Sleep(2000);
system("cls");
printf("make it: STY_fish_2012\n");
Sleep(2000);
system("cls");
}