五子棋程序源码 加 报告
五子棋程序源码 加 报告
五子棋程序源码 加 报告
代码片段和文件信息
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 236 2008-06-27 23:08 fivegame.classpath
文件 384 2008-06-27 23:08 fivegame.project
文件 8020 2008-06-29 23:20 fivegameclassesdaoBattel.class
文件 699 2008-06-29 08:54 fivegameclassesdaopopinfPopInf.class
文件 1801 2008-06-30 00:26 fivegameclassesdilogSysDilog$1.class
文件 810 2008-06-30 00:26 fivegameclassesdilogSysDilog$2.class
文件 782 2008-06-30 00:26 fivegameclassesdilogSysDilog$3.class
文件 5359 2008-06-30 00:26 fivegameclassesdilogSysDilog.class
文件 446 2008-06-29 08:54 fivegameclassesinisetfinalsSetDatas.class
文件 3649 2008-06-29 22:17 fivegameclassesinisetPropertySet.class
文件 695 2008-06-30 02:13 fivegameclassesviewCreatWindow$1.class
文件 1129 2008-06-30 02:13 fivegameclassesviewCreatWindow$2.class
文件 941 2008-06-30 02:13 fivegameclassesviewCreatWindow$3.class
文件 4461 2008-06-30 02:13 fivegameclassesviewCreatWindow$4.class
文件 4178 2008-06-30 02:13 fivegameclassesviewCreatWindow$5.class
文件 7179 2008-06-30 02:13 fivegameclassesviewCreatWindow.class
文件 1330 2008-06-29 08:54 fivegameclassesvoChessPoint.class
文件 1898 2008-06-30 02:14 fivegameclassesvoCursorsAndImg.class
文件 1056 2008-06-29 08:54 fivegameclassesvoEnums$chessState.class
文件 315 2008-06-29 08:54 fivegameclassesvoEnums.class
文件 3384 2008-06-30 00:18 fivegameclassesvosoundsMusic.class
文件 2746 2008-06-29 23:10 fivegameclassesvosoundsSound.class
文件 112 2008-06-30 02:19 fivegamefive.property
文件 1465 2008-06-30 01:27 fivegamehelp.property
文件 3092 2008-04-25 10:40 fivegameiconask.png
文件 168278 2008-05-10 09:03 fivegameiconack.gif
文件 1235 2008-05-10 09:16 fivegameiconlack.gif
文件 23151 2008-05-10 16:27 fivegameiconoot.gif
文件 341 2008-06-13 21:14 fivegameiconcancel.gif
文件 145 2008-05-10 14:07 fivegameiconcannot.gif
............此处省略53个文件信息
package dao;
import iniset.PropertySet;
import iniset.finals.SetDatas;
import java.awt.Cursor;
import java.awt.GridLayout;
import java.awt.Point;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.linkedList;
import javax.swing.JLabel;
import dao.popinf.PopInf;
import view.CreatWindow;
import vo.ChessPoint;
import vo.CursorsAndImg;
import vo.Enums;
import vo.sounds.Sound;
/**
* 棋盘类,继承自JLabel实现MouseListener接口是本游戏的核心部分,负责事件处理 判断
*
* @author B.Lee
* @version 2008.05.10
*/
public class Battel extends JLabel implements MouseListener {
public int dirBeginX[];
public int dirBeginY[];
public int lineBeginX[];
public int lineBeginY[];
public int offsetX[];
public int offsetY[];
public int scoreBlack[] = { 0 10 50 500 10000 };
public int scoreWhite[] = { 0 10 50 500 10000 };
private int i0 j0;
private PropertySet propertySet = null;
CreatWindow creatWindow = null;
/**
* 用于存放悔棋路径
*/
public linkedList path = new linkedList();
/**
* 是否已经分出胜负的变量
*/
boolean end;
/**
* 用来实现棋盘的按钮
*/
private ChessPoint[][] chPoint = new ChessPoint[15][15];
private Enums.chessState nowPlayer;
/**
* 构造函数
*/
public Battel(CreatWindow window) {
this.creatWindow = window;
this.setIcon(CursorsAndImg.BACK);
this.setSize(540 540);
this.setVisible(true);
GridLayout gridLayout = new GridLayout();
gridLayout.setRows(15);
gridLayout.setColumns(15);
gridLayout.setHgap(0);
gridLayout.setVgap(0);
this.setLayout(gridLayout);
for (int row = 0; row < 15; row++)
for (int col = 0; col < 15; col++) {
chPoint[row][col] = new ChessPoint(Enums.chessState.NONE new Point(
row col));
chPoint[row][col].addMouseListener(this);
this.add(chPoint[row][col]);
}
dirBeginX = new int[] { 0 0 0 1 0 14 };
dirBeginY = new int[] { 0 0 0 0 0 1 };
lineBeginX = new int[] { 0 1 0 1 1 0 };
lineBeginY = new int[] { 1 0 1 0 0 1 };
offsetX = new int[] { 1 0 1 1 -1 -1 };
offsetY = new int[] { 0 1 1 1 1 1 };
propertySet = PropertySet.getPropertySet();
// 初始化当前玩家
nowPlayer = propertySet.getFirst() == SetDatas.BLACK_FIRST ? Enums.chessState.BLACK
: Enums.chessState.WHITE;
}
// 以下为该类的其它非设置获取参数的函数
/**
* 电脑选择一个点下棋
*/
private void chosePoint() {
resetScore();
evaluate();
getMax();
}
/**
* 重新设置各点的分值
*/
private void resetScore() { // 重设分值
for (int row = 0; row < 15; row++)
for (int col = 0; col < 15; col++) {
if (getchessPoint(new Point(row col)).getState() == Enums.chessState.NONE) {
getchessPoint(new Point(row col)).setScore(0);
}
}
}
/**
* 判断并为各点打分
*/
private void evaluate() {
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 236 2008-06-27 23:08 fivegame.classpath
文件 384 2008-06-27 23:08 fivegame.project
文件 8020 2008-06-29 23:20 fivegameclassesdaoBattel.class
文件 699 2008-06-29 08:54 fivegameclassesdaopopinfPopInf.class
文件 1801 2008-06-30 00:26 fivegameclassesdilogSysDilog$1.class
文件 810 2008-06-30 00:26 fivegameclassesdilogSysDilog$2.class
文件 782 2008-06-30 00:26 fivegameclassesdilogSysDilog$3.class
文件 5359 2008-06-30 00:26 fivegameclassesdilogSysDilog.class
文件 446 2008-06-29 08:54 fivegameclassesinisetfinalsSetDatas.class
文件 3649 2008-06-29 22:17 fivegameclassesinisetPropertySet.class
文件 695 2008-06-30 02:13 fivegameclassesviewCreatWindow$1.class
文件 1129 2008-06-30 02:13 fivegameclassesviewCreatWindow$2.class
文件 941 2008-06-30 02:13 fivegameclassesviewCreatWindow$3.class
文件 4461 2008-06-30 02:13 fivegameclassesviewCreatWindow$4.class
文件 4178 2008-06-30 02:13 fivegameclassesviewCreatWindow$5.class
文件 7179 2008-06-30 02:13 fivegameclassesviewCreatWindow.class
文件 1330 2008-06-29 08:54 fivegameclassesvoChessPoint.class
文件 1898 2008-06-30 02:14 fivegameclassesvoCursorsAndImg.class
文件 1056 2008-06-29 08:54 fivegameclassesvoEnums$chessState.class
文件 315 2008-06-29 08:54 fivegameclassesvoEnums.class
文件 3384 2008-06-30 00:18 fivegameclassesvosoundsMusic.class
文件 2746 2008-06-29 23:10 fivegameclassesvosoundsSound.class
文件 112 2008-06-30 02:19 fivegamefive.property
文件 1465 2008-06-30 01:27 fivegamehelp.property
文件 3092 2008-04-25 10:40 fivegameiconask.png
文件 168278 2008-05-10 09:03 fivegameiconack.gif
文件 1235 2008-05-10 09:16 fivegameiconlack.gif
文件 23151 2008-05-10 16:27 fivegameiconoot.gif
文件 341 2008-06-13 21:14 fivegameiconcancel.gif
文件 145 2008-05-10 14:07 fivegameiconcannot.gif
............此处省略53个文件信息
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。
评论列表(条)