当前位置: 代码迷 >> C语言 >> [原创]一个考验你IQ的密码破译游戏,挑战你的逻辑能力
  详细解决方案

[原创]一个考验你IQ的密码破译游戏,挑战你的逻辑能力

热度:231   发布时间:2005-04-12 18:58:00.0
void Select(int i) { switch(i) { case 0:Stage("1",0,"{ipgsqi","22-4-11-2-14-12-4",NULL,0);break; /* 四个参数 stageID(关数),helpID(帮助代号),code(密码),condition(条件或暗示)*/ case 1:Stage("2",-1,"57=85;78954","RJFI:QRRTSMKGNDCG",NULL,0);break; /* -1 数字 0 字母 1 数字+字母 */ case 2:Stage("3",0,"he$zmrgm","WZ ERMXR",NULL,0);break; case 3:Stage("4",0,"]yrQmrk","3111556","http://shada.w11.51web.cn/bbs/dispbbs.asp?boardID=18&ID=5646",0);break; case 4:Stage("5",0,"HMJSLXYTSJ","112,110,100,99 100 116,120 22 115,111,118",NULL,1);break; case 5:Stage("6",0,"glirkwxsri","DIFOHTUPOF",NULL,0);break; case 6:Stage("7",-1,"87778;4<","69-68-68-68-69-72-65-73",NULL,0);break; case 7:Stage("8",0,"gsrkvexypexmsrw","ann,a tutor's logic",NULL,0);break; case 8:Congratulation();break; /*这里用樱花大战的音乐 开头是麻利医生的音乐 */ } } void Escape() { int key,n=0; KillTimer(); settextstyle(0,0,3); if(codeshow)CodeCut(); setfillstyle(1,BLUE); bar(150,280,500,380); setcolor(RED); rectangle(150,280,500,380); setcolor(YELLOW); outtextxy(170,300,"GO> Save Game"); outtextxy(170,350," Exit Game"); while((key=bioskey(0))!=ENTER) { switch(key) { case UP:if(n) { n=0; bar(170,350,240,370); outtextxy(170,300,"GO>"); SoundKey(); } else SoundErr(); break; case DOWN:if(!n) { n=1; bar(170,300,240,320); outtextxy(170,350,"GO>"); SoundKey(); } else SoundErr(); break; case ESC:CodeCut(); settextstyle(0,0,1); setfillstyle(0,0);goto jump;break; default:SoundErr();break; } } settextstyle(0,0,1); setfillstyle(0,0); if(n)sign=0; else { n=Save(); bar(150,280,500,380); setcolor(RED); rectangle(240,280,320,330); setcolor(YELLOW); if(n)outtextxy(250,300,"SAVE OK"); else outtextxy(250,300,"SAVE FAIL"); delay(60000); bar(150,280,500,380); } jump: SetTimer(NewTimer); } void Display() { float str[47][2]={{0,0},{HA,60000},{HA,60000},{HA,60000}, {HB,60000},{C,30000},{D,30000},{D,30000},{D,30000}, {D,30000},{D,30000},{C,15000},{C,15000},{C,60000}, {D,15000},{E,15000},{D,60000},{E,30000},{HA,30000}, {HG,30000},{HE,30000},{HD,30000},{HE,30000},{HE,15000}, {HE,30000},{HE,60000},{HE,60000},{HG,30000},{HF,30000}, {HG,60000},{C,30000},{HA,30000},{HA,15000},{HA,30000}, {HA,60000},{HA,60000},{HE,30000},{HG,30000},{HA,15000}, {HB,15000},{C,30000},{C,60000},{C,60000},{HB,30000}, {C,30000},{HE,15000},{HE,30000}}; int i,m=46; cleardevice(); setcolor(RED); settextstyle(0,0,8); outtextxy(80,60,"CRACK"); outtextxy(350,180,"GAME"); setcolor(WHITE); settextstyle(0,0,1); outtextxy(70,340,"Tel:13941734510"); outtextxy(220,340,"E-mail:chengstone@21cn.com"); outtextxy(460,340,"QQ:43334708"); randomize(); while(!bioskey(1)) { setcolor(rand()%15+1); outtextxy(280,280,"Enter"); sound(str[m][0]);delay(str[m--][1]);nosound(); if(!m)m=46; setcolor(0); for(i=0;i<10;i++)line(300,240+i,340,240+i); sound(str[m][0]);delay(str[m--][1]);nosound(); if(!m)m=46; } getch(); } void Start() { int key=-1,n; cleardevice(); setcolor(6); settextstyle(0,0,2); outtextxy(170,130,"GO> New Game"); outtextxy(170,175," Load Game"); outtextxy(170,225," Exit Game"); setfillstyle(0,0); while((n=bioskey(0))!=ENTER) { switch(n) { case UP:if(key>-1) { if(key) { bar(170,225,170+50,250+20); outtextxy(170,175,"GO>"); } else { bar(170,175,170+50,175+20); outtextxy(170,130,"GO>"); } key--; SoundKey(); } else SoundErr(); break; case DOWN:if(key<1) { if(key) { bar(170,130,170+50,130+20); outtextxy(170,175,"GO>"); } else { bar(170,175,170+50,175+20); outtextxy(170,225,"GO>"); } key++; SoundKey(); } else SoundErr(); break; case ESC:if(key<1) { if(key)bar(170,130,170+50,130+20); else bar(170,175,170+50,175+20); outtextxy(170,225,"GO>"); key=1; SoundKey(); } else SoundErr(); break; default:SoundErr();break; } } settextstyle(0,0,1); if(key==1)sign=-1; else if(key==0)Load(); } Stage(char *stageID,int helpID,char *code,char *condition,char *other,int end) { int time=60,x=110,y=220,i=0,ON=0; char buff[16]={0},word[2]; word[1]='\0'; TimerCounter=0; cleardevice(); PutStage(stageID); setcolor(YELLOW); settextstyle(0,0,1); if(!end)outtextxy(230,150,condition); else outtextxy(150,150,condition); setcolor(RED); outtextxy(250,210,"Password:"); rectangle(195,200,390,250); translate(code); TimeGraph(); SetTimer(NewTimer); while(time&&!ON&&sign) { if(TimerCounter>18) { time-=1; TimerCounter=0; CutTime(x); x+=7; _SoundTime(); } if(kbhit()) { accept.x=bioskey(0); if(!tab)Enqueue(accept.x); if(accept.x==F1||accept.x==UP||accept.x==DOWN||accept.x==TAB||accept.x==ESC||accept.x==ENTER||accept.x==LEFT||accept.x==RIGHT) { switch(accept.x) { case F1:Help(helpID);break; case DOWN:if(!tab)Compare();break; case TAB:if(tab&&!codeshow)CodeGraph(); else if(codeshow)CodeCut(); break; case ESC:Escape();break; case ENTER:buff[i]='\0'; if(strcmp(code,buff)==0)ON=1; else { i=0; buff[i]='\0'; y=220; DelCode(); } break; } } else { if(accept.h==BS) { if(i>0) /*if(y>130)*/ { y-=10; Eraser(y); buff[--i]='\0'; } } else if(i<15) { setcolor(RED); word[0]=accept.h; buff[i++]=accept.h; outtextxy(y,230,word); y+=10; } } } if(time<11) if(TimerCounter%18==0)SoundTime(); } KillTimer(); if(ON)NextStage(other); else sign=0; } int randto(int m,int n) { return rand()%n+m; } void GameOver() { register i,j; int osize,size,x,y; void *buffer,*buff; setcolor(15); randomize(); for(x=1;x<6-2;x++) { line(0,240,x,240); delay(2000); if(x==5-2)for(y=1;y<6-2;y++) { line(0,239,y,239); line(0,241,y,241); line(0,240,x+y,240); delay(2000); if(y==5-2)for(i=1;i<=640;i++) { line(0,238,i,238); line(0,242,i,242); line(0,239,y+i,239); line(0,241,y+i,241); line(0,240,x+y+i,240); delay(2000); } } } setcolor(BLACK); line(0,240,640,240); delay(2000); x=240; for(y=0;y<50-30;y++) { putpixel(rand()%640,240,randto(1,15)); } for(i=1,j=3;i<=110;i++,j++) { setcolor(7); line(0,x-i,640,x-i); line(0,x+i,640,x+i); delay(2000); setcolor(WHITE); line(0,x-j,640,x-j); line(0,x+j,640,x+j); delay(2000); setcolor(BLACK); line(0,x-i,640,x-i); line(0,x+i,640,x+i); for(y=0;y<50-30;y++) { putpixel(rand()%640,x-i,randto(1,15)); putpixel(rand()%640,x+i,randto(1,15)); } delay(2000); } setcolor(11); settextstyle(0,0,8); size=imagesize(32,150,383,205); buffer=malloc(size); osize=imagesize(250,270,598,325); buff=malloc(osize); getimage(32,150,383,205,buffer); getimage(250,270,598,325,buff); outtextxy(35,150,"GAME"); outtextxy(350,270,"OVER"); putimage(32,150,buffer,COPY_PUT); putimage(250,270,buff,COPY_PUT); for(i=1;i<=140;i+=5) { putimage(32,150,buffer,COPY_PUT); if(i<=120)putimage(250,270,buff,COPY_PUT); outtextxy(35+i,150,"GAME"); if(i<=120)outtextxy(350-i,270,"OVER"); } getch(); } void ExitGame() { cleardevice(); setbkcolor(BLACK); setcolor(WHITE); outtextxy(180,200,"Thank you for your playing"); sleep(1); outtextxy(240,250,"Good luck!"); sleep(1); closegraph(); } void main() { Init(); begin: InitType(); Display(); Start(); while(sign==1)Select(j); if(sign)ExitGame(); else { GameOver(); goto begin; } }
----------------解决方案--------------------------------------------------------
既然楼主已经把源码公开了,那么我觉得把我如何知道你很喜欢董洁告诉你了。
其实很简单,你的程序把密码,题目以及最后给出的地址都直接写在了程序里。那么这些数据作为字符串会完整地保存在程序文件末尾附近的代码段,直接用文本编辑器打开你的程序找到可以阅读的部分就猜出是过关密码了:)
----------------解决方案--------------------------------------------------------
怎么用不了,双击出现一个窗口一闪就没了什么也没有
----------------解决方案--------------------------------------------------------
我的情况也是这样,不是木马吧
----------------解决方案--------------------------------------------------------
汗~~  这个在我看到你第一个回复的时候已经猜到了 所以我在原代码中改了一下子 不过仔细看过代码之后还是会知道密码是什么地
----------------解决方案--------------------------------------------------------
w什么来的呀,一点都看不懂呀
----------------解决方案--------------------------------------------------------
我也是这样,一闪而过,什么都没有。
----------------解决方案--------------------------------------------------------
好象your源码有点点问题
----------------解决方案--------------------------------------------------------
真是牛人呀!喜欢收藏了!
----------------解决方案--------------------------------------------------------
为什么读取输入速度很慢

[此贴子已经被作者于2005-5-25 11:25:03编辑过]



----------------解决方案--------------------------------------------------------
  相关解决方案