2个好玩的东东(其中一个NI 玩的来吗)
第一个这是黑客游戏。不过我只会第一关:第2关用telnet 输入密码输不进出。
不知道是他程序没有写好 还是怎么回事。
第二个是OU写的迷宫算法。。貌似没有问题!但应该只能在我这个地图用吧!!
用这个测试你电脑的速度。。。是一个不错想法啊!经过我的测试 我电脑可以扔了。。

程序代码:///第一种情况
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "windows.h"
int mazeGenerator(char str[][12],int x,int y)
{int j;
int temp;
static int oldDir=4;
int n,i,k=0;
if(x<0||y<0||x>11||y>11)
return 0;
if(str[y][x]==1)
return 0;
if(x==0)
if(str[y][x]==0)
{puts("GAME WIN");
getchar();
exit(1);
}
str[y][x]=3;
for(n=0;n<12;n++)
for(i=0;i<12;i++)
{++k;
if(str[n][i]==1)
printf(" # ");
else
if(str[n][i]==0)
printf(" . ");
else
printf(" x ");
if(k==12)
{printf("\n");
k=0;
}
}
Sleep(1000);
for(j=0;j<4;j++)
switch(j)
{case 0:
if(oldDir!=3)
{temp=oldDir;
oldDir=0;
str[y][x]=0;
mazeGenerator(str,x-1,y);
oldDir=temp;
}
case 1:
if(oldDir!=2)
{temp=oldDir;
oldDir=1;
str[y][x]=0;
mazeGenerator(str,x,y-1);
oldDir=temp;
}
case 2:
if(oldDir!=1)
{temp=oldDir;
oldDir=2;
str[y][x]=0;
mazeGenerator(str,x,y+1);
oldDir=temp;
}
case 3:
if(oldDir!=0)
{temp=oldDir;
oldDir=3;
str[y][x]=0;
mazeGenerator(str,x+1,y);
oldDir=temp;
}
break;
}
return 0;
}
void main()
{char map[12][12]={
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,0,0,0,0,0,0,1},
{0,0,1,0,1,0,1,1,1,1,0,1},
{1,1,1,0,1,0,0,0,0,1,1,1},
{1,0,0,0,0,1,1,1,0,1,0,0},
{1,1,1,1,0,1,0,1,0,0,0,1},
{1,0,0,1,0,1,0,1,0,1,0,1},
{1,1,0,1,0,1,0,1,0,1,0,1},
{1,0,0,0,0,0,0,0,0,1,0,1},
{1,1,1,1,1,1,0,1,1,1,0,1},
{1,0,0,0,0,0,0,1,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}};
mazeGenerator(map,11,4);
}////第二种,这种会答案吗!!!!!估计微型机够呛啊
/* Note:Your choice is C IDE */
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "windows.h"
int mazeGenerator(char str[][12],int x,int y)
{int j;
int temp;
static int oldDir=4;
int n,i,k=0;
if(x<0||y<0||x>11||y>11)
return 0;
if(str[y][x]==1)
return 0;
if(x==0)
if(str[y][x]==0)
{puts("GAME WIN");
getchar();
exit(1);
}
str[y][x]=3;
for(n=0;n<12;n++)
for(i=0;i<12;i++)
{++k;
if(str[n][i]==1)
printf(" # ");
else
if(str[n][i]==0)
printf(" . ");
else
printf(" x ");
if(k==12)
{printf("\n");
k=0;
}
}
Sleep(1000);
for(j=0;j<4;j++)
switch(j)
{case 0:
if(oldDir!=3)
{temp=oldDir;
oldDir=0;
str[y][x]=0;
mazeGenerator(str,x-1,y);
oldDir=temp;
}
case 1:
if(oldDir!=2)
{temp=oldDir;
oldDir=1;
str[y][x]=0;
mazeGenerator(str,x,y-1);
oldDir=temp;
}
case 2:
if(oldDir!=1)
{temp=oldDir;
oldDir=2;
str[y][x]=0;
mazeGenerator(str,x,y+1);
oldDir=temp;
}
case 3:
if(oldDir!=0)
{temp=oldDir;
oldDir=3;
str[y][x]=0;
mazeGenerator(str,x+1,y);
oldDir=temp;
}
break;
}
return 0;
}
void main()
{char map[12][12]={
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,0,0,0,0,0,0,1},
{0,0,1,0,1,0,1,1,1,1,0,1},
{1,1,1,0,1,0,0,0,0,1,1,1},
{1,0,0,0,0,1,1,1,0,1,0,0},
{1,1,1,1,0,1,0,1,0,0,0,1},
{1,0,0,1,0,1,0,1,0,1,0,1},
{1,1,0,1,0,1,0,1,0,1,0,1},
{1,0,0,0,0,0,0,0,0,1,0,1},
{1,1,1,1,1,1,0,1,1,1,0,1},
{1,0,0,0,0,0,0,1,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}};
mazeGenerator(map,11,4);
}/* 3中 这个可以测试一下你的电脑是多久出来 我的不好意思说8分钟啊*/
#include "stdio.h"
#include "stdlib.h"
#include "conio.h"
#include "windows.h"
int mazeGenerator(char str[][12],int x,int y)
{int j;
int temp;
static int oldDir=4;
int n,i,k=0;
if(x<0||y<0||x>11||y>11)
return 0;
if(str[y][x]==1)
return 0;
if(x==0)
if(str[y][x]==0)
{puts("GAME WIN");
getchar();
exit(1);
}
str[y][x]=3;
for(n=0;n<12;n++)
for(i=0;i<12;i++)
{++k;
if(str[n][i]==1)
printf(" # ");
else
if(str[n][i]==0)
printf(" . ");
else
printf(" x ");
if(k==12)
{printf("\n");
k=0;
}
}
for(j=0;j<4;j++)
switch(j)
{case 0:
if(oldDir!=3)
{temp=oldDir;
oldDir=0;
str[y][x]=0;
mazeGenerator(str,x-1,y);
oldDir=temp;
}
case 1:
if(oldDir!=2)
{temp=oldDir;
oldDir=1;
str[y][x]=0;
mazeGenerator(str,x,y-1);
oldDir=temp;
}
case 2:
if(oldDir!=1)
{temp=oldDir;
oldDir=2;
str[y][x]=0;
mazeGenerator(str,x,y+1);
oldDir=temp;
}
case 3:
if(oldDir!=0)
{temp=oldDir;
oldDir=3;
str[y][x]=0;
mazeGenerator(str,x+1,y);
oldDir=temp;
}
break;
}
return 0;
}
void main()
{char map[12][12]={
{1,1,1,1,1,1,1,1,1,1,1,1},
{1,0,0,0,1,0,0,0,0,0,0,1},
{0,0,1,0,1,1,1,1,1,1,0,1},
{1,1,1,0,1,0,0,0,0,1,1,1},
{1,0,0,0,0,1,1,1,0,1,0,0},
{1,1,1,1,0,1,0,1,0,0,0,1},
{1,0,0,1,0,1,0,1,0,1,0,1},
{1,1,0,1,0,1,0,1,0,1,0,1},
{1,0,0,0,0,0,0,0,0,1,0,1},
{1,1,1,1,1,1,0,1,1,1,0,1},
{1,0,0,0,0,0,0,1,0,0,0,1},
{1,1,1,1,1,1,1,1,1,1,1,1}};
mazeGenerator(map,11,4);
}发发好玩!被高手打击了!!要安心的修炼内功了!!!!谁给递归的好方法!我这个太寒碜了啊!!!那个黑客游戏 谁玩通过关了 给个教程啊!!细细 黑客(不是骇客啊)NIU
[ 本帖最后由 小鱼儿c 于 2011-8-4 21:25 编辑 ]









