| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6024 人关注过本帖
标题:用neo写的中国象棋社0.0.5,120%原创,提供代码
只看楼主 加入收藏
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 

yahoo邮箱有20M附件的限制,我这边的速度也不好,你可以到网上找找

2006-10-14 12:59
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
哦,原来里面有源码,先没注意到~~
2006-10-14 14:23
jig
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
帖 子:530
专家分:242
注 册:2005-12-27
收藏
得分:0 
楼主直接去云风的网站上DOWN吧

http://www.codingnow.com/2000/index.html

对了,楼主,其智能算发是你原创的,还是看书借鉴过来的?若算法也是你个人原创的那楼主是前途无量啊

[此贴子已经被作者于2006-10-14 19:44:18编辑过]


个人网站 -  http://.h001.
2006-10-14 16:39
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 
哈哈,谢谢大家的鼓励与支持,真的很感谢,10.21我要去参加noip(全国信息技术奥赛),最近较忙,还有就是偶的成绩并非你们大家想象中的那样,我是我们学校的级部第一.有关于人工智能这里要说,我对人工智能 并非 很了解,最近看一些英文的文章让我眼花缭乱,只学会了刚Alpha-Beta 静态搜索 期望窗口 等一基本的,而且在0.0.5中只用了A-B搜索,在0.0.6中我已实现了期望窗口,待我奥赛完后,有时间的话我将静态搜索加上后发到网上,我最近大都在 大榕树 (一个全国中学生奥赛的论坛 www.mydrs.org),在申请斑竹中,帐号是 我爱C,另外大家也可到我的论坛去找我.

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-10-14 19:50
jig
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
帖 子:530
专家分:242
注 册:2005-12-27
收藏
得分:0 
董啊,碰到个比你天分还高的,哈哈哈哈

个人网站 -  http://.h001.
2006-10-14 19:52
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 

附:新代码部分一(首发):
/*===================================================================================*/

/*判断 BLACKorRED 方的棋子是否能走到chess[x][y],返回可以移动到的个数*/

/*BLACKorRED=0 则是黑方,BLACKorRED=1则是红方*/

