java五子棋游戏源代码+流程图+棋盘算法 第5页
String input = JOptionPane.showInputDialog("请输入游戏的最大时间(单位:分钟),如果输入0,表示没有时间限制:");
try {
maxTime = Integer.parseInt(input) * 60;
if (maxTime < 0) {
JOptionPane.showMessageDialog(this, "请输入正确信息,不允许输入负数!");
}
if (maxTime == 0) {
int result = JOptionPane.showConfirmDialog(this,
"设置完成,是否重新开始游戏?");
if (result == 0) {
for (int i = 0; i < 18; i++) {
for (int j = 0; j < 18; j++) {
allChess[i][j] = 0;
}
}
message = "白方先行";isBlack = false;
blackTime = maxTime;whiteTime = maxTime;
blackMessage = "无限制";whiteMessage = "无限制";
blackMessage0= "无限制";whiteMessage0 = "无限制";
t.suspend();this.canPlay = true;this.repaint();
}
}
if (maxTime > 0) {
int result = JOptionPane.showConfirmDialog(this,
"设置完成,是否重新开始游戏?");
if (result == 0) {
for (int i = 0; i < 18; i++) {
for (int j = 0; j < 18; j++) {
allChess[i][j] = 0;
}
}
message = "白方先行";isBlack = false;
blackTime = maxTime;whiteTime = maxTime;
blackMessage = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);
whiteMessage = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);
blackMessage0 = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);
whiteMessage0 = maxTime / 3600 + ":"+ (maxTime / 60 - maxTime / 3600 * 60) + ":"+ (maxTime - maxTime / 60 * 60);
t.resume();this.canPlay = true;this.repaint();
}
}
} catch (NumberFormatException e1) {
JOptionPane.showMessageDialog(this, "请正确输入信息!");
}
}
if (e.getX() >= 656 && e.getX() <= 697 && e.getY() >= 644
&& e.getY() <= 661) {
JOptionPane.showMessageDialog(this,
"这个一个五子棋游戏程序,黑白双方轮流下棋,当某一方连到五子时,则该方获胜,同时游戏结束。");
}
if (e.getX() >= 辣~文-论'文:网
http://www.751com.cn {
JOptionPane.showMessageDialog(this,"游戏开始时,根据上方提示信息,用鼠标点击棋盘黑白双方轮流下子");
}
if (e.getX() >= 546 && e.getX() <= 592 && e.getY() >= 662&& e.getY() <= 678) {int result = JOptionPane.showConfirmDialog(this, "是否确认认输?");
if (result == 0) {if (isBlack) {message ="黑方认输,白方获胜!!!";this.repaint();JOptionPane.showMessageDialog(this, "黑方已经认输,游戏结束!");
} else {
message="白方认输,黑方获胜!!!";
this.repaint();
JOptionPane.showMessageDialog(this, "白方已经认输,游戏结束!");
}
canPlay = false;
}
}
if (e.getX() >= 420 && e.getX() <= 457 && e.getY() >= 663
&& e.getY() <= 683) {
JOptionPane.showMessageDialog(this,
"本程序来源蝈蝈基地,创作人:郭贵扬(郭帼)");
上一页 [1] [2] [3] [4] [5]
java五子棋游戏源代码+流程图+棋盘算法 第5页下载如图片无法显示或论文不完整,请联系qq752018766