.color=color;
msg.coordinateX=x;
msg.coordinateY=y;
msg.type=2;
//第 4 页
//向服务器发送Message类中封装的信息
try{
ChessWZQ.out.writeObject(msg);
}
catch (IOException ee){
ee.printStackTrace();
}
}
char cc=(char)(x+65);
ChessWZQ.label6.setText("put on("+cc+","+(y+1)+")");
//轮到
计算机根据算法计算应对的落子位置
if(ChessWZQ.ptocFlag==true){
if(judge(xp/30,yp/30,color)==true){
Message ms=new Message();
ms.type=20;
strToCharArray("You",ms.msg);
try{
ChessWZQ.out.writeObject(ms);
}catch(IOException er){
er.printStackTrace();
}
}
ChessWZQ.beginFlag=false;
int position=0,bestX=0,bestY=0;
Analyse aa=new Analyse(BoardPanel.board);
position=aaputerDo();
bestY=position%100-1;
bestX=position/100-1;
updateBoard(bestX,bestY);
drawChess(bestX,bestY);
Chess
WZQ.beginFlag=true;//设置轮到玩家落子的标志位
cc=(char)(bestX+65);
ChessWZQ.label6.setText("put on ("+cc+","+(bestY+1)+")");
if(judge(bestX,bestY,ChessWZQ.cColor)==true){
Message msg=new Message();
msg.type=20;
strToCharArray("Computer",msg.msg);
try{
ChessWZQ.out.writeObject(msg);
}catch(IOException err){
err.printStackTrace();
}
}
}
}
}
//工具函数,用来将字符串转换成字符数组
public void strToCharArray(String str,char [] arr){
int i;
//第 5 页
for(i=0;i
arr[i]=str.charAt(i);
}
arr[i]='\0';
}
/**