int canmoveto(char x,char y,char BLACKorRED) {

int i,t[4]; /*临时数据*/
char pd=0; /*临时判断比较*/

char canmoveall=0; /*可移动到的个数*/

if(chess[x][y]>7)
pd=1;
if(BLACKorRED==pd && chess[x][y]==chessnum[BLACKorRED][4])
return 0;

/* t 数组预先计算,提高执行效率*/
t[0]=x+1;
t[1]=x-1;
t[2]=y+1;
t[3]=y-1;

if(BLACKorRED) {
/*帅*/
if(x>6 && x<10 && y>2 && y<6) {
if(x!=9)
if(chess[t[0]][y]==chessnum[BLACKorRED][4])
canmoveall++;
if(x!=7)
if(chess[t[1]][y]==chessnum[BLACKorRED][4])
canmoveall++;
if(y!=3)
if(chess[x][t[3]]==chessnum[BLACKorRED][4])
canmoveall++;
if(y!=5)
if(chess[x][t[2]]==chessnum[BLACKorRED][4])
canmoveall++;
}
/*仕*/
if(((x==7 || x==9) && ( y==3 || y==5)) || (x==8 && y==4) ) {
if(x==8 && y==4) {
if(chess[t[0]][t[2]]==chessnum[BLACKorRED][3] || chess[t[0]][t[3]]==chessnum[BLACKorRED][3] || chess[t[1]][t[2]]==chessnum[BLACKorRED][3] || chess[t[1]][t[3]]==chessnum[BLACKorRED][3] )
canmoveall++;
}
else
if(chess[8][4]==chessnum[BLACKorRED][3])
canmoveall++;
}
/*相*/
if((y==0 || y==4) && x==7) {
if(chess[t[0]][t[2]]==0) {
if(chess[x+2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[1]][t[2]]==0) {
if(chess[x-2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==4 || y==8) && x==7) {
if(chess[t[1]][t[3]]==0) {
if(chess[x-2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[0]][t[3]]==0) {
if(chess[x+2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==2 || y==6) && x==5) {
if(chess[t[0]][t[2]]==0) {
if(chess[x+2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[0]][t[3]]==0) {
if(chess[x+2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==4 || y==8) && x==9) {
if(chess[t[1]][t[3]]==0) {
if(chess[x-2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[1]][t[2]]==0) {
if(chess[x-2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
/*兵*/
if(chess[t[0]][y]==chessnum[BLACKorRED][6])
canmoveall++;
if(x<5 && y!=0)
if(chess[x][t[3]]==chessnum[BLACKorRED][6])
canmoveall++;
if(x<5 && y!=8)
if(chess[x][t[2]]==chessnum[BLACKorRED][6])
canmoveall++;
}
else {
/*将*/
if(x>-1 && x<3 && y>2 && y<6) {
if(x!=2)
if(chess[t[0]][y]==chessnum[BLACKorRED][4])
canmoveall++;
if(x!=0)
if(chess[t[1]][y]==chessnum[BLACKorRED][4])
canmoveall++;
if(y!=3)
if(chess[x][t[3]]==chessnum[BLACKorRED][4])
canmoveall++;
if(y!=5)
if(chess[x][t[2]]==chessnum[BLACKorRED][4])
canmoveall++;
}
/*士*/
if(((x==0 || x==2) && ( y==3 || y==5)) || (x==1 && y==4) ) {
if(x==1 && y==4) {
if(chess[t[0]][t[2]]==chessnum[BLACKorRED][3] || chess[t[0]][t[3]]==chessnum[BLACKorRED][3] || chess[t[1]][t[2]]==chessnum[BLACKorRED][3] || chess[t[1]][t[3]]==chessnum[BLACKorRED][3] )
canmoveall++;
}
else
if(chess[1][4]==chessnum[BLACKorRED][3])
canmoveall++;
}
/*象*/
if((y==0 || y==4) && x==2) {
if(chess[t[0]][t[2]]==0) {
if(chess[x+2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[1]][t[2]]==0) {
if(chess[x-2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==4 || y==8) && x==2) {
if(chess[t[1]][t[3]]==0) {
if(chess[x-2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[0]][t[3]]==0) {
if(chess[x+2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==2 || y==6) && x==0) {
if(chess[t[0]][t[2]]==0) {
if(chess[x+2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[0]][t[3]]==0) {
if(chess[x+2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
if((y==4 || y==8) && x==4) {
if(chess[t[1]][t[3]]==0) {
if(chess[x-2][y-2]==chessnum[BLACKorRED][2])
canmoveall++;
}
if(chess[t[1]][t[2]]==0) {
if(chess[x-2][y+2]==chessnum[BLACKorRED][2])
canmoveall++;
}
}
/*卒*/
if(chess[t[1]][y]==chessnum[BLACKorRED][6])
canmoveall++;
if(x>4 && y!=0)
if(chess[x][t[3]]==chessnum[BLACKorRED][6])
canmoveall++;
if(x>4 && y!=8)
if(chess[x][t[2]]==chessnum[BLACKorRED][6])
canmoveall++;
}

/*俥\車/砲\炮*/
for(pd=0,i=t[0];i<10;i++) {
if(chess[i][y]==0)
continue;
if(!pd && chess[i][y]==chessnum[BLACKorRED][0])
canmoveall++;
else
if(pd==1 && chess[i][y]==chessnum[BLACKorRED][5])
canmoveall++;
else
pd++;
if(pd>1)
break;
continue;
}
for(pd=0,i=t[1];i>-1;i--) {
if(chess[i][y]==0)
continue;
if(!pd && chess[i][y]==chessnum[BLACKorRED][0])
canmoveall++;
else
if(pd==1 && chess[i][y]==chessnum[BLACKorRED][5])
canmoveall++;
else
pd++;
if(pd>1)
break;
continue;
}
for(pd=0,i=t[2];i<9 ;i++) {
if(chess[x][i]==0)
continue;
if(!pd && chess[x][i]==chessnum[BLACKorRED][0])
canmoveall++;
else
if(pd==1 && chess[x][i]==chessnum[BLACKorRED][5])
canmoveall++;
else
pd++;
if(pd>1)
break;
continue;
}
for(pd=0,i=t[3];i>-1;i--) {
if(chess[x][i]==0)
continue;
if(!pd && chess[x][i]==chessnum[BLACKorRED][0])
canmoveall++;
else
if(pd==1 && chess[x][i]==chessnum[BLACKorRED][5])
canmoveall++;
else
pd++;
if(pd>1)
break;
continue;
}
/*傌\馬*/
if(x>1 && y<8)
if(chess[t[1]][t[2]]==0)
if(chess[x-2][t[2]]==chessnum[BLACKorRED][1])
canmoveall++;
if(x>0 && y<7)
if(chess[t[1]][t[2]]==0)
if(chess[t[1]][y+2]==chessnum[BLACKorRED][1])
canmoveall++;
if(x>1 && y>0)
if(chess[t[1]][t[3]]==0)
if(chess[x-2][t[3]]==chessnum[BLACKorRED][1])
canmoveall++;
if(x>0 && y>1)
if(chess[t[1]][t[3]]==0)
if(chess[t[1]][y-2]==chessnum[BLACKorRED][1])
canmoveall++;
if(x<8 && y<8)
if(chess[t[0]][t[2]]==0)
if(chess[x+2][t[2]]==chessnum[BLACKorRED][1])
canmoveall++;
if(x<9 && y<7)
if(chess[t[0]][t[2]]==0)
if(chess[t[0]][y+2]==chessnum[BLACKorRED][1])
canmoveall++;
if(x<8 && y>0)
if(chess[t[0]][t[3]]==0)
if(chess[x+2][t[3]]==chessnum[BLACKorRED][1])
canmoveall++;
if(x<9 && y>1)
if(chess[t[0]][t[3]]==0)
if(chess[t[0]][y-2]==chessnum[BLACKorRED][1])
canmoveall++;

return canmoveall;
}

/*===================================================================================*/


My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-10-14 19:54
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 

附:新代码二(首发):
/*空着剪裁
wherecanmoveto(!BLACKorRED,depth-R);

v=-Ponder_AlphaBeta(-beta,-beta+1,depth-1-R,BLACKorRED);
if (v>=beta)
return beta;
默认关闭,使用时去掉注释*/


My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-10-14 19:55
卧龙孔明
Rank: 9Rank: 9Rank: 9
等 级:贵宾
威 望:59
帖 子:3872
专家分:684
注 册:2006-10-13
收藏
得分:0 
将下载放改到了站内

My Blog: www.aiexp.info
虽然我的路是从这里开始的,但是这里不再是乐土.感谢曾经影响过,引导过,帮助过我的董凯,飞燕,leeco,starwing,Rockcarry,soft_wind等等等等.别了,BCCN.
2006-10-15 17:58
RockCarry
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:13
帖 子:662
专家分:58
注 册:2005-8-5
收藏
得分:0 

能够运用人工智能中的一些知识,比如最基本的知识表示技术、搜索技术、博弈问题、博弈树的搜索,以及最关键的Alpha-Beta剪枝技术,来解决一个比较复杂的象棋博弈问题已经非常难得。能开心的做自己喜欢的事情真是幸福。
人工智能在大学的计算机专业中是一门必修课程,在初中就能有所理解真是难得,另外一门课程是机器学习,讨论的问题相对的更加深入,有兴趣可以看看。
真是佩服。

2006-10-15 20:56
ljhzz
Rank: 1
等 级:新手上路
帖 子:19
专家分:0
注 册:2006-10-13
收藏
得分:0 
卧龙孔明
你QQ号码是..
加我.
教下我啊..
我C语言差
2006-10-15 22:08
快速回复:用neo写的中国象棋社0.0.5,120%原创,提供代码
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017146 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved