yahoo邮箱有20M附件的限制,我这边的速度也不好,你可以到网上找找
yahoo邮箱有20M附件的限制,我这边的速度也不好,你可以到网上找找
[此贴子已经被作者于2006-10-14 19:44:18编辑过]


.有关于人工智能这里要说,我对人工智能 并非 很了解,最近看一些英文的文章让我眼花缭乱,只学会了刚Alpha-Beta 静态搜索 期望窗口 等一基本的,而且在0.0.5中只用了A-B搜索,在0.0.6中我已实现了期望窗口,待我奥赛完后,有时间的话我将静态搜索加上后发到网上,我最近大都在 大榕树 (一个全国中学生奥赛的论坛 www.mydrs.org),在申请斑竹中,帐号是 我爱C,另外大家也可到我的论坛去找我.										
					
	
附:新代码部分一(首发):
/*===================================================================================*/
/*判断 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;
}
/*===================================================================================*/
