// 悔棋
public void goback() {
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();
}
你的代码呢