Great Expectations

Dear friend,
  This game is created based on Dicken's Great Expectations.
  To colorful the contents, I add other elements inside.
  It's quite simple, but it really costs me two weeks.
Before doing it,
I didn't know how to set color, print words slowly, even use Class...
But I stuck on, and I did it.
I learned a lot, not only programming...
I decide to share it with you, it's my honor if you like it.
But at first, I need to say thanks to websites or blogs below.
Without the knowledge from them, I could do nothing.

https://blog.csdn.net/jackypigpig/article/details/53368531
https://www.luogu.org/discuss/show/30357
https://blog.csdn.net/charactr/article/details/78817779
http://tieba.baidu.com/p/4297649534
https://www.cnblogs.com/bingoyes/

And others which I cannot remember yet...

(
This game is only for sharing knowledge and programing skill.
So I used a few codes from the internet.
If you are the original author and think your copyright has been infringed.
Connect me and I'll delete the relevant part in time.
If you wanna infringe my copyright for personal interests, we'll meet in court!
)

 

As the time is short, it may still has bugs( or wrong English sentences).

I'd apprecia it if you could tell me!

Best thanks!

              Yours,

                    Bingoyes.

                   Jan. 6th, 2019.

Now let's begin!

 
   1 #include<bits/stdc++.h> 
   2 #include<windows.h>
   3 #include<conio.h>
   4 #define INF 0x3f3f3f3f
   5 #define N 500005
   6 #define re register
   7 #define Ii inline int
   8 #define Il inline long long
   9 #define Iv inline void
  10 #define Ib inline bool
  11 #define Id inline double
  12 #define ll long long
  13 #define Fill(a,b) memset(a,b,sizeof(a))
  14 #define R(a,b,c) for(register int a=b;a<=c;++a)
  15 #define nR(a,b,c) for(register int a=b;a>=c;--a)
  16 #define Min(a,b) ((a)<(b)?(a):(b))
  17 #define Max(a,b) ((a)>(b)?(a):(b))
  18 #define Cmin(a,b) ((a)=(a)<(b)?(a):(b))
  19 #define Cmax(a,b) ((a)=(a)>(b)?(a):(b))
  20 #define D_e(x) printf("\n&__ %d __&\n",x)
  21 #define D_e_Line printf("-----------------\n")
  22 #define sleep(x) Sleep(x*500)
  23 #define Pause() printf("Press any key to continue\n"),_getch()
  24 #define Combat_Effectiveness(x) cout<<x.name<<"'s ",printf("Combat Effectiveness:\nAttack=%d\ndefensive=%d\nSpeed=%d\nHP=%d\n",x.attack,x.defensive,x.speed,x.HP);
  25 #define UFFF D_e_Line,printf("This Part Is Unfinished"),D_e_Line,Pause();
  26 using namespace std;
  27 Ii read(){
  28     int s=0,f=1;char c;
  29     for(c=getchar();c>'9'||c<'0';c=getchar())if(c=='-')f=-1;
  30     while(c>='0'&&c<='9')s=s*10+(c^'0'),c=getchar();
  31     return s*f;
  32 }
  33 Iv print(int x){
  34     if(x<0)putchar('-'),x=-x;
  35     if(x>9)print(x/10);
  36     putchar(x%10^'0');
  37 }
  38 Iv Print(string s){
  39     int len=s.size()-1;
  40     R(i,0,len)
  41         printf("%c",s[i]),sleep(0.1);
  42 /*
  43     (char *p)
  44     while(1){
  45         if(*p!=0)
  46             printf("%c",*p++);
  47         else
  48             break;
  49         Sleep(100);
  50     }
  51     putchar('\n');
  52 */
  53 }
  54 struct Character{
  55     int 
  56         attack,
  57         defensive,
  58         speed,
  59         HP;
  60     string
  61         name;
  62 }Philip,Magwitch;
  63 int key;
  64 set<string>Backpack;
  65 Iv Init_Chapter_One(){
  66     Backpack.insert("Wooden stick");//Note: Go to learn Trie Tree. 
  67     Philip.name="Philip";
  68     Philip.attack=100;
  69     Philip.defensive=100;
  70     Philip.speed=100;
  71     Philip.HP=1000;
  72     Magwitch.name="Magwitch";
  73     Magwitch.attack=500;
  74     Magwitch.defensive=30;
  75     Magwitch.speed=2000;
  76     Magwitch.HP=2500;
  77 }
  78 Iv View_Backpack(){
  79     D_e_Line;
  80     for(set<string>::iterator i=Backpack.begin();i!=Backpack.end();++i)
  81         cout<<*i<<"\n";
  82     D_e_Line;
  83 /*
  84     printf("Press 'P' to view backpack\n'C' to continue\n");
  85     char opt;
  86     while(cin>>opt){
  87         if(opt=='P'||opt=='p'){
  88             View_(),
  89             Pause();break;
  90         }
  91         if(opt=='C'||opt=='c')break;
  92     }
  93 */
  94 /*
  95 struct Aho_Corasick_Automaton{//Note: This AC automation can be used as  only once.
  96     int
  97         ch[N][80],
  98         val[N],
  99         fail[N],
 100         cnt;
 101     void clear(){
 102         Fill(ch,0),Fill(val,0),Fill(fail,0),index=0;
 103     }
 104     void insert(char *s){
 105         int len=strlen(s),u=0;
 106         R(i,0,len-1){
 107             int v=s[i]-'0';
 108             if(!ch[u][v])ch[u][v]=++cnt;
 109             u=ch[u][v];
 110         }
 111         ++val[u];
 112     }
 113     void build(){
 114         queue<int>q;
 115         R(i,0,26-1)//
 116             if(ch[0][i])
 117                 fail[ch[0][i]]=0,q.push(ch[0][i]);
 118         while(!q.empty()){
 119             int u=q.front();q.pop();
 120             R(i,0,26-1)
 121                 if(ch[u][i])
 122                     fail[ch[u][i]]=ch[fail[u]][i],
 123                     q.push(ch[u][i]);
 124                 else
 125                     ch[u][i]=ch[fail[u]][i];
 126         }
 127     }
 128     int query(char *s){
 129         int len=strlen(s),u=0,tot=0;
 130         int *tmp=new int[105];
 131         R(i,0,len-1){
 132             u=ch[u][s[i]-'0'];
 133             for(int j=u;j&&~val[j];j=fail[j])
 134                 tot+=val[j],tmp[j]=val[j],val[j]=-1;
 135         }
 136         R(i,0,len-1){
 137             u=ch[u][s[i]-'0'];
 138             for(int j=u;j;j=fail[j])
 139                 val[j]=tmp[j];
 140         }
 141         delete []tmp;
 142         return tot;
 143     }
 144     bool exist(char *s){
 145         int len=strlen(s),u=0,flag=0;
 146         int *tmp=new int[105];
 147         R(i,0,len-1){
 148             u=ch[u][s[i]-'0'];
 149             for(int j=u;j&&~val[j];j=fail[j]){
 150                 flag+=val[j],tmp[j]=val[j],val[j]=-1;
 151                 if(flag)
 152                     break;
 153             }
 154         }
 155         R(i,0,len-1){
 156             u=ch[u][s[i]-'0'];
 157             for(int j=u;j;j=fail[j])
 158                 val[j]=tmp[j];
 159         }
 160         delete []tmp;
 161         return flag;
 162     }
 163 };
 164 */
 165 }
 166 Ii Fight(Character A,Character B){
 167     system("color 4E");
 168     srand((unsigned)(time(NULL)));
 169     int HP_one=A.HP,HP_two=A.HP,round=0;
 170     while(A.HP>0&&B.HP>0){
 171         if(round&1){//A's turn
 172             bool dodge=(B.speed-A.speed>=rand());
 173             if(dodge){
 174                 printf("B Dodged\n"),
 175                 sleep(1);++round;continue;
 176             }
 177             int attack_power=(rand()-3*B.defensive+A.attack)%A.attack+A.attack/50;
 178             B.HP-=attack_power;
 179             printf("B received %d points of hurt. Residual HP= %d\n",attack_power,B.HP);
 180             sleep(1);
 181         }
 182         else{//B's turn
 183             bool dodge=(A.speed-B.speed>=rand());
 184             if(dodge){
 185                 printf("A Dodged\n"),
 186                 sleep(1);++round;continue;
 187             }
 188             int attack_power=(rand()-3*A.defensive+B.attack)%B.attack+B.attack/50;
 189             A.HP-=attack_power;
 190             printf("A received %d points of hurt. Residual HP= %d\n",attack_power,A.HP);
 191             sleep(1);
 192         }
 193         ++round;
 194     }
 195     if(A.HP<0){
 196         printf("Fighter Two Win\n");
 197         Cmax(A.HP,HP_one/3<<1),Cmax(B.HP,HP_two/3<<1);
 198         return 2;
 199     }
 200     else{
 201         printf("Figher One Win\n");
 202         Cmax(A.HP,HP_one/3<<1),Cmax(B.HP,HP_two/3<<1);
 203         return 1;
 204     }
 205 }
 206 string str(int n1,int n2){
 207     return string(n1,' ')+string(n2,'@');
 208 }
 209 Iv Show_Stick_Man(int index){
 210     if(index==1){
 211         printf("\n");
 212         printf("   ****\n");
 213         printf("   *  *   *\n");
 214         printf("   ****  *\n");
 215         printf("*********\n");
 216         printf("    ***\n");
 217         printf("    ***\n");
 218         printf("    ***\n");
 219         printf("   *  *\n");
 220         printf("  *   *\n");
 221         printf("   *  *\n");
 222         printf("    * *\n");
 223         printf("     **\n");
 224         printf("\n");
 225         return;
 226     }
 227     if(index==2){
 228         printf("\n");
 229         printf("       ~~~~~~~~~~~~~~~~~\n");
 230         printf("       ~~~~~~~~~~~~~~~~~~\n");
 231         printf("      ~~~~~~~~~~~~~~~~~~~~~~~~~ \n");
 232         printf("      *****     *****\n");
 233         printf("        *         *\n");
 234         printf("      ----     ----\n");
 235         printf("              ^\n");
 236         printf("             ^\n");
 237         printf("             ^\n");
 238         printf("          _______)  \n");
 239         printf("\n");
 240         return;
 241     }
 242     if(index==3){
 243         printf("\n"),
 244         printf("###############################\n"),
 245         printf("###############################\n"),
 246         printf("###                         ###\n"),
 247         printf("###                         ###\n"),
 248         printf("###                         ###\n"),
 249         printf("###                         ###\n"),
 250         printf("###                         ###\n"),
 251         printf("###                         ###\n"),
 252         printf("###                         ###\n"),
 253         printf("###        **               ###\n"),
 254         printf("###        **               ###\n"),
 255         printf("###        **               ###\n"),
 256         printf("###        **               ###\n"),
 257         printf("###                         ###\n"),
 258         printf("###                         ###\n"),
 259         printf("###                         ###\n"),
 260         printf("###                         ###\n"),
 261         printf("###                         ###\n"),
 262         printf("###                         ###\n"),
 263         printf("###                         ###\n"),
 264         printf("###                         ###\n"),
 265         printf("###                         ###\n"),
 266         printf("###############################\n"),
 267         printf("###############################\n"),
 268         printf("###############################\n"),
 269         printf("\n");
 270         return;
 271     }
 272     if(index==4){
 273         string str(int,int);
 274         cout<<str(26,8)<<endl;
 275         cout<<str(19,6)<<str(10,6)<<endl;
 276         cout<<str(11,9)<<str(22,6)<<endl;
 277         cout<<str(12,2)<<str(3,5)<<str(17,4)<<str(3,2)<<endl;
 278         cout<<str(10,2)<<str(7,3)<<str(17,3)<<str(6,2)<<endl;
 279         cout<<str(8,2)<<str(40,2)<<endl;
 280         cout<<str(6,17)<<str(13,17)<<endl;
 281         cout<<str(5,7)<<str(12,1)<<str(10,7)<<str(12,1)<<endl;
 282         cout<<str(5,15)<<str(5,1)<<str(9,15)<<str(5,1)<<endl;
 283         cout<<str(4,2)<<str(2,3)<<str(10,4)<<str(13,3)<<str(10,5)<<endl;
 284         cout<<str(3,2)<<str(50,2)<<endl;
 285         cout<<str(3,1)<<str(52,1)<<endl;
 286         cout<<str(3,1)<<str(52,1)<<endl;
 287         cout<<str(2,2)<<str(52,2)<<endl;
 288         cout<<str(2,2)<<str(52,2)<<endl;
 289         cout<<str(2,2)<<str(52,2)<<endl;
 290         cout<<str(2,2)<<str(52,2)<<endl;
 291         cout<<str(3,1)<<str(5,1)<<str(40,1)<<str(5,1)<<endl;
 292         cout<<str(3,2)<<str(5,1)<<str(38,1)<<str(5,2)<<endl;
 293         cout<<str(4,1)<<str(6,2)<<str(34,2)<<str(6,1)<<endl;
 294         cout<<str(5,1)<<str(7,3)<<str(28,3)<<str(7,1)<<endl;
 295         cout<<str(6,1)<<str(8,4)<<str(22,4)<<str(8,1)<<endl;
 296         cout<<str(7,2)<<str(10,5)<<str(12,5)<<str(10,2)<<endl;
 297         cout<<str(9,2)<<str(12,14)<<str(12,2)<<endl;
 298         cout<<str(11,3)<<str(32,3)<<endl;
 299         cout<<str(14,3)<<str(26,3)<<endl;
 300         cout<<str(17,5)<<str(16,5)<<endl;
 301         cout<<str(22,16)<<endl;
 302     }
 303 }
 304 #define Print_Chapter_Slowly()    printf("C"),sleep(0.2),printf("h"),sleep(0.2),printf("a"),sleep(0.2),printf("p"),sleep(0.2),printf("t"),sleep(0.2),printf("e"),sleep(0.2),printf("r"),sleep(0.2),printf(" "),sleep(0.2)
 305 #define Cthulu_Color system("color a"),system("color b"),system("color c"),system("color d"),system("color e"),system("color f"),system("color 0"),system("color 1"),system("color 2"),system("color 3"),system("color 4"),system("color 5"),system("color 6"),system("color 7"),system("color 8"),system("color 9"),system("color ab"),system("color ac"),system("color ad"),system("color ae"),system("color af")
 306 //Chapter One
 307 class Chapter_One{
 308     public:
 309         void Use_BlackBread(Character &A){
 310             A.attack+=500,
 311             A.defensive+=500,
 312             A.speed+=500,
 313             A.HP+=3500;
 314         }
 315         void  Make_Friend_Magwitch(){
 316             system("color 3E"),sleep(2);
 317             Print("\n\tWe? What!\n"),sleep(2);
 318             Print("\tAre you fucking deaf?\nHe sounds angry.\n\tAny way, I haven't eat anything for a week.\n\tGive me your bread now!\n"),sleep(2);
 319             Print("\tPlease. Then he adds, and so I do.\n"),sleep(2);
 320             Use_BlackBread(Magwitch);
 321             Backpack.erase("BlackBread");
 322             Print("\nMagwitch Used BlackBread\n");
 323             Combat_Effectiveness(Magwitch);
 324             D_e_Line;
 325             Print("If I tell my sister about that day.\nShe'll surely congratulate me with a rolling pin.\n"),sleep(2);
 326             Print("But believe it or not, we talked for a whole night.\n"),sleep(3);
 327             Print("About life experience\n"),sleep(2),
 328             Print("About lonliness\n"),sleep(2),
 329             Print("About the peaceful winter night...\n"),sleep(4.5);
 330             Print("Chapter One Over\n");
 331             return;
 332         }
 333         void Fight_Wolf(Character A){
 334             Character Wolf;
 335             Wolf.attack=1000000,
 336             Wolf.defensive=1000000,
 337             Wolf.speed=100000,
 338             Wolf.HP=10000000;
 339             Wolf.name="Wolf";
 340             Combat_Effectiveness(Wolf);
 341             sleep(3);
 342             printf("Fighter one: "),cout<<A.name,printf("\nFighter two: Wolf\n");
 343             sleep(3);
 344             int result=Fight(A,Wolf);//Plot kill
 345             if(result!=2)
 346                 Fight_Wolf(A);
 347             else{
 348                 Print("You Dead\n");
 349                 sleep(3);
 350                 system("color 5D");
 351                 Print("When life is broken like glaze, will my friends still remember me? Do I really have a friend...\n");
 352                 sleep(5);
 353                 Print("The End");
 354                 Pause();
 355                 exit(0);
 356             }
 357         }
 358 //        void Fight_Wolf(Character A,Character B){
 359 //            Character Wolf;
 360 //            Wolf.attack=10,
 361 //            Wolf.defensive=10,
 362 //            Wolf.speed=10000,
 363 //            Wolf.HP=100;
 364 //            Combat_Effectiveness(Wolf);
 365 //            sleep(3);
 366 //            printf("%s Watch out!!\n%s Stay by my side!!!",A.name,B.name);
 367 //            sleep(3);
 368 //            printf("Fighter one: %s and %s Fighter two: Wolf",A.name,B.name);
 369 //            Character Mars;
 370 //            Mars.attack=INF,
 371 //            Mars.defensive=INF,
 372 //            Mars.speed=100,
 373 //            Mars.HP=INF;
 374 //            Fight(Mars,Wolf);
 375 //            sleep(3);
 376 //            Make_Friend_Magwitch();
 377 //        }
 378         void Chapter_One_Main(){
 379             //Contents: Philip first meet Abel Magwitch in the cemetery.//Joe Gargery
 380             Init_Chapter_One();
 381             Print_Chapter_Slowly(),
 382             printf("O"),sleep(0.2),
 383             printf("n"),sleep(0.2),
 384             printf("e\n"),sleep(0.8);
 385             system("cls");
 386             Print("Since I became a orphan, I usually go to the cemetery.\n");
 387             sleep(3);
 388             Print("My mom and dad sleep here.\n");
 389             sleep(3);
 390             Print("My sister raised me.\n");
 391             sleep(3);
 392             Print("She often hits me, says that I was a waste.\n");
 393             sleep(3);
 394             Print("But his husband, my only friend Joe always at my side.\nIt's him conceled from my sister, giving me this black bread.\n");
 395             sleep(3);
 396             Pause();
 397             Backpack.insert("BlackBread");
 398             printf("\nYou Get BlackBread\n");
 399             Pause();
 400             printf("Press 'P' to view backpack\n'C' to continue\n");
 401             char opt;
 402             while(cin>>opt){
 403                 if(opt=='P'||opt=='p'){
 404                     View_Backpack(),
 405                     Pause();break;
 406                 }
 407                 if(opt=='C'||opt=='c')break;
 408             }
 409             system("cls");
 410             system("color 4E");
 411             Print("\nSuddenly a black shadow flew through the grass\n"),sleep(2);
 412             Print("What's that?\n");
 413             printf("Choose my decision:\n");
 414             printf("1: Go and see what it is.\n2: I'd better leave here now.\n");
 415             while(cin>>opt){
 416                 if(opt=='1')break;
 417                 else if(opt=='2'){
 418                     Print("I tried to run, but It's too late.\n"),sleep(2);
 419                     break;
 420                 }
 421             }
 422             Print("A dirty man, looked fierce and malicious,  appeared with electronic bracelet\nGrabed my hand!\n"),sleep(2),
 423             Print("\n\tYou Fucking boy, Give me Your bread. Now!\n"),sleep(2);
 424             Print("What should I do? Should I give up Joe's bread?\n"),sleep(2);
 425             printf("Choose my decision-- I HAVE NO TIME!\n1:Fight with him\n2:Run\n3:Give him.\n");
 426             while(cin>>opt){
 427                 if(opt=='1'){
 428                     Backpack.erase("BlackBread");
 429                     Use_BlackBread(Philip); 
 430                     printf("Philip Used BlakBread\n");
 431                     Combat_Effectiveness(Philip);
 432                     sleep(2);
 433                     printf("Fighter 1: Philip\nFighter 2: Magwitch\n"),sleep(2);
 434                     int result=Fight(Philip,Magwitch);
 435                     if(result==1){
 436                         Print("\nI beat him down and run to the forest\n");
 437                         system("color 3A"),sleep(2);
 438                         Print("Even in the coldest winter, there are still green and vitality.\n"),sleep(2);
 439                         printf("My HP has only %d left. So I stop\nListen to the melody of the wind\nThe snowflakes falls, dancing like an fairy.\n",Philip.HP),sleep(2);
 440                         Print("But why is there a little red?\n");
 441                         system("color 4E"),sleep(2);
 442                         Print("Oh no! That's blood.\n"),sleep(2);
 443                         Print("Oh Jesus, something is attacking me!\n");
 444                         Combat_Effectiveness(Philip);
 445                         Fight_Wolf(Philip);//End_1
 446                     } 
 447                     else{
 448                         Print("I losed, closing my eyes to wait for death\n"),sleep(2);
 449                         Make_Friend_Magwitch();
 450                     }
 451                     return;
 452                 }
 453                 else if(opt=='2'){
 454                     Print("I'm too slow. I am caught by him and have to fight.\n"),sleep(2),
 455                     printf("\nFighter one: Philip\nFighter two: Magwitch\n");
 456                     Combat_Effectiveness(Philip);sleep(2);
 457                     Fight(Philip,Magwitch),
 458                     Make_Friend_Magwitch();
 459                     return;
 460                 }
 461                 else if(opt=='3'){
 462                     Make_Friend_Magwitch();
 463                     return;
 464                 }
 465             }
 466         }
 467 }Chapter_One;
 468 //Chapter Two
 469 class Door_2048{
 470     private:
 471         int mp[4][4],nn;
 472     public:
 473         void showmp(){
 474             cout<<setw(58)<<"Get at least 512 points to enter the room"<<endl;
 475             cout<<setw(50)<<"|-----------------------|"<<endl;
 476             R(i,0,3){
 477                 cout<<setw(24)<<"";
 478                   R(j,0,3){
 479                        if(!mp[i][j])
 480                         cout<<setw(2)<<"|"<<setw(4)<<" ";
 481                        else
 482                         cout<<setw(2)<<"|"<<setw(4)<<mp[i][j];
 483                        if(j==3)
 484                          cout<<setw(2)<<"|"<<endl,
 485                          cout<<setw(50)<<"|-----------------------|"<<endl;
 486                   }
 487              }
 488         }
 489         void newgame(){
 490              nn=1;
 491              R(i,0,3)
 492                 R(j,0,3)
 493                     mp[i][j]=0;
 494             srand((unsigned)time(NULL));
 495             int m=rand()%4,n=rand()%4,p=rand()%4,q=rand()%4;
 496             mp[m][n]=mp[p][q]=2,
 497             showmp();
 498         }
 499         int if2n(int x){
 500             bool flag=0;
 501             R(n,1,11){
 502                 if(x==pow(2,n)){
 503                     flag=1;
 504                     if(n>nn)
 505                         nn=n;
 506                     return flag;
 507                 }
 508             }
 509             return flag;
 510         }
 511         int upmove(){
 512             bool flag=0;
 513             R(j,0,3)
 514                 R(i,0,3)
 515                     if(if2n(mp[i][j]+mp[i+1][j]))
 516                         mp[i][j]=mp[i][j]+mp[i+1][j],
 517                         mp[i+1][j]=0,
 518                         flag=1;
 519             return flag;
 520         }
 521         int downmove(){
 522              bool flag=0;
 523              R(j,0,3)
 524                  nR(i,3,1)
 525                     if(if2n(mp[i][j]+mp[i-1][j])==1)
 526                         mp[i][j]=mp[i][j]+mp[i-1][j],
 527                         mp[i-1][j]=0,
 528                         flag=1;
 529             return flag;
 530         }
 531         int leftmove(){
 532             bool flag=0;
 533             R(i,0,3)
 534                 R(j,0,2)
 535                     if(if2n(mp[i][j]+mp[i][j+1])==1)
 536                         mp[i][j]=mp[i][j]+mp[i][j+1],
 537                         mp[i][j+1]=0,
 538                         flag=1;
 539                 return flag;
 540         }
 541         int rightmove(){
 542             bool flag=0;
 543             R(i,0,3)
 544                 nR(j,3,1)
 545                 if(if2n(mp[i][j]+mp[i][j-1])==1)
 546                     mp[i][j]=mp[i][j]+mp[i][j-1],
 547                     mp[i][j-1]=0,
 548                     flag=1;
 549             return flag;
 550         }
 551         int testup(){
 552             bool flag=0;
 553             R(j,0,3)
 554                 R(i,0,2)
 555                     if((if2n(mp[i][j]+mp[i+1][j])==1)&&mp[i+1][j])
 556                         flag=1;
 557             return flag;
 558         }
 559         int testdown(){
 560             bool flag=0;
 561             R(j,0,3)
 562                 nR(i,3,1)
 563                     if((if2n(mp[i][j]+mp[i-1][j])==1)&&mp[i-1][j])
 564                         flag=1;
 565             return flag;
 566         }
 567         int testleft(){
 568             bool flag=0;
 569             R(i,0,3)
 570                 R(j,0,2)
 571                     if((if2n(mp[i][j]+mp[i][j+1])==1)&&mp[i][j+1])
 572                         flag=1;
 573             return flag;
 574         }
 575         int testright(){
 576             bool flag=0;
 577             R(i,0,3)
 578                 nR(j,3,1)
 579                     if((if2n(mp[i][j]+mp[i][j-1])==1)&&mp[i][j-1])
 580                         flag=1;
 581             return flag;
 582         }
 583         int mpmax(){
 584             int maxx=mp[0][0];
 585             R(i,0,3)
 586                 R(j,0,3)
 587                     if(mp[i][j]>maxx)
 588                         maxx=mp[i][j];
 589             return maxx;
 590         }
 591         int win(){
 592             bool flag=0;
 593             if(mpmax()>=2048)
 594                 cout<<setw(45)<<"You Beat Down The Door!"<<endl,
 595                 flag=1;
 596             return flag;
 597         }
 598         int GameOver(){
 599             bool flag;
 600             if(testup()+testdown()+testleft()+testright()==0)
 601                 cout<<setw(43)<<"Geme Over!"<<endl,
 602                 flag=1;
 603             return flag;
 604         }
 605         void addup(){
 606             srand((unsigned)time(NULL));
 607             int n;
 608             if(nn==1)n=1;
 609             else n=(rand()%(nn)+1); 
 610             int newnumber=pow(2,n);
 611             nR(i,3,0)
 612                 R(j,0,3)
 613                     if(!mp[i][j]){
 614                         mp[i][j]=newnumber;return;
 615                     }
 616         }
 617         void adddown(){
 618             srand((unsigned)time(NULL));
 619             int n;
 620             if(nn==1)n=1;
 621             else n=(rand()%(nn)+1); 
 622             int newnumber=pow(2,n);
 623             R(i,0,3)
 624                 R(j,0,3)
 625                     if(!mp[i][j]){
 626                         mp[i][j]=newnumber;return;
 627                     }
 628         }
 629         void addleft(){
 630             srand((unsigned)time(NULL));
 631             int n;
 632             if(nn==1)n=1;
 633             else n=(rand()%(nn)+1); 
 634             int newnumber=pow(2,n);
 635             nR(j,3,0)
 636                 R(i,0,3)
 637                     if(!mp[i][j]){
 638                         mp[i][j]=newnumber;return;
 639                     }
 640         }
 641         void addright(){
 642             srand((unsigned)time(NULL));
 643             int n;
 644             if(nn==1)n=1;
 645             else n=(rand()%(nn)+1); 
 646             int newnumber=pow(2,n);
 647             R(j,0,3)
 648                 R(i,0,3)
 649                     if(!mp[i][j]){
 650                         mp[i][j]=newnumber;return;
 651                     }
 652         }
 653         int Direction(){
 654             int ret=0;
 655             while(!ret){
 656                 int ch=getch();
 657                 if(isascii(ch))continue;
 658                 ch=getch();
 659                 switch(ch){
 660                     case 72:ret=2;break;
 661                     case 75:ret=1;break;
 662                     case 77:ret=3;break;
 663                     case 80:ret=4;break;
 664                     default:break;
 665                 }
 666             }
 667             return ret;
 668         }
 669         void Door_2048_Main(){
 670             int points_biggest=-1;
 671             nn=1;
 672             system("color 85");
 673             int play=1,flag_win=0;
 674             while(play){
 675                 system("cls"),
 676                 newgame();
 677                 while(win()+GameOver()==0){
 678                     int c=Direction();
 679                     switch(c){
 680                         case 2:
 681                             if(testup()){
 682                                 upmove();
 683                                 addup();
 684                                 system("cls");
 685                                 showmp();
 686                             }
 687                             break;
 688                         case 4:
 689                             if(testdown()){
 690                                 downmove();
 691                                 adddown();
 692                                 system("cls");
 693                                 showmp();
 694                             }
 695                             break;
 696                         case 1:
 697                             if(testleft()){
 698                                 leftmove();
 699                                 addleft();
 700                                 system("cls");
 701                                 showmp();
 702                             }
 703                             break;
 704                         case 3:
 705                             if(testright()){
 706                                 rightmove();
 707                                 addright();
 708                                 system("cls");
 709                                 showmp();
 710                             }
 711                             break;
 712                         default:
 713                             break;
 714                     }
 715                 }
 716                 int points=mpmax();
 717                 cout<<setw(43)<<"You Got:"<<points<<endl;
 718                 Cmax(points_biggest,points);
 719                 if(points_biggest>=512){////512
 720                     flag_win=1;
 721                     cout<<setw(45)<<"You Got The Key!"<<endl;
 722                 }
 723                 cout<<setw(60)<<"Try again? Input '1'. or input '0 for ending"<<endl;
 724                 cin>>play;
 725                 while(play!=1&&play!=0)
 726                     cout<<"Unknown Index!"<<endl,
 727                     cin>>play;
 728             }
 729             if(!flag_win){
 730                 Print("After so many years, as a blacksmith, I always think... What's waiting for me behind that door...\n"),sleep(2);
 731                 Print("But I'm old...\n"),sleep(4.5);
 732                 printf("The End\n");
 733                 Pause();
 734                 exit(0);
 735             }
 736             Backpack.insert("The Key Of Dust");
 737             printf("You Got The Key Of Dust\n");
 738             sleep(2);
 739             printf("Input 'P' to view backpack, or 'C' to continue.\n");
 740             char opt;
 741             while(cin>>opt){
 742                 if(opt=='P'||opt=='p'){
 743                     View_Backpack();
 744                     Pause();break;
 745                 }
 746                 else if(opt=='C'||opt=='c')
 747                     break;
 748             }
 749             system("cls");
 750             return;
 751         }
 752     friend class Miss_Havisham_House;
 753 }Door_2048;
 754 class Miss_Havisham_House{
 755     private:
 756         bool ReturnOldPlace;
 757     public:
 758         void Gate(){
 759             system("color 0E");
 760             Print("A pretty girl shouts to me contemptuously\n"),sleep(2);
 761             Print("\n\tTownship!\n\tGet the door open by yourself.\n"),sleep(3),
 762             printf("What should I do?\n"),sleep(2);
 763             printf("Choose Your Decision:\n1: Get the key of the door\n2: Ignore her and leave\n");
 764             char opt;
 765             while(cin>>opt)
 766                 if(opt=='1'||opt=='2'){
 767                     if(opt=='2')
 768                         Print("But this is not polite.\n"),sleep(2);
 769                     Print("There is a note on the door, which is writed:\n"),sleep(2.5);
 770                     Print("\n\tMerciful sir, please unlock the dusty secret behind the door.\n\t2048 runners have been released!\n");
 771                     Pause();
 772                     Door_2048.Door_2048_Main();
 773                     break;
 774                 }
 775         }
 776         void Hall(int index){
 777             if(index==1){
 778                 system("color DE");
 779                 Print("I see Miss.Havisham now. She's as emaciated as a fowl.\n"),sleep(2);
 780                 Print("\tNice to meet you, my friend.\n"),sleep(2);
 781                 Print("\tYou must fall in love with my Estella!\nHahahahahaha...\n"),sleep(4.5);
 782                 Print("\nAfter a few time, I left.\n");
 783                 return;
 784             }
 785             Print("I see her again.\n"),sleep(2);
 786             Print("I never forget this woman, who as emaciated as a fowl.\n"),sleep(2);
 787             Print("\n\tIt's time to tell the truth, Miss.Havisham.\n"),sleep(2);
 788             Print("\tWho are you! Why you give me The Key Of Dust!\n"),sleep(2);
 789             Print("\n\tHave you fell in love with my Estella?\nShe smiles and then screams.\n"),sleep(2);
 790             Print("\tOh~ Dear Pip, you have my husband's taste.\n\tHave you seen him? He's name is Magwitch.\n"),sleep(2);
 791             R(i,1,3)Cthulu_Color;
 792             Print("\n\tNo!!!!!!\nI cried out.\n"),
 793             Print("But then I begin to understand what has happened...\n"),sleep(2);
 794             return;
 795         }
 796         void Garden(){
 797             Character Herbert;
 798             Herbert.attack=150;
 799             Herbert.defensive=20;
 800             Herbert.speed=50;
 801             Herbert.HP=850;
 802             Herbert.name="Herbert";
 803             Print("\tHey, I'm Herbert Pocket.\n\tLet's fight\n"),sleep(2);
 804             Print("A boy with gentlemanly look appeared and shout.\n"),sleep(2);
 805             printf("What should I do?\n");
 806             printf("Choose my decision:\n1: Fight\n2: Run\n");
 807             char opt;
 808             while(cin>>opt)
 809                 if(opt=='1'||opt=='2'){
 810                     if(opt=='2')
 811                         printf("You are too slow, and have too fight.\n");
 812                     break;
 813                 }
 814             putchar('\n');
 815             Combat_Effectiveness(Philip);
 816             putchar('\n');
 817             sleep(3);
 818             Combat_Effectiveness(Herbert);
 819             Pause();
 820             printf("Fighter One:Philip\nFighter Two: Herbert\n");
 821             int result=Fight(Philip,Herbert);
 822             if(result==1)
 823                 Print("\n\tThis is not the ending.\nHerbert shouts and runs away.\n");
 824             else
 825                 Print("\n\tYou bastard! Do not close to my Estella!\nHerbert shouts and goes away.\n");
 826         }
 827         void Basement(){
 828             if(!ReturnOldPlace){
 829                 Print("There's an old man screaming strangely.\n");
 830                 sleep(3);
 831                 Print("\n\tCthulhu~ Cthulhu~ Cthulhu~.\n");
 832                 printf("Choose my decision:\n1: Go to see him.\n2: I'd better leave.\n");
 833                 char opt;
 834                 while(cin>>opt)
 835                     if(opt=='2')return;
 836                     else if(opt=='1'){
 837                         Print("\n\tOh~ Merciful sir, thanks for your kind.\n"),sleep(2);
 838                         Print("He suddenly runs away, leaving a book with black cover.\n"),sleep(2);
 839                         Backpack.insert("<<HarryPotterAndTheDeathlyHallows>>");
 840                         printf("\nYou Get <<HarryPotterAndTheDeathlyHallows>>\n");
 841                         printf("\nPress 'P' to view backpack\n'C' to continue\n");
 842                         char opt;
 843                         while(cin>>opt){
 844                             if(opt=='P'||opt=='p'){
 845                                 View_Backpack(),
 846                                 Pause();break;
 847                             }
 848                             if(opt=='C'||opt=='c')break;
 849                         }
 850                         ReturnOldPlace=1;
 851                         return;
 852                     }
 853             }
 854             Print("\nCthulhu~ Cthulhu~ Cthulhu~.\n");
 855             R(i,1,3)Cthulu_Color;
 856             Print("I suddenly realized what the old man I met ten years ago said.\n");
 857             Print("The one who is still screaming here is a Believer!\n"),sleep(2);
 858             Print("!!!!!!!!!!!!!!!!\n");
 859             Print("He sees me and walks towards me.\n"),sleep(2);
 860             Print("I am so shocked that I can't move my legs.\nWill I dead?\nHere?\n"),sleep(2);
 861             Print("\n\tOh~ Merciful sir~ You are our Majesty~\n\tHope the cruel god sends holy blood on you!\n"),sleep(2);
 862             Print("\tMerciful sir~ Have you take our Bible?\n"),sleep(2);
 863             Print("I remembered the book he offered me.\nI take it out from my backpack\n"),sleep(2);
 864             Print("On the cover, there is a sentence.\nCthulu is The Savior. Do not let Light blames our Savior.\n");
 865             Print("Oh~ loyal Believer, only Light's bood will cleanse us from sin...\n"),sleep(2);
 866             Print("\n\tWhy you give me this book?\nI asked."),sleep(2);
 867             Print("\n\tStop our Savior,\nStop our Crying Daughter,\nStop Havisham!\n"),sleep(2);
 868             Print("\nThen he disappered again, leaving me stand still...\n"),sleep(2);
 869             Print("It's clear Havisham plays an important role for today.\nBut if the Savior is Cthulu, who is the 'Crying Daughter'?\nWhat is Estella...\n"),sleep(2);
 870             return;
 871         }
 872         void ReturnTime(){
 873             system("color 81");
 874             Print("Every time I look back, this house always appears in my mind.\n");
 875             Print("No matter how far I have been, this is the start place.\n");
 876             Print("Where I got The Dust Of Key\nWhere I met Estella...\n"),sleep(2);
 877 ChooseDestination:
 878             printf("\nWhere should I go next?\n1: Hall\n2: Garden\n");
 879             if(ReturnOldPlace)printf("3: Basement\n");
 880             char opt;
 881             while(cin>>opt){
 882                 if(opt=='1'){
 883                     Hall(2);
 884                     return;
 885                 }
 886                 if(opt=='2'){
 887                     Print("\nThe garden is overgrown with weeds.\n"),sleep(2);
 888                     Print("The rock Herbert and I used to fight on has disappered.\n"),sleep(2);
 889                     Print("Without memories, there's nothing.\n");
 890                     goto ChooseDestination;
 891                 }
 892                 if(opt=='3'&&ReturnOldPlace){
 893                     Basement();
 894                     goto ChooseDestination;
 895                 }
 896             }
 897         } 
 898 }Havisham_House;
 899 class Chapter_Two{
 900     public:
 901         void Chapter_Two_Main(){
 902             //contents: Magwitch was arrested. Philip was invited to Miss.Havisham's house, where he met Estella.
 903             Print_Chapter_Slowly(),
 904             printf("T"),sleep(0.5),
 905             printf("w"),sleep(0.5);
 906             printf("o\n"),sleep(0.5);
 907             system("color 58"),sleep(3);
 908             Print("The next day,\nbecause of the tracker on the electronic bracelet, Magwitch was arrested...\n"),sleep(2);
 909             Print("Three years passed, I have been a teenager.\n\tRobust\n\t\tIntelligent\n\t\t\tCharming\n"),sleep(2);
 910             Print("But have no friend except Joe\n"),sleep(2);
 911             Print("One day, he said...\n");
 912             Show_Stick_Man(1);
 913             Print("\tPip! You are visited to Miss.Havisham's house!\n"),sleep(2);
 914             Print("\n\tI What?\n"),sleep(2);
 915             Print("\nThe next day, I got the carriage to the Miss.Havisham's House...\n");
 916             Pause();
 917             system("cls");
 918             system("color 2E"),sleep(3);
 919             Print("And now here it is...\n"),
 920             Pause();
 921             Havisham_House.Gate();
 922             system("cls");
 923             printf("Where should I go next?\n"),sleep(2);
 924             printf("Choose my decision:\n1: Garden\n2: Hall\n3: Baseroom\n");
 925             char opt;
 926             bool flag_Garden=0,flag_Hall=0,flag_Basement=0;
 927             while(cin>>opt){
 928                 if(opt=='1'){Havisham_House.Garden();flag_Garden=1;break;}
 929                 else if(opt=='2'){Havisham_House.Hall(1);flag_Hall=1;break;}
 930                 else if(opt=='3'){Havisham_House.Basement();flag_Basement=1;break;}
 931             }
 932             sleep(1.5);
 933             Print("It's not too late, I may go to another palce.\n"),sleep(2);
 934             printf("Choose my decision:\n");
 935             if(flag_Hall){
 936                 printf("1: Garden\n2: Basement\n3: Just leave\n");
 937                 while(cin>>opt){
 938                     if(opt=='1'){Havisham_House.Garden();break;}
 939                     else if(opt=='2'){Havisham_House.Basement();break;}
 940                     else if(opt=='3')break;
 941                 }
 942             }
 943             if(flag_Garden){
 944                 printf("1: Basement\n2: Hall\n3: Just leave\n");
 945                 while(cin>>opt){
 946                     if(opt=='1'){Havisham_House.Basement();break;}
 947                     else if(opt=='2'){Havisham_House.Hall(1);break;}
 948                     else if(opt=='3')break;
 949                 }
 950             }
 951             if(flag_Basement){
 952                 printf("1: Garden\n2: Hall\n3: Just leave\n");
 953                 while(cin>>opt){
 954                     if(opt=='1'){Havisham_House.Garden();break;}
 955                     else if(opt=='2'){Havisham_House.Hall(1);break;}
 956                     else if(opt=='3')break;
 957                 }
 958             }
 959             sleep(5);
 960             Print("After several years,\nI sometimes wonder what'll happen if I did not enter that house.\n"),sleep(2);
 961             Print("But there's no denying that\nit's that house changed me and what happened afterwards...\n"),sleep(4.5);
 962             Print("Chapter Two Over.\n");
 963             return;
 964         }
 965     friend class Miss_Havisham_House;    
 966 }Chapter_Two;
 967 //Chapter Three 
 968 class Tsinghua_Contest{
 969     private:
 970         int grades;
 971     public:
 972         void ExamOffice(){
 973             grades=0;
 974             Print("I meet the chief examiner--\nMr.Jaggers, a serious and stingy old gentleman.\n"),sleep(2);
 975             Print("\n\tHey idiot! You need pass at least one exam.\n"),sleep(2);
 976             Print("\tTell me your choices now!\n"),sleep(2);
 977             Choose_Exam();
 978         }
 979         void Choose_Exam(){
 980             printf("\nChoose My Exam:\n1: Graph\n2: Math\n3: Dynamic\n4: DataStructure\n5: HighPrecision\n101: Why no LOL?\n");//Else subjects will be added later.
 981             int opt;
 982             while(cin>>opt){
 983                 if(opt==1){Graph();break;}
 984                 if(opt==2){Math();break;}
 985                 if(opt==3){Dynamic();break;}
 986                 if(opt==4){DataStructure();break;}
 987                 if(opt==5){HighPrecision();break;}
 988                 if(opt==101){Failure();return;}
 989             }    
 990         }
 991         void Failure(){
 992             system("color 89"),sleep(2);
 993             Print("\nMany years have gone.\n"),sleep(2);
 994             Print("One day, when I was forging an iron bar.\n"),sleep(2);
 995             Print("I suddenly thought, what'll happen if I passed that exam...\n"),sleep(2);
 996             Print("But time waits for no man...\n"),sleep(4.5);
 997             Print("The End\n");
 998             Pause();
 999             exit(0);
1000         }
1001         void Graph(){
1002             system("start http://poj.org/problem?id=1220"),sleep(1);//
1003             Print("\nI believe I have finished them all!\n"),sleep(2);
1004             Show_Stick_Man(4);
1005             printf("Do I wan't more?\n1: Let rain down more violent strom!\n2: I have had enough.");
1006             char opt;
1007             while(cin>>opt){
1008                 if(opt=='1'){Choose_Exam();return;}
1009                 if(opt=='2')return;
1010             }            
1011         }
1012         void Math(){
1013             system("start http://poj.org/problem?id=1220"),sleep(1);//
1014             Print("\nI believe I have finished them all!\n"),sleep(2);
1015             Show_Stick_Man(4);
1016             printf("Do I wan't more?\n1: Let rain down more violent strom!\n2: I have had enough.");
1017             char opt;
1018             while(cin>>opt){
1019                 if(opt=='1'){Choose_Exam();return;}
1020                 if(opt=='2')return;
1021             }            
1022         }
1023         void Dynamic(){
1024             system("start http://poj.org/problem?id=1220"),sleep(1);//
1025             Print("\nI believe I have finished them all!\n"),sleep(2);
1026             Show_Stick_Man(4);
1027             printf("Do I wan't more?\n1: Let rain down more violent strom!\n2: I have had enough.");
1028             char opt;
1029             while(cin>>opt){
1030                 if(opt=='1'){Choose_Exam();return;}
1031                 if(opt=='2')return;
1032             }            
1033         }
1034         void DataStructure(){
1035             system("start http://poj.org/problem?id=1220"),sleep(1);//
1036             Print("\nI believe I have finished them all!\n"),sleep(2);
1037             Show_Stick_Man(4);
1038             printf("Do I wan't more?\n1: Let rain down more violent strom!\n2: I have had enough.");
1039             char opt;
1040             while(cin>>opt){
1041                 if(opt=='1'){Choose_Exam();return;}
1042                 if(opt=='2')return;
1043             }            
1044         }
1045         void HighPrecision(){
1046             system("start http://poj.org/problem?id=1220"),sleep(1);//
1047             Print("\nI believe I have finished them all!\n"),sleep(2);
1048             Show_Stick_Man(4);
1049             printf("Do I wan't more?\n1: Let rain down more violent strom!\n2: I have had enough.");
1050             char opt;
1051             while(cin>>opt){
1052                 if(opt=='1'){Choose_Exam();return;}
1053                 if(opt=='2')return;
1054             }
1055         }
1056         friend class Chapter_Three;
1057 }Contest;
1058 class Chapter_Three{//Content: This time philip received a grant from an unidentified person. Go to Tsinghua to study.
1059     public:
1060         void Chapter_Three_Main(){
1061             Print_Chapter_Slowly(),
1062             printf("T"),sleep(0.5),
1063             printf("h"),sleep(0.5),
1064             printf("r"),sleep(0.5),
1065             printf("e"),sleep(0.5),
1066             printf("e\n"),sleep(0.5);
1067             system("color 1E");
1068             Print("Not long since I came back from Miss.Havisham's House,\nI received a grant from an unidentified person.\n"),sleep(2);
1069             Print("Miss.Havisham is right. I fell in love with Estella.\n"),sleep(2);
1070             Print("So with this unknown help( It must from Miss.Havisham), I must pass a exam.\n"),sleep(2);
1071             Print("To proof that I can come to Tsinghua!\n");
1072             Show_Stick_Man(2);
1073             Pause();
1074             Contest.ExamOffice();
1075             Pause();
1076             Print("\n\tI believe you all achieved the basic goal.\nMr.Jaggers said with an ill-intentioned smile.\n"),sleep(2);
1077             Print("\tBut team's work is more important for you little idiot.\n"),
1078             Print("\tSo your last task is teaming up every two people, then compare with each other.\n"),sleep(2);
1079             printf("\nWho would be my teammate?\n1: A pretty girl( Mary Sue)\n2: A pretty boy( Gay Friend)\n");
1080             char opt;
1081             while(cin>>opt){
1082                 if(opt=='1'){Print("She refused...\n");break;}
1083                 if(opt=='2')break;
1084             }
1085             Print("\n\tOh you are...\nThe pretty boy cried out.\n"),sleep(2);
1086             Print("\nI have also recognized him.\n"),sleep(2);
1087             Print("\n\tHerbert...\n"),sleep(2);
1088             Print("As an saying goes, No fight, no friend.\nWe soon gain a strong relationship.\nAnd the competition begins...\n"),sleep(2);
1089             Print("\nOur competitors are that pretty girl and a awful guy called Drummle.\n"),sleep(2);
1090             Print("\nI suddenly realized who the girl is.\nI never forget that arrogant look.\n");
1091             system("color 8C"),sleep(2);
1092             Print("She's Estella!\n"),sleep(2);
1093             Print("She also remembered me, a stupid cowboy, and smiled haughtily.\n"),sleep(2);
1094             Print("Now I'm a little unhappy...\n"),sleep(2);
1095             Print("\n\t\t\tDuel begins!!!\n");
1096             system("color 0E");
1097             Pause();
1098             //int result=1;
1099             //if(!result)Contest.Failure();//I used wanna set a Card competiton 'Pig country killing', but I failed.
1100             Print("\tWe beat them down!\nI cried out.\n"),sleep(2);
1101             Print("\n\tYeah, We did!\n"),sleep(5);
1102             Print("\n\tLadies and gentlemen, calm down.\n\tGive me some time to announce the admission list, please.\n");
1103             Print("A gentle look secretaty breaks us.\n"),sleep(2);
1104             Print("\tNow...\n\t\tNo.1: Estella\n\t\tNo.2: Herbert\n\t...\n\t\tNo. 1024: Philip\n\t\tThat's all!\n"),sleep(4.5);
1105             Print("\nThis is how I was admitted as the last one.\n"),sleep(2);
1106             Print("Though it was a bit embarresting...\nI still laughed loudly with the crowds.\n"),sleep(2);
1107             Print("I did not realize...\n"),sleep(2);
1108             Print("That's the happiest time of my life...\n"),sleep(2);
1109             Print("And so,\nHerbert\nJaggers\nEstella\nAnd him..."),sleep(4.5);
1110             printf("Chapter Three Over.\n");
1111             return;
1112         }
1113     friend class Tsinghua_Contest;    
1114 }Chapter_Three;
1115 //Chpater Four
1116 #define Game_RetroSnaker RetroSnaker.RetroSnaker_Main()
1117 #ifdef Game_RetroSnaker
1118 int gameover,snake_X1,snake_Y1,snake_x,snake_y;ll start,lever_final;
1119 class Snake_Position{
1120     public:
1121         int snake_x,snake_y;
1122         Snake_Position(){};
1123         void Init(int &j){
1124             snake_x=1,snake_y=j;
1125         }
1126     friend class RetroSnaker;
1127 }position[20*20+1];
1128 class Snake_Map{
1129      private:
1130         int
1131             lever,length,gamespeed,head,tail,score;
1132         char
1133             ch[22][22],direction;
1134     public:
1135         Snake_Map(int h=4,int t=1,int l=4,char d=77,int s=0):length(l),direction(d),head(h),tail(t),score(s){}
1136         
1137         void Init(){
1138             R(i,1,3)
1139                 ch[1][i] = '*';
1140             ch[1][4] = '#';
1141             R(i,1,20)
1142                 R(j,1,20)
1143                     ch[i][j]=' ';
1144             R(i,0,22-1)
1145                 ch[0][i]=ch[22-1][i]='-';
1146             R(i,1,20)
1147                 ch[i][0]=ch[i][22-1]='|';
1148         }
1149         void Show_Game(){
1150             system("cls");
1151             putchar('\n');
1152             R(i,0,22-1){
1153                 putchar('\t');
1154                 R(j,0,22-1)
1155                     printf("%c ",ch[i][j]);
1156                 if(i==2)cout<<"\tKilling Lever:"<<lever;
1157                 if(i==6)cout<<"\tKilling Speed:"<<gamespeed;
1158                 if(i==10)cout<<"\tKilling Grades:"<<score;
1159                 putchar('\n');
1160             }
1161         }
1162         void Grade_Init(){
1163             lever=0;gamespeed = 50;
1164         }
1165         void display(){
1166             cout << "\n\t\t\t\tLever:" << lever;
1167             cout << "\n\n\n\t\t\t\tSpeed:" << gamespeed;
1168             cout << "\n\n\n\t\t\t\tGrades:" << score;
1169         }
1170         void Set_Point(){
1171             srand((unsigned)time(NULL));
1172             while(ch[snake_X1][snake_Y1]!=' ')
1173                 snake_X1=rand()%20+1,snake_Y1=rand()%20+1;
1174             ch[snake_X1][snake_Y1]='*';
1175         } 
1176         int updata_game(){
1177             char key;
1178             gameover = 1;
1179             key = direction;
1180             start = clock();
1181             while((gameover=(clock()-start<=gamespeed))&&!kbhit());//If the key is pressed or the time exceeds the automatic advance interval, the cycle is terminated.
1182             if(gameover)
1183                 getch(),key=getch();
1184             //if(key == ' ')while(getch()!=' '){}//What is achieved here is the function of pausing or continue by pressing the space key], but for some reason, it needs to press twice to continue. This is a bug.
1185             direction = key;
1186             switch(direction){
1187                 case 72: snake_x= position[head].snake_x-1; snake_y= position[head].snake_y;break; // 向上
1188                 case 80: snake_x= position[head].snake_x+1; snake_y= position[head].snake_y;break; // 向下
1189                 case 75: snake_x= position[head].snake_x; snake_y= position[head].snake_y-1;break; // 向左
1190                 case 77: snake_x= position[head].snake_x; snake_y= position[head].snake_y+1; // 向右
1191             }
1192             while(!(direction==72||direction==80||direction==75 ||direction==77))getch();
1193             if(snake_x==0 || snake_x==22-1 ||snake_y==0 || snake_y==22-1)gameover = 0;
1194             else if(ch[snake_x][snake_y]!=' '&&!(snake_x==snake_X1&&snake_y==snake_Y1))gameover = 0;
1195             else if(snake_x==snake_X1 && snake_y==snake_Y1){ // 吃米,长度加1
1196                 ++length;
1197                 ++lever;
1198                 ch[snake_x][snake_y]= '#'; //更新蛇头
1199                 ch[position[head].snake_x][position[head].snake_y] = '*'; //吃米后将原先蛇头变为蛇身
1200                 head = (head+1) % ( 20*20 ); //取蛇头坐标
1201                 position[head].snake_x = snake_x;
1202                 position[head].snake_y = snake_y;
1203                 Show_Game();
1204                 gameover = 1;
1205                 score += lever*20; //加分
1206                 Set_Point(); //产生米
1207             }
1208             else{ // 不吃米
1209                 ch[position[tail].snake_x][position[tail].snake_y]=' ';//将蛇尾置空
1210                 tail= (tail+1) % ( 20 * 20 );//更新蛇尾坐标
1211                 ch[position[head].snake_x][position[head].snake_y]='*'; //将蛇头更为蛇身
1212                 head= (head+1) % ( 20 * 20 );
1213                 position[head].snake_x = snake_x;
1214                 position[head].snake_y = snake_y;
1215                 ch[position[head].snake_x][position[head].snake_y]='#'; //更新蛇头
1216                 gameover = 1;
1217             }
1218             Cmax(lever_final,lever);
1219             return gameover;
1220         }
1221     friend class RetroSnaker;
1222 };
1223 class RetroSnaker{
1224     public:
1225         bool RetroSnaker_Main(){
1226             char cth='Y';
1227             system("color 0E");
1228             cout<<"\n\n\n\n\n\t\t Get_Grade At Least Fifteen To Save Everybody!\n\n\n"<<endl;
1229             Pause();
1230             while(cth=='Y'||cth=='y'){
1231                 system("cls");
1232                 Snake_Map snake;
1233                 snake.Init();
1234                 snake.Grade_Init();
1235                 R(i,1,4)
1236                     position[i].Init(i);
1237                 snake.Set_Point();
1238                 int nodead=1;
1239                 while(nodead)
1240                     snake.Show_Game(),
1241                     nodead = snake.updata_game();
1242                 system("cls");
1243                 cout << "\n\n\n\t\t\t\tGameover!\n\n"<<endl;
1244                 snake.display();
1245                 cout << "\n\n\n\t\t Try again?\nInput Y: Yes or N: No" << endl;
1246                 while(cin>>cth)
1247                     if(cth=='Y'||cth=='y'||cth=='N'||cth=='n')break;
1248             }
1249             return lever_final>=15;
1250         }
1251     friend class Chapter_Four;
1252 }RetroSnaker;
1253 #endif
1254 #define Game_PacMan PacMan.PacMan_Main()
1255 #ifdef Game_PacMan
1256 int dali,fx[4]={-1,27,1,-27},fxfx[4][2]={{0,-1},{1,0},{0,1},{-1,0}},dis[1000][1000],f=0;
1257 int changdi[30][27]={
1258     {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
1259     {0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
1260     {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
1261     {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
1262     {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
1263     {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
1264     {0,1,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,1,0},
1265     {0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
1266     {0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
1267     {0,0,0,0,0,0,1,0,0,0,0,0,2,0,2,0,0,0,0,0,1,0,0,0,0,0,0},
1268     {0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
1269     {0,0,0,0,0,0,1,0,0,2,0,0,0,3,0,0,0,2,0,0,1,0,0,0,0,0,0},
1270     {0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
1271     {2,2,2,2,2,2,1,2,2,2,0,3,3,3,3,3,0,2,2,2,1,2,2,2,2,2,2},
1272     {0,0,0,0,0,0,1,0,0,2,0,3,3,3,3,3,0,2,0,0,1,0,0,0,0,0,0},
1273     {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
1274     {0,0,0,0,0,0,1,0,0,2,2,2,2,2,2,2,2,2,0,0,1,0,0,0,0,0,0},
1275     {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
1276     {0,0,0,0,0,0,1,0,0,2,0,0,0,0,0,0,0,2,0,0,1,0,0,0,0,0,0},
1277     {0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0},
1278     {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
1279     {0,1,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,1,0},
1280     {0,1,1,1,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,1,1,1,0},
1281     {0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
1282     {0,0,0,1,0,0,1,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,0},
1283     {0,1,1,1,1,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,1,1,1,1,1,1,0},
1284     {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
1285     {0,1,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,1,0},
1286     {0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0},
1287     {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
1288 };
1289 class PacMan{
1290     private:
1291         struct Point {int x,y;};
1292         int x,X1,x2,x3,x4,y,Y1,y2,y3,y4,now,now1,now2,now3,now4,g1,g2,g3,g4,fangx,nextfx,last1,last2,last3,last4,fenshu,guozi,guaitimer,T1,T2,t1,t2,stopped,beichi;
1293     public:
1294         void color(int a){SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);}//颜色函数
1295         void gotoxy(int x,int y){//位置函数(行为x 列为y)
1296             COORD pos;
1297             pos.X=2*y,pos.Y=x;
1298             SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
1299         }
1300         void begin(){
1301             color(11); printf("\t\t\t★"); color(10); printf("Escape From The Black Goats"); color(11); printf("★\n\n"); color(7);
1302             Sleep(1000);
1303             printf("\n\tGet all the Devil Fruits\n\tDon't dead more than 4 times.\n");
1304             printf("Control direction:w/s/a/d\n");
1305             Sleep(2500);
1306             printf("Please open the window to "); color(11); printf("Full screen\n"); color(7);Sleep(1000);
1307             printf("Initialization..., please wait"); 
1308             Sleep(1500);
1309             for (int i=0; i<=809; i++) for (int j=1; j<=809; j++) dis[i][j]=900;
1310             for (int i=0; i<=809; i++){
1311                 for (int j=0; j<=3; j++){
1312                     if (i+fx[j]>=0 && i+fx[j]<=809){
1313                         int k=i+fx[j],xx=k/27,yy=k%27,kk;
1314                         if (changdi[i/27][i%27] && changdi[xx][yy]) dis[i][k]=kk=1;
1315                     }
1316                 }
1317             }
1318             for (int k=0; k<=809; k++)if(changdi[k]){
1319                 for (int i=0; i<=809; i++)if(changdi[i])
1320                     for (int j=0; j<=809; j++)if(changdi[j])
1321                         if (dis[i][j]>dis[i][k]+dis[k][j]) dis[i][j]=dis[i][k]+dis[k][j];
1322                 if (k%80==0){color (13); gotoxy(3,12); printf("");}
1323                 if (k%80==20){color(13); gotoxy(3,12); printf("");}
1324                 if (k%80==40){color(13); gotoxy(3,12); printf("");}
1325                 if (k%80==60){color(13); gotoxy(3,12); printf("");}
1326                 if (k%60==0){color(11); gotoxy(5,k/60); printf("");}
1327             }
1328         }
1329         void shuru(){//Init Speed
1330             char ch=_getch();
1331             t1=45;
1332             t2=60;
1333             if (ch=='A'|ch=='a') if (changdi[x+fxfx[0][0]][y+fxfx[0][1]]==1|changdi[x+fxfx[0][0]][y+fxfx[0][1]]==2) fangx=nextfx=0; else nextfx=0;
1334             else if (ch=='S'|ch=='s') if (changdi[x+fxfx[1][0]][y+fxfx[1][1]]==1|changdi[x+fxfx[1][0]][y+fxfx[1][1]]==2) fangx=nextfx=1; else nextfx=1;
1335             else if (ch=='D'|ch=='d') if (changdi[x+fxfx[2][0]][y+fxfx[2][1]]==1|changdi[x+fxfx[2][0]][y+fxfx[2][1]]==2) fangx=nextfx=2; else nextfx=2;
1336             else if (ch=='W'|ch=='w') if (changdi[x+fxfx[3][0]][y+fxfx[3][1]]==1|changdi[x+fxfx[3][0]][y+fxfx[3][1]]==2) fangx=nextfx=3; else nextfx=3;
1337             else if (ch==' ') stopped=(stopped+1)%2;//Pause
1338         }
1339         void reset(){
1340             system("cls"); color(7);
1341             gotoxy(2,30);
1342             x=22; y=13; 
1343             X1=x2=x3=x4=14; Y1=11; y2=12; y3=14; y4=15;
1344             now=607; now1=389; now2=390; now3=392; now4=393;
1345             for (int k=0; k<=809; k++){
1346                 int i=k/27,j=k%27;
1347                 gotoxy(i,j);
1348                 if (changdi[i][j]==1){color(7); printf("·");}
1349                 else if (!changdi[i][j]){color(1); printf("");}
1350                 if (j=26){gotoxy(i,27); color(7); printf("%d",i);} ////////////////////////////////////////////////////
1351             }
1352             gotoxy(0,0);
1353             gotoxy(x,y); color(14); printf("");
1354             gotoxy(X1,Y1); color(4); printf("");
1355             gotoxy(x2,y2); color(5); printf("");
1356             gotoxy(x3,y3); color(3); printf("");
1357             gotoxy(x4,y4); color(2); printf("");
1358             fangx=0; T1=T2=guaitimer=0; t1=75; t2=100;stopped=0; fenshu=0; guozi=237; g1=g2=g3=g4=0; dali=0;
1359             gotoxy(14,30); printf("  ");
1360         }
1361         void move1(){
1362             int xx,yy;
1363             xx=x+fxfx[nextfx][0]; yy=y+fxfx[nextfx][1];
1364             if (changdi[xx][yy]){
1365                 if (changdi[xx][yy]==1){fenshu+=1; changdi[xx][yy]=2;}
1366                 color(14);
1367                 gotoxy(x,y); printf("  ");
1368                 gotoxy(xx,yy); if (!dali) printf(""); else printf("");
1369                 now=x*27+y; x=xx; y=yy;
1370                 fangx=nextfx;
1371             }
1372             else{
1373                 if (x==13 && y==0 && fangx==0){xx=x; yy=26;}
1374                 else if (x==13 && y==26 && fangx==2){xx=x; yy=0;}
1375                 else{xx=x+fxfx[fangx][0]; yy=y+fxfx[fangx][1];}
1376                 if (changdi[xx][yy]){
1377                     if (changdi[xx][yy]==1){++fenshu; changdi[xx][yy]=2;}
1378                     color(14);
1379                     gotoxy(x,y); printf("  ");
1380                     gotoxy(xx,yy); if (!dali) printf(""); else printf("");
1381                     now=x*27+y; x=xx; y=yy;
1382                 }
1383             }
1384             color(7);
1385         }
1386         int move2(){
1387             int haha,minhaha,xx,yy,chi=0,tim=0;
1388             if (g1){
1389                 minhaha=2147483647;
1390                 if (now1%27==0 | now1%27==26) haha=last1;
1391                 else if (!dali){
1392                     for (int i=0; i<=3; i++)
1393                         if (changdi[(now1+fx[i])/27][(now1+fx[i])%27] && i!=last1 && minhaha>dis[now1+fx[i]][now]) 
1394                             {minhaha=dis[now1+fx[i]][now]; haha=i;}
1395                 }
1396                 else{
1397                     minhaha=-minhaha;
1398                     for (int i=0; i<=3; i++)
1399                         if (changdi[(now1+fx[i])/27][(now1+fx[i])%27] && i!=last1 && minhaha<dis[now1+fx[i]][now]) 
1400                             {minhaha=dis[now1+fx[i]][now]; haha=i;}
1401                 }
1402                 xx=now1/27; yy=now1%27; gotoxy(xx,yy); 
1403                 if (changdi[xx][yy]==1) printf("·");else printf("  "); 
1404                 now1+=fx[haha]; last1=(haha+2)%4;
1405                 xx=now1/27; yy=now1%27; gotoxy(xx,yy); color(4); printf(""); color(7);
1406                 if (xx==x && yy==y){
1407                     if (!dali)++chi;
1408                     else {
1409                         guozi+=50;
1410                         fenshu+=50;
1411                         last1=0;
1412                         gotoxy(now1/27,now1%27); 
1413                         if (changdi[now1/27][now1%27]==1) printf("·"); else printf("  ");
1414                         now1=389;
1415                     }
1416                 }
1417             }
1418             if (g2){
1419                 int k;
1420                 minhaha=2147483647;
1421                 if (fangx==0 | fangx==2){
1422                     k=y+(fxfx[fangx][1])*3;
1423                     while (k>25 | !changdi[x][k]) k--;
1424                     while (k<1 | !changdi[x][k]) k++;
1425                 } else{
1426                     k=x+(fxfx[fangx][0])*3;
1427                     while (k>28 | !changdi[k][y]) k--;
1428                     while (k<1 | !changdi[k][y]) k++; 
1429                 } 
1430                 if (fangx==0 | fangx==2) k=x*27+k; else k=k*27+y;
1431         
1432                 if (now2%27==0 | now2%27==26) haha=last2;
1433                 else if (!dali)
1434                     for (int i=0; i<=3; i++){
1435                         if (changdi[(now2+fx[i])/27][(now2+fx[i])%27] && i!=last2 && minhaha>dis[now2+fx[i]][k])  
1436                             {minhaha=dis[now2+fx[i]][k]; haha=i;}
1437                     }       
1438                 else{
1439                     minhaha=-minhaha;
1440                     for (int i=0; i<=3; i++){
1441                         if (changdi[(now2+fx[i])/27][(now2+fx[i])%27] && i!=last2 && minhaha<dis[now2+fx[i]][k])  
1442                             {minhaha=dis[now2+fx[i]][k]; haha=i;}
1443                     }   
1444                 }
1445                 xx=now2/27; yy=now2%27; gotoxy(xx,yy); 
1446                 if (changdi[xx][yy]==1) printf("·");else printf("  "); 
1447                 now2+=fx[haha]; last2=(haha+2)%4; gotoxy(18,30);
1448                 xx=now2/27; yy=now2%27; gotoxy(xx,yy); color(5); printf(""); color(7);
1449                 if (xx==x && yy==y){
1450                     if (!dali) chi+=1;
1451                     else {
1452                         guozi+=50;
1453                         fenshu+=50;
1454                         last2=0;
1455                         gotoxy(now2/27,now2%27); 
1456                         if (changdi[now2/27][now2%27]==1) printf("·"); else printf("  ");
1457                         now2=390;
1458                     }
1459                 }
1460             }
1461             if (g3){
1462                 int k;
1463                 minhaha=2147483647;
1464                 if (fangx==0 | fangx==2){
1465                     k=y+(fxfx[(fangx+1)%4][1])*3;
1466                     while (k>25 | !changdi[x][k]) k--;
1467                     while (k<1 | !changdi[x][k]) k++;
1468                 } else{
1469                     k=x+(fxfx[(fangx+1)%4][0])*3;
1470                     while (k>28 | !changdi[k][y]) k--;
1471                     while (k<1 | !changdi[k][y]) k++; 
1472                 } 
1473                 if (fangx==0 | fangx==2) k=x*27+k; else k=k*27+y;
1474         
1475                 if (now3%27==0 | now3%27==26) haha=last3;
1476                 else if (!dali)
1477                     for (int i=0; i<=3; i++){
1478                         if (changdi[(now3+fx[i])/27][(now3+fx[i])%27] && i!=last3 && minhaha>dis[now3+fx[i]][k])  
1479                             {minhaha=dis[now3+fx[i]][k]; haha=i;}
1480                     }   
1481                 else {
1482                     minhaha=-minhaha;
1483                     for (int i=0; i<=3; i++){
1484                         if (changdi[(now3+fx[i])/27][(now3+fx[i])%27] && i!=last3 && minhaha<dis[now3+fx[i]][k])  
1485                             {minhaha=dis[now3+fx[i]][k]; haha=i;}
1486                     }   
1487                 }   
1488         
1489                 xx=now3/27; yy=now3%27; gotoxy(xx,yy); 
1490                 if (changdi[xx][yy]==1) printf("·");else printf("  "); 
1491                 now3+=fx[haha]; last3=(haha+2)%4; gotoxy(18,30);
1492                 xx=now3/27; yy=now3%27;         
1493                 gotoxy(xx,yy); color(3); printf(""); color(7);
1494                 if (xx==x && yy==y){
1495                     if (!dali)++chi;
1496                     else {
1497                         guozi+=50;
1498                         fenshu+=50;
1499                         last3=0;
1500                         gotoxy(now3/27,now3%27); 
1501                         if (changdi[now3/27][now3%27]==1) printf("·"); else printf("  ");
1502                         now3=341;
1503                     }
1504                 }
1505             }
1506             if (chi)++beichi;
1507             if(beichi>=4){
1508                 while(1){
1509                     printf("No! Black Goats Are Coming...\n");
1510                     printf("\t\t\tAah Aah Aah Aah Aah Aah...\n"),sleep(1);
1511                     if(++tim==10)
1512                         return 2;//Cthulu End
1513                 }
1514             }
1515             return 1;
1516         }
1517         Ib PacMan_Main(){
1518             begin();
1519             int jixu=1;
1520             reset();
1521             string bb[4]={"","","",""}; color(7);
1522             gotoxy(12,12); printf("Ready"); color(12);
1523             for (int i=3; i>=0; i--){if (i==0) color(11);gotoxy(13,13); cout<<bb[i]; Sleep(1000);}
1524             gotoxy(12,12); printf("      "); gotoxy(13,13); printf(" "); color(7);
1525             while (!f){
1526                 Sleep(1);
1527                 gotoxy(10,30); printf("Score:%d   ",fenshu);
1528                 gotoxy(8,30); printf("Monster speed:%d   ",300-t2);
1529                 gotoxy(9,30); printf("Character speed:%d   ",300-t1);
1530                 gotoxy(15,30); printf("Dead time:%d ",beichi);
1531                 if (kbhit()) shuru();
1532                 if (stopped) continue;
1533                 T1=(T1+1)%t1; T2=(T2+1)%t2;
1534                 if (T1%t1==0 && now+fx[fangx]>0 && now+fx[fangx]<809) move1();
1535                 if (T2%t2==0){
1536                     if (guaitimer<=8){
1537                         if (guaitimer==0) g1=1;
1538                         if (guaitimer==8) g2=1;
1539                         guaitimer++;
1540                     }
1541                     if (!g3 && fenshu>=30) g3=1;
1542                     int result=move2();
1543                     if(result==2)return 0;
1544                 }
1545                 if (fenshu==guozi)f=2;
1546             }
1547             if (f==2) {
1548                 Sleep(2500);
1549                 system("cls");
1550                 printf("\n\tCongratulations on having all the Devil fruit!\n\tIt's time to counterattack!\n");
1551                 return 1;
1552             }
1553             return 0;
1554         }
1555         friend class Chapter_Four;
1556 }PacMan;
1557 #endif
1558 class Chapter_Four{//Content: Philip met Magwitch again, and enemy is also appear.
1559     public:
1560         void Cthulu_Crazy(){
1561             int x=10,y=10;
1562             srand(unsigned(time(NULL)));
1563             while(1){
1564                 int x_crazy=GetSystemMetrics(SM_CXSCREEN),y_crazy=GetSystemMetrics(SM_CYSCREEN);
1565                 SetCursorPos(rand()%x_crazy,rand()%y_crazy);
1566                 system("cls");
1567                 R(i,1,x)putchar(' ');
1568                 R(i,1,y)putchar('\n');
1569                 printf("~Cthulu~");
1570                 Cthulu_Color;
1571                 x+=rand()%6,y+=rand()%6;
1572             }
1573         }
1574         void Cthulu_Ending(){
1575             system("color 4E");
1576             printf("\n\n\n");
1577             Print("\tWe tried...\n"),sleep(2);
1578             Print("\tAnd we failed...\n"),sleep(2);
1579             Print("\tBelievers are screaming...\n"),sleep(2);
1580             Print("\tFire expands, children are crying..."),sleep(2);
1581             Print("\tThen screaming...\v\tEveryone seem to become crazy...\n\n\n");
1582             Print("\tAnd so I...\n");
1583             Cthulu_Crazy();
1584         }
1585         void Dec_6(){
1586             system("color 0E");
1587             Print("\tDec. 6\n"),sleep(2),
1588             Print("Tonight, the wind blows strongly.\n"),sleep(2);
1589             R(i,1,3)Cthulu_Color;
1590             system("color 0E");
1591             Print("A man stands besides my door with an indescrible eyes.\n"),sleep(2);
1592             Print("We watch each other for a long time.\n"),sleep(2);
1593             Print("\tPip\nHe breaks the silence.\n"),sleep(2);
1594             Print("\tMr.Magwitch?\nI cannot trust my eyes.\n"),sleep(2);
1595             Print("\n\tI need your help.\n"),sleep(2);
1596             R(i,1,3)Cthulu_Color;
1597             Pause();
1598         }
1599         void Dec_14(){
1600             system("color 0E");
1601             Print("\tDec. 14\n"),sleep(2),
1602             Print("Mr.Magwitch was innocent.\nHe was accused of participating in a cult rally.\nAnd sacrificed his daughter.\nSo he fell into jail.\nBut the murderer is a Believer of a cult god known as Cthulu.\nHis wife is one of the believers. . .\n\nNow Believers are planning to resurrect the evil spirits.\nOnly six Saints' Hallows can fight against Cthulu.\n\nThe summoning ceremony is on this Christmas Eve\n"),sleep(2);
1603             Print("He spend years searching for the Hallows, but only find The Map Of Aladdin.\nIt's just a tool.\n"),sleep(2);
1604             Print("But through the magic inside it. He got the position of all the Hollows.\nAnd reached Tsinghua School.\n"),sleep(2);
1605             Print("\tWhy you come here?\nWhen I asked him, he replied...\n"),sleep(2);
1606             Print("\tThere's two Hallows in this school.\nOne is at your backpack.\n"),sleep(2);
1607             Print("\n\tWhat!\n"),sleep(2);
1608             Print("\n\tIt's named The Key Of Dust.\n\n\n");
1609             D_e_Line,sleep(4.5);
1610             Print("This is our conversation a week ago.\n"),sleep(2);
1611             Print("And we have spent a whole week searching for another Hallow, by the name of The Flute Of Magic.\n"),sleep(2);
1612             Print("And now we are so confidenr that the Hallow must be at The Maze Of Interdisciplinary Information College.\n"),sleep(2);
1613             Print("I shared the situation with Herbert, he trusted us, and promised to help us.\n"),sleep(2);
1614             Print("\nNow we are sneaking in...\n"),sleep(4.5);//I used to wanna set a Maze here, but I failed.
1615             Print("\tOh no.!\nHerbert shouted out.\n"),sleep(2);
1616             Print("It's embarressed when you hold your target on your hands.\nAnd the headmaster is standing in front of you with a straight face.\n"),sleep(2);
1617             Print("\n\tYou two, what are you doing now.\n"),sleep(2);
1618             Print("\tAre you Believers?\n"),sleep(3);
1619             Print("\nI suddenly be alert to him.\nWhy him know Believers?."),sleep(3);
1620             printf("Choose Your Decision:\n1: Mr.Jaggers must be a Believer, beating him down!\n2: Wait, I'd better explain out condition to him, maybe he can help.\n");
1621             char opt;
1622             while(cin>>opt){
1623                 if(opt=='1'){
1624                     Character Jaggers;
1625                     Jaggers.name="Jaggers";
1626                     Jaggers.attack=4000;
1627                     Jaggers.defensive=1200;
1628                     Jaggers.speed=1200;
1629                     Jaggers.HP=25000;
1630                     sleep(2);
1631                     putchar('\n');
1632                     Combat_Effectiveness(Jaggers);
1633                     D_e_Line,sleep(2);
1634                     Character Herbert;
1635                     Herbert.name="Herbert";
1636                     Herbert.attack=1000;
1637                     Herbert.defensive=500;
1638                     Herbert.speed=1000;
1639                     Herbert.HP=4000; 
1640                     Combat_Effectiveness(Herbert);
1641                     D_e_Line,sleep(2);
1642                     Combat_Effectiveness(Philip);
1643                     D_e_Line,sleep(2);
1644                     Character PhilipAndHerbert;
1645                     PhilipAndHerbert.name="Philip And Herbert";
1646                     PhilipAndHerbert.attack=(Philip.attack+Herbert.attack)*3>>2;
1647                     PhilipAndHerbert.defensive=(Philip.defensive+Herbert.defensive)*3>>2;
1648                     PhilipAndHerbert.speed=(Philip.speed+Herbert.speed)*3>>3;
1649                     PhilipAndHerbert.HP=((Philip.HP+Herbert.HP)*3>>2)+1000;
1650                     printf("Fighter One: Philip and Herbert\nFighter Two: Jaggers\n"),sleep(3);
1651                     Fight(PhilipAndHerbert,Jaggers),sleep(4.5);
1652                     Print("\n\tStop! JoJo!\nIt's Magwitch.\n");
1653                     break;
1654                 }
1655                 else if(opt=='2'){
1656                     Print("\nOh my god, JoJO!\nMagwitch suddenly appears.\n");
1657                     break;
1658                 }
1659             }
1660             sleep(2);
1661             Print("Jaggers lets us go, looking confused but exciting.\n"),sleep(2);
1662             Print("\tThey are my friends, JoJo.\nMagwitch said to Jaggers."),sleep(2);
1663             Print("\nThen we know Jaggers, who's nick name is JoJo, and Magwitch used to be comrades. They fight against Believers together many years ago.\n"),
1664             Print("But after the death of Jaggers' wife, they separated...\nBut they two never give up fighting.\n"),
1665             Print("\nMr.Jaggers have protected The Flute Of Magic  with his snake, Kirito, for over twenty years.\n"),sleep(2);
1666             Print("Magwitch told us:\n");
1667             Print("\tThe blood moon will come out on the 21st.\nOther Hallows will be reappeared.\nOn that day the four of us must act.\nThis is the last chance.\n"),sleep(2);
1668             Pause();
1669         }
1670         void Dec_21(){
1671             system("color 0E");
1672             Print("\tDec. 21\n"),sleep(2),
1673             Print("Blood Moon comes out...\n"),sleep(2);
1674             Print("We need to get all the other Four Hallows.\n"),sleep(2),
1675             Print("That's the only way to beat down Cthulu.\n"),sleep(2),
1676             Print("With the help of Mr.Jaggers and Herbert, we finally reached the Dark Cave.\n"),sleep(2);
1677             system("color 4E");
1678             Print("\tPhilip! Watch out!\n"),sleep(2);
1679             Print("Herbert pushes me away.\n"),sleep(2);
1680             Print("And from the cave, a large swath of flying insect-like organisms is attacking us.\n"),sleep(2);
1681             Print("\tKirito, Kill them all.\n"),sleep(2);
1682             Print("Jaggers takes out Magic Flute.\n"),sleep(2);
1683             Print("But a mantis-like organisms catches him.\n"),sleep(2);
1684             Print("The Magic Flute rolls to my hand.\n"),sleep(2);
1685             Print("\n\tPhilip, Hurry! Control Kirito, driving the enemies away!\n"),sleep(2);
1686             Print("\n\tThe music of the Magic Flute rings out, shining in the moonlight.\n");
1687             Print("Kirito's eyes seem like blood...\n");
1688             int result=Game_RetroSnaker;
1689             if(!result)
1690                 Cthulu_Ending();
1691             Print("The monsters are drived away.\n");
1692             Print("We succesfully get in the Cave.\n"),sleep(3);
1693             Backpack.insert("The Sword Of King Arthur");
1694             Print("\n\tYou Get The Sword Of King Arthur!\n");
1695             printf("Press 'P' to view backpack\n'C' to continue\n");
1696             char opt;
1697             while(cin>>opt){
1698                 if(opt=='P'||opt=='p'){
1699                     View_Backpack(),
1700                     Pause();break;
1701                 }
1702                 if(opt=='C'||opt=='c')break;
1703             }
1704             Print("\tNow\n");
1705             Print("\tWe got\n\tKey Of Secret\n\tFlute Of Dust\n\tThe Sword Of King Arthur!\nHerbert shouts happily.\n"),sleep(2);
1706             Print("\n\tDon't be happy so quick.\n\tThere's still two inside the dark.\nJaggers said.\n"),sleep(2);
1707             Print("\tIt's time to get Frostmourne.\n\tIn fact...\nJaggers adds.\n"),sleep(2);
1708             Print("\tMy wife was killed by it.\n"),sleep(3);
1709             system("color 17");
1710             Print("\nThrough the map, we get to the The Stormpeaks.\n"),sleep(2);
1711             Print("Now\nThree Belivers are chanting magic.\n"),sleep(2);
1712             Print("\tMerciful Yoggsotos\n\tGive deathly stillness to the dead land!\n\tWelcome Black Goats!\n");
1713             system("color 4E");
1714             Print("\n\n\tPhilip, watch out!\n\t\tDon't be trampled by the Black Goats!\n");
1715             system("cls");
1716             system("color 0E");
1717             result=Game_PacMan;
1718             if(!result)Cthulu_Ending();
1719             system("color 0E");
1720             sleep(3);
1721             Backpack.insert("The Frostmourne Of War");
1722             Print("You Get The Frostmourne Of War!\n");
1723             printf("Press 'P' to view backpack\n'C' to continue\n");
1724             while(cin>>opt){
1725                 if(opt=='P'||opt=='p'){
1726                     View_Backpack(),
1727                     Pause();break;
1728                 }
1729                 if(opt=='C'||opt=='c')break;
1730             }
1731             Print("\tMany years ago, my wife and me tried to get this sword.\n"),sleep(2);
1732             Print("\tWe have already got it.\n\tBut A Believer attacked us.\n"),sleep(2);
1733             Print("\t\tMy wife used the sword to fight back, but that Believer's sickle reached her...\n"),sleep(2);
1734             Print("\tI was hurt. The only thing I can do was watching the Believer picked up Frostmourne, and swinging...\n"),sleep(2);
1735             Print("Jaggers told us slowly.\n"),sleep(3);
1736             Print("\tMoon is fallen, time to come back...\n");
1737             Pause();
1738         }
1739         void Dec_24(){
1740             system("color CE");
1741             Print("\tDec. 24\n"),sleep(2),
1742             Print("\t\tThe last fight is coming.\n"),sleep(2);
1743             Print("\tThough we haven't collected all the six Hallows,\n\tthe Believers have all gathered at the center of Yalan.."),sleep(2);
1744             Print("\t\tCthulu~Cthulu~Cthulu~...\n"),sleep(2);
1745             Print("\tThey are screaming with an indescribable voice...\n");
1746             R(i,1,3){
1747                 Cthulu_Color;
1748                 R(j,0,i)putchar('\t');
1749                 Print("\tCthulu~Cthulu~Cthulu~\n");
1750             }
1751             system("color CE");
1752             Print("I have waited for you Twenty Years!\n\tJaggers shouted to a Believer.\n"),sleep(2);
1753             Print("The Believer wears a black cloak, covering the whole body, and holds a sickle...\n"),sleep(2);
1754             Character Death;
1755             Death.name="Death";
1756             Death.attack=10000;
1757             Death.defensive=1500;
1758             Death.speed=2000;
1759             Death.HP=100000;
1760             Print("I realize it's the one who killed Mr.Jagger's wife.\n"),sleep(2);
1761             Print("But this time, it's Jaggers controls Frostmourne...\n\n"),sleep(2);
1762             Character Jaggers;
1763             Jaggers.name="Jaggers";
1764             Jaggers.attack=80000;
1765             Jaggers.defensive=1500;
1766             Jaggers.speed=1500;
1767             Jaggers.HP=40000;
1768             sleep(2);
1769             Combat_Effectiveness(Jaggers);
1770             D_e_Line,sleep(2);
1771             Combat_Effectiveness(Death);
1772             D_e_Line;
1773             printf("Fighter One: Jaggers\nFighter Two: Death\n"),sleep(2);
1774             Fight(Jaggers,Death),sleep(2);
1775             putchar('\n');
1776             Print("After a hard fight.\nDeath's sickle falls down from his wrist...\n"),sleep(2);
1777             Backpack.insert("The Sickle Of Death");
1778             Print("\nYou Get The Sickle Of Death\n");
1779             printf("Press 'P' to view backpack\n'C' to continue\n");
1780             char opt;
1781             while(cin>>opt){
1782                 if(opt=='P'||opt=='p'){
1783                     View_Backpack(),
1784                     Pause();break;
1785                 }
1786                 if(opt=='C'||opt=='c')break;
1787             }
1788             system("color C4");
1789             Print("The six hollows have been found five.\n"),sleep(2);
1790             system("color CE");
1791             Print("However, Jaggers is also hurt.\nHe cannot fight anymore.\n"),sleep(2);
1792             Print("But the Believers are closing.\n"),sleep(2);
1793             Print("Jaggers, with Frostmourne\n\tHerbert, with King Athur's Sword\n\t\tMagwitch, with Magic Flute\n\t\t\tI, with... a wooden stick... fight together.\n"),sleep(2);
1794             Print("The Believers are driving away.\n"),sleep(2);
1795             Print("It seems that we will surely stop the summoning ceremony.\n"),sleep(2);
1796             R(i,0,2)Cthulu_Color;
1797             system("color 62");
1798             Print("Until a green flash breaks from the fire fields...\n"),sleep(2);
1799             Print("\tOh~Merciful Cthulu~Let the honest death be your honor!\n");
1800             R(i,0,2)Cthulu_Color;
1801             system("color 62"),sleep(2);
1802             Print("\tOh~Merciful gentlemen, best thanks for your sacrifice.\n\t~Cthulu's dearest son-in-law, Abel Magwitch!\n"),sleep(2);
1803             Print("\n\n\tNo, Lier!\nMagwitch suddenly realizes something.\nHe turns to us with a white face without hope.\n"),sleep(2) ;
1804             Print("\tSorry, it's all my fault.\n");
1805             R(i,0,2)Cthulu_Color;
1806             system("color 62"),sleep(2);
1807             Print("We are shocked.\n"),sleep(2);
1808             Print("\tIn fact the five hollows is nothing to Cthulu.\n\tI lied to you just for finding Cthulu, my Father-in-law.\n"),sleep(2);
1809             Print("\n\tYou wanna me fucking believe your word?\n\tAfter so much!\n\tFor What!\nI cried out.\n"),sleep(2);
1810             Print("\n\tYou do not how much I wanna revenge on it.\n\tBut the only thing can vanish it is the last hollow:\b\t\t\tThe Blood Of Cruel.\n"),sleep(2);
1811             Print("\tIt's not a object, but a real body, which owns the blood from Cthulu.\n"),sleep(2);
1812             Print("\nI realized something, looking at him to my dismay.\n"),sleep(2);
1813             Print("\n\tAnd I am that body.\n");
1814             R(i,0,2)Cthulu_Color;
1815             system("color 62"),sleep(2);
1816             Print("\n\n\tOh~ That's how you step into this trap.\n\tWe are not expecting reviving Our Honorable Father since the first time, Cthulu~ have already coming for a long period.\n\tWe Just For Vanish You.\nThe voice from the flash screams.\n");
1817             R(i,0,2)Cthulu_Color;
1818             system("color 62"),sleep(2);
1819             R(i,1,3){
1820                 R(j,1,i)
1821                     putchar('\t');
1822                 Print("Run!!!!!\n");
1823                 Print("Mr. Magwitch!!!");
1824             }
1825             Print("\nTo protect us,\n Magwitch turned into light.\nHis blood shines like the sun.\n\n"),sleep(2);
1826             system("color FE"),sleep(4.5);
1827             Print("Open eyes again, every one is at a safe place.\n"),sleep(2);
1828             Print("Except Mr.Jaggers and Magwitch...\n");
1829             Pause();
1830         }
1831         void Dec_25(){
1832             system("color 0E");
1833             Print("\tDec. 25\n"),sleep(2),
1834             Print("\tWhat next should we do?\nHerbert asked me.\n"),sleep(2);
1835             Print("\nI heared the poets eulogizing the Christmas.\n"),sleep(4.5);
1836             system("color 0D");
1837             Print("\nHappy Christmas, that can win us back to the delusions ofour childhood days.\nRecall to the old man the pleasures of hisyouth.\nAnd transport the traveler back to his own fireside andquiet home...\n"),sleep(2);
1838             system("color 0E");
1839             Print("\nWe Fight.\n");
1840         }
1841         void Chapter_Four_Main(){ 
1842             Print_Chapter_Slowly(),
1843             printf("F"),sleep(0.5),
1844             printf("o"),sleep(0.5),
1845             printf("u"),sleep(0.5),
1846             printf("r\n"),sleep(0.5);
1847             system("color B7");
1848             Print("Two years passed, the winter is still cold.\n");
1849             sleep(2);
1850             Print("These days I do not have a good time.\nWherever I go, I feel that someone is watching me.\n");
1851             sleep(4.5);
1852             Print("And the ordinary life has broken, like a glass...\n");
1853             Pause(),system("cls");
1854             Dec_6(),system("cls");
1855             Dec_14(),system("cls");
1856             Dec_21(),system("cls");
1857             Dec_24(),system("cls");
1858             Dec_25(),sleep(4.5),
1859             printf("\nChapter Four Over\n");
1860             Pause();
1861             return;
1862         }
1863         friend class RetroSnaker;
1864         friend class PacMan;
1865 }Chapter_Four;
1866 #undef Game_RetroSnaker
1867 #undef Game_PacMan
1868 //Chapter Five
1869 class Chapter_Five{//Contents: Philip returned Miss.Havisham's House. Estella told him her life.
1870     public:
1871         void Chapter_Five_Main(){
1872             system("color 8C");
1873             Print_Chapter_Slowly(),
1874             printf("F"),sleep(0.5),
1875             printf("i"),sleep(0.5),
1876             printf("v"),sleep(0.5),
1877             printf("e\n"),sleep(0.5),
1878             Print("\nBelievers behave more and more frequently.\n"),
1879             Print("At a sneak raid, Herbert and I have separated.\n");
1880             Print("I don't know if he is alive.\nBut I must take action with the left two Hallows.\n"),sleep(2);
1881             Print("\n\tThe Key Of Dust and The Flute Of Magic.\n"),sleep(2);
1882             printf("\nNow where should I go?\n1: Miss.Havisham's House\n2: Tsinghua School\n");
1883             char opt;
1884             while(cin>>opt){
1885                 if(opt=='1')break;
1886                 if(opt=='2'){
1887                     Print("\nI may go back to school, Mr,Jaggers may has left some information in it.\n"),sleep(2);
1888                     Print("\nBut it must be full of Believers now.\nI have no idea.\n"),sleep(2);
1889                     break;
1890                 }
1891             }
1892             Print("\nYes, I should return to Miss.Havisham's House.\n");
1893             Print("That's where I get The Key Of Dust.\n");
1894             Print("That gloomy place may well kept other secrets.\n");
1895             Print("Especially Miss.Havisham...\n"),sleep(3);
1896             Havisham_House.ReturnTime();
1897             system("color 8C");
1898             Print("When I step out the Hall.\n");
1899             Print("Estella is in front of me.\n"),sleep(2);
1900             Print("\n\tPip, let me tell you the truth.\nShe said quitely"),sleep(4.5);
1901             system("color 93");
1902             Print("\n\n\tWhen I was a tiny girl, I have a happy childhood.\n"),sleep(2);
1903             Print("\tMy dad, you have met, is the son of Cthulu.\n");
1904             Print("\tHe fell in love with my mom, Havisham, and got married with her,\n"),
1905             Print("\tdespiting strenuous objections by Cthulu...\n"),sleep(2);
1906             Print("\tOne day, Cthulu asked my dad to help him come to the earth.\n"),sleep(2);
1907             Print("\tOf course my dad refused.\n\tThen Cthulu cheated my mom.\n"),sleep(2);
1908             Print("\t\t'Dear~ Havisham, if you help me, I'd admit your wedding...'\n"),sleep(2);
1909             Print("\n\t\t'Oh yes, Mr.Cthulu, thank you!'\n"),sleep(2);
1910             Print("\tThat's the conversation between them.\n\tThen Cthulu came...\n"),sleep(2);
1911             Print("\tCthulu seduced our servants to kill us.\n"),sleep(2);
1912             Print("\tThey prepared a cult rally,\n\t\tsacrifing my brother,\n\t\tmy grandparents,\n\t\tmy confidante...\n"),sleep(2);
1913             Print("\tOnly one old cook suddenly restores his mind,\n\tand hid my mom and me in this house.\n"),sleep(2);
1914             Print("\tDad was accused of sacrificing me in that rally.\n\tHe did not know we are alive.\n\tThe vengeful desire forced him to spend his life searching for Cthulu...\n"),sleep(2);
1915             Print("\tHe has gone, the only one who owns The Blod Of Cruel is me now.\nEstella looks firm, hair swayed in the night wind."),sleep(2);
1916             Print("\n\tSo you want be the Light, sacricing yourself to save the world?\nI asked her slowly.\n");
1917             Print("\n\tYes, please.\n\tIt's time to settle accounts.\n"),sleep(2);
1918             Print("\tHelp me, Pip.\n"),sleep(4.5);
1919             Print("Chapter Five Over.");
1920             return;
1921         }
1922 }Chapter_Five;
1923 //Chapter Six
1924 #define PlayMusic Music()
1925 #ifdef PlayMusic
1926 enum fy{
1927     d1 = 262, d1_ = 277, d2 = 294, d2_ = 311, d3 = 330, d4 = 349, d5 = 392, d5_= 415,
1928     d6 = 440, d6_= 466, d7 = 494, z1 = 523, z1_ = 554, z2 = 578, z2_ = 622, z3 = 659,
1929     z4 = 698, z4_ = 740, z5 = 784, z5_ = 831, z6 = 880, z6_ = 932, z7 = 988, g1 = 1046,
1930     g1_ = 1109, g2 = 1175, g2_ = 1245, g3 = 1318, g4 = 1397, g4_ = 1480,
1931     g5 = 1568, g5_ = 1661, g6 = 1760, g6_ = 1865, g7 = 1976, yaya = 0
1932 };
1933 struct yf{
1934     enum fy s;
1935     int t;
1936 };
1937 void Music(){
1938     R(i,1,2){
1939         struct yf a[1000]={
1940                 {z6,50},{z7,50},{g1,150},{z7,50},{g1,100}, //5
1941                 {g3,100},{z7,300},{z3,100},{z6,150},{z5,50}, //10
1942                 {z6,100},{g1,100},{z5,300},{z2,50},    //14
1943                 {z3,50},{z4,150},{z3,50},{z4,50},{g1,150}, //19
1944                 {z3,150},{z2,50},{z3,50},{g1,150},{z7,150}, //24
1945                 {z4_,50},{z4_,100},{z7,100},{z7,200},{z6,50}, //29
1946                 {z7,50},{g1,150},{z7,50},{g1,100},{g3,100}, //34
1947                 {z7,200},{z3,100},{z6,150},      //37
1948                 {z5,50},{z6,100},{g1,100},{z5,300},{z3,100},{z4,100},{g1,50}, //44
1949                 {z7,150},{g1,100},{g2,100},      //47
1950                 {g3,50},{g1,150},{g1,50},{z7,50},{z6,100},{z7,100},{z5_,100}, //54
1951                 {z6,300},{g1,50},{g2,50},   //57
1952                 {g3,150},{g2,50},{g3,100},{g5,100},{g2,300},{z5,100}, //63
1953                 {g1,150},{z7,50},{g1,100},{g3,100},{g3,300},{z6,50},{z7,50},{g1,150}, //71
1954                 {z7,50},{g1,100},{g2,100},{g1,150},{z5,50}, //76
1955                 {z5,200},{g4,100},{g3,100},{g2,100},{g1,100}, //81
1956                 {g3,400},{yaya,50},{g3,50},{g6,200},{g5,100},{g5,100},{g3,50}, //88
1957                 {g2,50},{g1,100},{yaya,50},{g1,50},{g2,100},{g1,50},{g2,100},{g5,100}, //96
1958                 {g3,200},{yaya,50},{g3,50},{g6,200},{g5,200},{g3,50},{g2,50}, //103
1959                 {g1,200},{yaya,50},{g1,50},{g2,100},{g1,50},{g2,100},{z7,100}, //110
1960                 {z6,200},{yaya,100},{z6,50},{z7,50},{z6,500}
1961         };
1962         struct yf *atop;
1963         atop = a;
1964         int n = 194;
1965         while(n--){
1966             Beep(atop->s,atop->t*5);
1967             ++atop;
1968         }
1969     }
1970     return;
1971 }
1972 #endif 
1973 class Chapter_Six{
1974     public:
1975         void Chapter_Six_Main(){
1976             system("color 0E");
1977             Print_Chapter_Slowly(),
1978             printf("S"),sleep(0.5),
1979             printf("i"),sleep(0.5),
1980             printf("x"),sleep(0.5),
1981             Print("\n\t\tHerbert died.\n"),sleep(3);
1982             Print("This morning, when I was reading the news,\n"),
1983             system("color C4");
1984             Print("the topic came into view:"),sleep(2);
1985             Print("\n\tA 20 years around man died in London on Saturday.\n\tAccording to eyewitnesses,\n\tHe was holding a sword, fighting with a octopus-like being.\n");
1986             Print("\tHe had nearly kill that being, but as soon as he touched its blodd.\n\tHe was like being crueled.\n"),
1987             Print("\tHe kept screaming an indescrible words.\n");
1988             Print("\t\t'Cthulu~ Cthulu~ Cthulu~'.\n");
1989             Print("\tThen some people began to follow him, screaming 'Cthulu~'\n");
1990             Print("\tBefore every one got crazy, the polish arrived,\n\tshooting to the young man...\n");
1991             system("color B7");
1992             Print("\nI remembered several years ago,\nhow Herbert and I both held secret love for Estella,\nand we met in the Garden to fight.\n"),sleep(2),
1993             Print("\nI remembered years later,\nhow we beat down the challenging opponents,\nand then step into Tsinghua.\n"),sleep(2);
1994             Print("\nI remembered not long befoe now,\nhow we fight together,\nand experience countless life-and-death partings.\n"),sleep(2);
1995             Print("They are only my own memory now.\n"),sleep(2);
1996             system("color 0E");
1997             Print("\n\tKeep calm, Pip.\n\tCthulu has hurt, he must be still in London.\n\tWhat we need now is nothing but find Cthulu,\n\tand let him pay the price!\nEstella said.\n"),sleep(3.5);
1998             Print("\n\tYou're right, Estella.\n\tWe need to go now.\n"),sleep(3.5);
1999             Last_Fight();
2000         }
2001         void Last_Fight(){
2002             system("cls");
2003             R(i,1,3)Cthulu_Color;
2004             Print("\n\n\n\tHew~ ded~ yeu~ fend~ meeee~\nCthulu seems can't believe this.\n"),
2005             system("color 0E");
2006             Print("\n\tOh, our 'greatest' Cthlu,\n\twe have searched for you in every corner of London.\nI smiled, with flames of fury in heart.\n"),sleep(2);
2007             Print("\n\tYou killed my dad, and caused my mom's crazy!\nEstella shouted out to Cthulu.\n"),sleep(2);
2008             R(i,1,3)Cthulu_Color;
2009             Print("\n\tOe~ Thet's veey serprising, bet whet're yeu waet?\n\tKiel mee?\n\tYeu teoooo...?\n");
2010             system("color 0E");
2011             Print("\nHis voice has a stange power.\nI feel an impulse, seducing me to be crazy.\n");
2012             Print("But we are not afraid of him anymore.\n\n"),sleep(2);
2013             Character Cthulu;
2014             Cthulu.name="Cthulu";
2015             Cthulu.attack=6000000;
2016             Cthulu.defensive=13000;
2017             Cthulu.speed=3000;
2018             Cthulu.HP=20000000;
2019             Combat_Effectiveness(Cthulu);
2020             Character PhilipAndEstella;
2021             PhilipAndEstella.name="Philip and Estella";
2022             PhilipAndEstella.attack=4000;
2023             PhilipAndEstella.defensive=10000;
2024             PhilipAndEstella.speed=2000;
2025             PhilipAndEstella.HP=98000;
2026             putchar('\n');
2027             Combat_Effectiveness(PhilipAndEstella);
2028             printf("Fighter One: PhilipAndEstella\nFighter Two: Cthulu\n"),sleep(3);
2029             Fight(PhilipAndEstella,Cthulu);
2030             Print("\nWe don't know he's power is so strong.\nEstella and I have hurt seriously.\n"),sleep(2);
2031             R(i,1,3)Cthulu_Color;
2032             Print("\n\tHeee, yeu stepid, lee henst deeth be yoer henor.\n\tImpieey Heman beiegssss...!\n");
2033             system("color 0E");
2034             Print("\n\tGood bye, Pip.\n"),sleep(3.5);
2035             Print("\tI love you...\nEstella whispered\n"),sleep(4.5);
2036             Estella_Sacifice();
2037         }
2038         void Estella_Sacifice(){
2039             system("color 94");
2040             Print("\n\tEstella, no!\nI tried to stop her.\n");
2041             Print("But it's too late.\n"),sleep(3.5);
2042             system("color F6");
2043             Print("\nA bright shine gets out of her body.\nThen two\nThree\nFour...\n"),sleep(2);
2044             Print("Until Estella's body all turned into the light.\n"),sleep(2);
2045             Print("\nee!e!!ee!!eeeee!!!ee!eee!e...\nCthulu screams.\n");
2046             Print("Its's body breaks into pieces...\n"),sleep(4.5);
2047             Print("Then the moon came out.\n"),sleep(2);
2048             Print("As red as blood...\n"),sleep(2);
2049             Print("And the wind passed me.\n"),sleep(2);
2050             Print("As soft as tears...\n"),sleep(4.5);
2051             End_Cemetery();
2052         }
2053         void End_Cemetery(){
2054             system("color B7");
2055             Print("\nSeveral days later,\nI came back my hometown.\n");
2056             Show_Stick_Man(1);
2057             Print("Joe welcomed me enthusiastically.\n"),sleep(2);
2058             Print("I pretented that there is nothing wrong,\neven after so much...\n"),sleep(2);
2059             Print("\nThis evening, I go to the cemetery again.\n"),sleep(2);
2060             Print("Beside two more new tombs, the winter is nothing changed.\n"),sleep(2);
2061             Print("When I was a child, Magwitch told me:\n"),sleep(2);
2062             Print("\n\tWhen the snow melts, I'll wait for you on the lakeside.\n"),
2063             sleep(4);
2064             Print("\n\tWhy?\n");
2065             sleep(3);
2066             Print("\n\tBecause we are friends...\n");
2067             sleep(3.5);
2068             Print("\nIt's a lie, like a dream...\n"),sleep(2);
2069             Print("I am the dreamer.\n"),sleep(2);
2070             Print("It's time to wake up...\n"),sleep(4.5);
2071             Print("The End");
2072             PlayMusic;
2073             return;
2074         }
2075 }Chapter_Six;
2076 #undef PlayMusic
2077 Iv Chapter_Prologue(){
2078     system("color B7");
2079 //    Show_Lake();
2080     Print("When the snow melts, I'll wait for you on the lakeside\n"),
2081     sleep(4);
2082     Print("Why\n");
2083     sleep(3);
2084     Print("Because we are friends...\n");
2085     sleep(3.5);
2086 }
2087 //Introdution At The End
2088 Iv Introduce_Bingoyes(){
2089     putchar('\n');
2090     system("color 0E");
2091     D_e_Line;
2092     Print("A strory is over.\n");
2093     sleep(3);
2094     Print("But another is started here.\n");
2095     sleep(2);
2096     Show_Stick_Man(3);
2097     Print("Don't you wanna open it, my friend.\n");
2098     Print("This is your last decision.\n'Y': Open it\n'N': No\n");
2099     char opt;
2100     while(cin>>opt){
2101         if(opt=='Y'||'y'){system("start https://www.cnblogs.com/bingoyes/");return;}//It used to be a bug, but the reason is very funny, so I kept it.
2102         if(opt=='N'||'n'){system("start www.4399.com");return;}
2103     }
2104 }
2105 #define Start_New_Chapter() Pause(),system("cls"),system("color 31")
2106 Iv Readme(){
2107     system("color 0E");
2108     Print("Read me:\n"),sleep(2);
2109     Print("This game is created based on Dicken's Great Expectations.\n");
2110     Print("To colorful the contents, I add other elements inside.\n");
2111     Print("It's quite simple, but it really costs me two weeks.\n");
2112     Print("Before doing it,\nI didn't know how to set color, print words slowly, even use Class...\n");
2113     Print("But I stuck on, and I did it.\n");
2114     Print("I learned a lot, not only programming...\n");
2115     Print("I decide to share it with you, it's my honor if you like it.\n");
2116     Print("But at first, I need to say thanks to websites or blogs below.\n");
2117     Print("Without the knowledge from them, I could do nothing.\n");
2118     Print("\n\thttps://blog.csdn.net/jackypigpig/article/details/53368531\n");
2119     Print("\thttps://www.luogu.org/discuss/show/30357\n");
2120     Print("\thttps://blog.csdn.net/charactr/article/details/78817779\n");
2121     Print("\thttp://tieba.baidu.com/p/4297649534\n");
2122     Print("\thttps://www.cnblogs.com/bingoyes/\n");
2123     Print("\n\tAnd others which I cannot remember yet...\n");
2124     system("color 0C");
2125     Print("\n(\nThis game is only for sharing knowledge and programing skill.\nSo I used a few codes from the internet.\nIf you are the original author and think your copyright has been infringed.\nConnect me and I'll delete the relevant part in time.\nIf you wanna infringe my copyright for personal interests, we'll meet in court!\n)\n");
2126     system("color 0E");
2127     Print("\nNow let's begin!\n"),sleep(2);
2128     Print("\nGreat Exceptations\n\t\tby Bingoyes\n");
2129 }
2130 int main(){
2131     Readme();
2132     Start_New_Chapter();
2133     Init_Chapter_One();
2134     Chapter_Prologue();
2135     Start_New_Chapter();
2136     Chapter_One.Chapter_One_Main();
2137     Start_New_Chapter();
2138     Chapter_Two.Chapter_Two_Main();
2139     Start_New_Chapter();
2140     Chapter_Three.Chapter_Three_Main(); 
2141     Start_New_Chapter();
2142     Chapter_Four.Chapter_Four_Main(); 
2143     Start_New_Chapter();
2144     Chapter_Five.Chapter_Five_Main();
2145     Start_New_Chapter();
2146     Chapter_Six.Last_Fight();
2147     Introduce_Bingoyes();
2148     return 0;
2149 }
2150 /*
2151     Note:
2152         Describtion:
2153             This text game is created based on Dickens' <<Great Expectations>>.
2154             Character:
2155             
2156             Chapters:
2157                 Name:
2158                     Pip 皮普 又名 Handel 汉德尔 ; 教名菲利普 (Philip)。
2159                     Abel Magwitch 阿伯尔。马格韦契
2160                     Mrs Joe Gargery 乔 。葛吉瑞夫人
2161                     Joe Gargery 乔。葛吉瑞
2162                     Vompeyson 康培生
2163                     Mr Pumblechook 潘波趣先生
2164                     Mr Wopsle 伍甫赛先生
2165                     Biddy 毕蒂
2166                     Miss Havisham 郝薇香小姐
2167                     Estella 艾丝黛拉 ,被郝小姐收养
2168                     Herbert Pocket 郝伯特。朴凯特
2169                     Matthew Pocket 马修。朴凯特
2170                     Orlick 奥立克
2171                     Mr Jaggers 贾格斯 先生
2172                     Mr Wemmick 文米克 先生
2173                     Bentley Drummle 本特利 。朱穆尔
2174                     Startop 史达多蒲
2175                     Miss Skiffins 斯基芬小姐
2176                 
2177         Set Color:
2178             0= black         
2179             1= blue         
2180             2= green         A = light green
2181             3= lake blue     B = light green blue
2182             4= red         C = light red
2183             5= purple         D = lavender
2184             6= yellow         E = light yellow
2185             7= white         F = bright white
2186             8= gray
2187             9= light blue
2188             
2189             SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
2190             
2191             0E-> Black Golden Fairy
2192             31-> Blue Cementry
2193             B7-> Winter Peace
2194             4E-> Real Hell
2195             62-> Cthulu's Meditation
2196             C4-> Bloody Guility
2197             8C-> Bloody Dust
2198 }
2199 */
Great Expectations

 

posted @ 2018-12-30 21:51  邱涵的秘密基地  阅读(343)  评论(0编辑  收藏  举报