//悔棋
publicvoidgoback(){
if(chessCount==0)//判断剩余棋子数
return;
chessList[chessCount-1]=null;//chessList是棋子数组
chessCount--;
if(chessCount>0){
xIndex=chessList[chessCount-1].getX();//xIndex,yIndex当前刚下棋子的索引
yIndex=chessList[chessCount-1].getY();
}
isBlack=!isBlack;
repaint();
}