资源简介
这是一份很好的资料可供大家享用双人玩的Java五子棋游戏,非常使用的一个程序哦

代码片段和文件信息
//Author: ^-^ Veerle ^-^
//Download by http://www.codefans.net
public class objCellMatrix
{
private int[][] pieceMatrix = new int[8][8]; //Stores which piece is in a cell. 0 empty 1 red 2 blue
private int winningNumber = 0;
public void objCellMatrix ()
{
}
public void resetMatrix ()
{
for (int row = 0; row < 8; row++)
{
for (int column = 0; column < 8; column++)
{
if (row <= 2 || row >= 5) //row 012 or 567
{
pieceMatrix[row][column] = 0;
}
else
{
if (column <= 2 || column >= 5) //column 012 or 567
{
pieceMatrix[row][column] = 0;
}
else
{
if ((row == 3 && column == 3) || (row == 4 && column == 4)) //NW and SE of middle
{
pieceMatrix[row][column] = 2;
}
else
{
pieceMatrix[row][column] = 1;
}
}
}
}
}
}
public int getPieceCell (int row int column)
{
return pieceMatrix[row][column];
}
public void setPieceCell (int row int column int piece)
{
pieceMatrix[row][column] = piece;
}
public String calculateWinner (String[] strPlayerName)
{
int red = 0;
int blue = 0;
int currentCell = 0;
for (int row = 0; row < 8; row++)
{
for (int column = 0; column < 8; column++)
{
currentCell = pieceMatrix[row][column];
if (currentCell == 0)
{
continue;
}
else if (currentCell == 1)
{
red++;
}
else
{
blue++;
}
}
}
if (red > blue)
{
return strPlayerName[0] + “ has won with a score of “ + red + “. “ + strPlayerName[1] + “ got “ + blue;
}
else if (blue > red)
{
return strPlayerName[1] + “ has won with a score of “ + blue + “. “ + strPlayerName[0] + “ got “ + red;
}
else
{
return “this game was a draw with both players getting a score of “ + blue;
}
}
}
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 173 2005-09-02 09:34 双人玩的Java五子棋游戏\coinBlue.gif
文件 173 2005-09-02 09:34 双人玩的Java五子棋游戏\coinRed.gif
文件 724 2009-12-04 09:56 双人玩的Java五子棋游戏\main_from.gif
文件 212 2010-03-26 10:01 双人玩的Java五子棋游戏\manifest.txt
文件 2028 2009-01-23 13:56 双人玩的Java五子棋游戏\objCellMatrix.java
文件 1242 2009-01-23 13:56 双人玩的Java五子棋游戏\objChessBoard.java
文件 1722 2009-01-23 13:56 双人玩的Java五子棋游戏\objCreateap
文件 11812 2009-01-23 13:56 双人玩的Java五子棋游戏\objMoveCheck.java
文件 10661 2005-09-17 21:39 双人玩的Java五子棋游戏\othello.jar
文件 5171 2009-01-23 13:56 双人玩的Java五子棋游戏\othello.java
文件 161 2005-09-17 21:36 双人玩的Java五子棋游戏\tile.gif
文件 6142 2009-01-23 13:56 双人玩的Java五子棋游戏\windowOthelloBoard.java
文件 694 2009-11-16 16:37 双人玩的Java五子棋游戏\使 用 说 明.txt
目录 0 2010-03-26 09:32 双人玩的Java五子棋游戏
----------- --------- ---------- ----- ----
40915 14
相关资源
- java串口通信全套完整代码-导入eclip
- jsonarray所必需的6个jar包.rar
- 三角网构TIN生成算法,Java语言实现
- java代码编写将excel数据导入到mysql数据
- Java写的cmm词法分析器源代码及javacc学
- JAVA JSP公司财务管理系统 源代码 论文
- JSP+MYSQL旅行社管理信息系统
- 推荐算法的JAVA实现
- 基于Java的酒店管理系统源码(毕业设
- java-图片识别 图片比较
- android毕业设计
- java23种设计模式+23个实例demo
- java Socket发送/接受报文
- JAVA828436
- java界面美化 提供多套皮肤直接使用
- 在线聊天系统(java代码)
- 基于Java的图书管理系统807185
- java中实现将页面数据导入Excel中
- java 企业销售管理系统
- java做的聊天系统(包括正规课程设计
- Java编写的qq聊天室
- 商店商品管理系统 JAVA写的 有界面
- JAVA开发聊天室程序
- 在linux系统下用java执行系统命令实例
- java期末考试试题两套(答案) 选择(
- JAVA3D编程示例(建模、交互)
- Java 文件加密传输
- java做的房产管理系统
- 基于jsp的bbs论坛 非常详细
- [免费]java实现有障碍物的贪吃蛇游戏
评论
共有 条评论