网站建设资讯

NEWS

网站建设资讯

用java写的扫雷代码,扫雷java程序详细解析

求高手帮忙一个“扫雷”游戏的JAVA的程序代码

import javax.swing.ImageIcon; //程序入口

创新互联公司从2013年开始,是专业互联网技术服务公司,拥有项目做网站、成都做网站网站策划,项目实施与项目整合能力。我们以让每一个梦想脱颖而出为使命,1280元襄城做网站,已为上家服务,为襄城各地企业和个人服务,联系电话:18982081108

public class Block {

String name; //名字,比如"雷"或数字

int aroundMineNumber; //周围雷的数目

ImageIcon mineIcon; //雷的图标

boolean isMine=false; //是否是雷

boolean isMark=false; //是否被标记

boolean isOpen=false; //是否被挖开

public void setName(String name) {

this.name=name;

}

//设置周围的雷数

public void setAroundMineNumber(int n) {

aroundMineNumber=n;

}

//获得周围的雷数

public int getAroundMineNumber() {

return aroundMineNumber;

}

public String getName() {

return name;

}

//判断是否是雷

public boolean isMine() {

return isMine;

}

//设置是否为雷

public void setIsMine(boolean b) {

isMine=b;

}

//设置雷的图标

public void setMineIcon(ImageIcon icon){

mineIcon=icon;

}

//获得雷的图标

public ImageIcon getMineicon(){

return mineIcon;

}

//确定雷是否被挖开

public boolean getIsOpen() {

return isOpen;

}

//设置为已经被挖开

public void setIsOpen(boolean p) {

isOpen=p;

}

//返回此处是否已经被标记

public boolean getIsMark() {

return isMark;

}

//设置此处是否已经被标记

public void setIsMark(boolean m) {

isMark=m;

}

import javax.swing.*;

import java.awt.*;

public class BlockView extends JPanel{

JLabel blockNameOrIcon; //用来显示Block对象的name、number和mineIcon属性

JButton blockCover; //用来遮挡blockNameOrIcon.

CardLayout card; //卡片式布局

BlockView(){

card=new CardLayout();

setLayout(card);

blockNameOrIcon=new JLabel("",JLabel.CENTER);

blockNameOrIcon.setHorizontalTextPosition(AbstractButton.CENTER);

blockNameOrIcon.setVerticalTextPosition(AbstractButton.CENTER);

blockCover=new JButton();

add("cover",blockCover);

add("view",blockNameOrIcon);

}

//给出视觉效果变化

public void giveView(Block block){

// 如果是雷,将对应的图标和文字更改

if(block.isMine){

blockNameOrIcon.setText(block.getName());

blockNameOrIcon.setIcon(block.getMineicon());

}

else {

int n=block.getAroundMineNumber();

if(n=1)

blockNameOrIcon.setText(""+n);

else

blockNameOrIcon.setText(" ");

}

}

public void seeBlockNameOrIcon(){

card.show(this,"view");

validate();

}

public void seeBlockCover(){

card.show(this,"cover");

validate();

}

public JButton getBlockCover(){

return blockCover;

}

}

用java怎么写扫雷程序

首先要写一个UI,也就是操作界面,使用java.swing.*内的东西就可以搞定;

其次写一个hander,也就是具体的按钮响应,UI的初始化(哪里有雷),怎么触发雷和其他的;

一般来说简单的扫雷模型就好了,如果需要更有意思点,可以写一些数据库的操作内容的tool类具体的就是处理历史操作记录,场均数据或多人竞技的特点。

如果你是说你没有设计思路,我可以给你个提示:递归算法是触发扫雷的方法,初始化用随机数来做。

怎么用Java做一个扫雷程序,要原创。。。 做好了给加100

第一个JAVA文件

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

/**

* 显示所有按钮的面板

* @author Administrator

*

*/

public class AllButtonPanel extends JPanel implements ActionListener{

private int row;//行数

private int col;//列数

private int mineCount;//地雷数

private MineButton[][] allButtons;//所有按钮

public AllButtonPanel(int row,int col,int mineCount){

this.row=row;

this.col=col;

this.mineCount=mineCount;

allButtons=new MineButton[row][col];

createButtons();

createMine();

init();

}

private void init(){

this.setLayout(new GridLayout(row,col));

for(int i=0;iallButtons.length;i++){

for(int j=0;jallButtons[i].length;j++){

this.add(allButtons[i][j]);

}

}

}

/**

* 随机布雷的方法

*

*/

private void createMine(){

int n=0;

while(nmineCount){//随机生成mineCount个地雷

int i=(int)(Math.random()*row);

int j=(int)(Math.random()*col);

if(allButtons[i][j].getCountOfSurroundMines()!=-1){

allButtons[i][j].setCountOfSurroundMines(-1);

n++;

}

}

for(int i=0;iallButtons.length;i++){//计算每个位置的周围地雷数

for(int j=0;jallButtons[i].length;j++){

if(allButtons[i][j].getCountOfSurroundMines()!=-1){

allButtons[i][j].setCountOfSurroundMines(getSurroundMineCount(i,j));

}

}

}

}

/**

* 统计(i,j)坐标周围8个位置的地雷数

* @param data

* @param i

* @param j

* @return

*/

private int getSurroundMineCount(int i,int j){

int num=0;//统计周围的雷数

if(i-1=0j-1=0){

num+=(allButtons[i-1][j-1].getCountOfSurroundMines()==-1?1:0);

}

if(i-1=0){

num+=(allButtons[i-1][j].getCountOfSurroundMines()==-1?1:0);

}

if(i-1=0j+1allButtons[0].length){

num+=(allButtons[i-1][j+1].getCountOfSurroundMines()==-1?1:0);

}

if(j-1=0){

num+=(allButtons[i][j-1].getCountOfSurroundMines()==-1?1:0);

}

if(j+1allButtons[0].length){

num+=(allButtons[i][j+1].getCountOfSurroundMines()==-1?1:0);

}

if(i+1allButtons.lengthj-1=0){

num+=(allButtons[i+1][j-1].getCountOfSurroundMines()==-1?1:0);

}

if(i+1allButtons.length){

num+=(allButtons[i+1][j].getCountOfSurroundMines()==-1?1:0);

}

if(i+1allButtons.lengthj+1allButtons[0].length){

num+=(allButtons[i+1][j+1].getCountOfSurroundMines()==-1?1:0);

}

return num;

}

/**

* 生成按钮

*

*/

private void createButtons(){

for(int i=0;iallButtons.length;i++){

for(int j=0;jallButtons[i].length;j++){

allButtons[i][j]=new MineButton(i,j);

allButtons[i][j].setSize(6,6);

allButtons[i][j].addActionListener(this);//添加点击事件监听

allButtons[i][j].addMouseListener(new MouseAdapter(){//添加鼠标右键事件监听

public void mouseClicked(MouseEvent e) {

if(e.getButton()==MouseEvent.BUTTON3){

int remain=Integer.parseInt(CleanMine.remainMine.getText());

JButton b=(JButton)e.getSource();

if(b.getText().equals("")){

remain--;

CleanMine.remainMine.setText(remain+"");

b.setText("");

}else if(b.getText().equals("")){

remain++;

CleanMine.remainMine.setText(remain+"");

b.setText("");

}

}

}

});

}

}

}

public void actionPerformed(ActionEvent e) {//点击事件监听的方法

MineButton b=(MineButton)e.getSource();

int r=b.getRow();

int c=b.getCol();

if(allButtons[r][c].getCountOfSurroundMines()==-1){//如果是地雷

for(int i=0;iallButtons.length;i++){//把所有按钮都显示出来

for(int j=0;jallButtons[i].length;j++){

if(allButtons[i][j].getCountOfSurroundMines()==-1){//如果该位置是地雷

allButtons[i][j].setText("$");

}else if(allButtons[i][j].getCountOfSurroundMines()==0){//如果该位置为空(该位置不是地雷,周围8个位置也没有地雷)

allButtons[i][j].setText("");

allButtons[i][j].setBackground(Color.CYAN);

}else{//如果该位置不是地雷,但周围8个位置中有地雷

allButtons[i][j].setText(allButtons[i][j].getCountOfSurroundMines()+"");

allButtons[i][j].setBackground(Color.CYAN);

}

}

}

}else{//如果不是地雷

showEmpty(r,c);//执行排空操作

}

}

/**

* 排空方法,若(i,j)位置为空,则显示空白。然后依次递归找它周围的8个位置。

* @param data

* @param i

* @param j

*/

private void showEmpty(int i,int j){

MineButton b=allButtons[i][j];

if(b.isCleared()){

return;

}

if(allButtons[i][j].getCountOfSurroundMines()==0){

b.setBackground(Color.CYAN);

b.setCleared(true);

if(i-1=0j-1=0){

showEmpty(i-1,j-1);

}

if(i-1=0){

showEmpty(i-1,j);

}

if(i-1=0j+1allButtons[0].length){

showEmpty(i-1,j+1);

}

if(j-1=0){

showEmpty(i,j-1);

}

if(j+1allButtons[0].length){

showEmpty(i,j+1);

}

if(i+1allButtons.lengthj-1=0){

showEmpty(i+1,j-1);

}

if(i+1allButtons.length){

showEmpty(i+1,j);

}

if(i+1allButtons.lengthj+1allButtons[0].length){

showEmpty(i+1,j+1);

}

}else if(allButtons[i][j].getCountOfSurroundMines()0){

b.setText(allButtons[i][j].getCountOfSurroundMines()+"");

b.setBackground(Color.CYAN);

b.setCleared(true);

}

}

}

第二个JAVA文件

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

/**

* 扫雷游戏主界面

* @author tony.tang

*

*/

public class CleanMine extends JFrame implements ActionListener{

private JLabel text1,text2;

public static JLabel remainMine;//剩余地雷数

private JLabel time;//消耗时间

private JButton reset;//重新开始

private JPanel center;

private int row,col,mine;

public CleanMine(){

text1=new JLabel("剩余地雷:");

text2=new JLabel("消耗时间:");

remainMine=new JLabel("10");

time=new JLabel("0");

reset=new JButton("重新开始");

reset.addActionListener(this);

JMenuBar bar=new JMenuBar();

JMenu game=new JMenu("游戏");

JMenu help=new JMenu("帮助");

JMenuItem item;

game.add(item=new JMenuItem("开局"));item.addActionListener(this);

game.addSeparator();

ButtonGroup bg=new ButtonGroup();

game.add(item=new JCheckBoxMenuItem("初级",true));bg.add(item);item.addActionListener(this);

game.add(item=new JCheckBoxMenuItem("中级"));bg.add(item);item.addActionListener(this);

game.add(item=new JCheckBoxMenuItem("高级"));bg.add(item);item.addActionListener(this);

game.add(item=new JCheckBoxMenuItem("自定义..."));bg.add(item);item.addActionListener(this);

game.addSeparator();

game.add(item=new JMenuItem("退出"));item.addActionListener(this);

help.add(item=new JMenuItem("查看帮助"));item.addActionListener(this);

help.add(item=new JMenuItem("关于扫雷..."));item.addActionListener(this);

bar.add(game);

bar.add(help);

this.setJMenuBar(bar);

init();

}

private void init(){

JPanel north=new JPanel();

north.add(text1);

north.add(remainMine);

north.add(reset);

north.add(text2);

north.add(time);

this.add(north,BorderLayout.NORTH);

this.row=9;

this.col=9;

this.mine=10;

restart();

this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

new Thread(){

public void run(){

while(Integer.parseInt(remainMine.getText())0){

try {

Thread.sleep(1000);

} catch (InterruptedException e) {

e.printStackTrace();

}

time.setText((Integer.parseInt(time.getText())+1)+"");

}

}

}.start();

}

public void actionPerformed(ActionEvent e) {

if(e.getActionCommand().equals("初级")){

this.row=9;

this.col=9;

this.mine=10;

restart();

return;

}

if(e.getActionCommand().equals("中级")){

this.row=16;

this.col=16;

this.mine=40;

restart();

return;

}

if(e.getActionCommand().equals("高级")){

this.row=16;

this.col=30;

this.mine=99;

restart();

return;

}

if(e.getActionCommand().equals("重新开始")){

restart();

return;

}

}

private void restart(){

if(center!=null){

this.remove(center);

}

center=new AllButtonPanel(row,col,mine);

this.add(center,BorderLayout.CENTER);

this.remainMine.setText(mine+"");

this.time.setText("0");

this.setSize(col*30,row*30+10);

this.setResizable(false);

this.setVisible(true);

}

/**

* @param args

*/

public static void main(String[] args) {

new CleanMine();

}

}

第三个JAVA文件.

import javax.swing.JButton;

import java.awt.*;

public class MineButton extends JButton {

private int row;

private int col;

private boolean cleared=false;

private int countOfSurroundMines;//周围地雷数,如果本按钮是雷,则为-1;

public MineButton(int row,int col){

this.row=row;

this.col=col;

this.setMargin(new Insets(0,0,0,0));

}

public int getCol() {

return col;

}

public int getRow() {

return row;

}

public boolean isCleared() {

return cleared;

}

public void setCleared(boolean cleared) {

this.cleared = cleared;

}

public int getCountOfSurroundMines() {

return countOfSurroundMines;

}

public void setCountOfSurroundMines(int countOfSurroundMines) {

this.countOfSurroundMines = countOfSurroundMines;

}

}

全部编译以后就可以执行了

运行在Eclipse环境下的java扫雷游戏的初级代码是什么?

import java.awt.Button;\x0d\x0aimport java.util.Set;\x0d\x0a// 每一个小方块类\x0d\x0apublic class Diamond extends Button {\x0d\x0aprivate Diamond[] diamonds;\x0d\x0a\x0d\x0a// 该小方块周围的八个方向上的小方块\x0d\x0aprivate Diamond east;\x0d\x0aprivate Diamond north;\x0d\x0aprivate Diamond northEast;\x0d\x0aprivate Diamond northWest;\x0d\x0aprivate Diamond south;\x0d\x0aprivate Diamond southEast;\x0d\x0aprivate Diamond southWest;\x0d\x0aprivate Diamond west;\x0d\x0a\x0d\x0aprivate boolean isBomb;// 是否是雷\x0d\x0aprivate boolean isChange;// 又没有被翻过\x0d\x0aprivate int no;// 产生的方块的编号\x0d\x0a\x0d\x0a// 持有所有小方块的引用,方便进行操作\x0d\x0apublic Diamond(Diamond[] diamonds) {\x0d\x0athis.diamonds = diamonds;\x0d\x0a}\x0d\x0a\x0d\x0a// 按键时方块发生改变\x0d\x0apublic boolean change() {\x0d\x0athis.isChange = true;// 说明已经翻过了\x0d\x0aif(isBomb) {// 触雷\x0d\x0a//this.setBackground(Color.red);\x0d\x0areturn true;\x0d\x0a} else {// 不是雷,就显示周围雷的数目\x0d\x0a//this.setLabel(this.getNearBombNo() + "");\x0d\x0athis.setLabel(this.getNearBombNo() + "");\x0d\x0a//if(this.getNearBombNo() == 0) {\x0d\x0a//this.moveon();\x0d\x0a//}\x0d\x0areturn false;\x0d\x0a}\x0d\x0a}\x0d\x0a\x0d\x0a// 获得该小方块周围雷的数量\x0d\x0apublic int getNearBombNo() {\x0d\x0aint no = 0;\x0d\x0aif(this.northWest != null this.northWest.isBomb) no++;\x0d\x0aif(this.north != null this.north.isBomb) no++;\x0d\x0aif(this.northEast != null this.northEast.isBomb) no++;\x0d\x0aif(this.east != null this.east.isBomb) no++;\x0d\x0aif(this.southEast != null this.southEast.isBomb) no++;\x0d\x0aif(this.south != null this.south.isBomb) no++;\x0d\x0aif(this.southWest != null this.southWest.isBomb) no++;\x0d\x0aif(this.west != null this.west.isBomb) no++;\x0d\x0a\x0d\x0areturn no;\x0d\x0a}\x0d\x0a\x0d\x0a// 获得该小方块周围的小方块\x0d\x0apublic Diamond getNearDimaond(int i) {\x0d\x0aint index = -1;\x0d\x0aswitch (i) {\x0d\x0acase 1:// 1表示西北,2,表示北,以此类推\x0d\x0aindex = no - 10;\x0d\x0aif(index return null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 2:\x0d\x0aindex = no - 9;\x0d\x0aif(index return null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 3:\x0d\x0aindex = no - 8;\x0d\x0aif(index return null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 4:\x0d\x0aindex = no + 1;\x0d\x0aif(no == 9 || no == 18 || no == 27 || no == 36 || no == 45 || no == 54 || no == 63 || no == 72 || no == 81) {\x0d\x0areturn null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 5:\x0d\x0aindex = no + 10;\x0d\x0aif(index = 81 ||no == 9 || no == 18 || no == 27 || no == 36 || no == 45 || no == 54 || no == 63 || no == 72 || no == 81) {\x0d\x0areturn null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 6:\x0d\x0aindex = no + 9;\x0d\x0aif(index 81) {\x0d\x0areturn null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 7:\x0d\x0aindex = no + 8;\x0d\x0aif(index = 81 || no==1 || no == 10 || no == 19 || no == 28 || no == 37 || no == 46 || no == 55 || no == 64 || no == 73) {\x0d\x0areturn null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0acase 8:\x0d\x0aindex = no - 1;\x0d\x0aif(no==1 || no==10 || no == 19 || no == 28 || no == 37 || no == 46 || no == 55 || no == 64 || no == 73) {\x0d\x0areturn null;\x0d\x0a} else {\x0d\x0areturn diamonds[index];\x0d\x0a}\x0d\x0a}\x0d\x0areturn null;\x0d\x0a}\x0d\x0a\x0d\x0a// 递归,set是用来装已经翻过的小方块的,不然会死循环,为什么用set,因为set是不重复的\x0d\x0apublic void moveon(Set set) {\x0d\x0a\x0d\x0aset.add(this);// 先把自己加上\x0d\x0aif(this.getNorthWest() != null this.getNorthWest().isBomb == false) {\x0d\x0athis.getNorthWest().change();\x0d\x0a\x0d\x0aif(this.getNorthWest().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getNorthWest()) == false)\x0d\x0athis.getNorthWest().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getNorthWest());\x0d\x0a}\x0d\x0a\x0d\x0aif(this.getNorth() != null this.getNorth().isBomb == false) {\x0d\x0athis.getNorth().change();\x0d\x0aif(this.getNorth().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getNorth()) == false)\x0d\x0athis.getNorth().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getNorth());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getNorthEast() != null this.getNorthEast().isBomb == false) {\x0d\x0athis.getNorthEast().change();\x0d\x0aif(this.getNorthEast().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getNorthEast()) == false)\x0d\x0athis.getNorthEast().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getNorthEast());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getEast() != null this.getEast().isBomb == false) {\x0d\x0athis.getEast().change();\x0d\x0aif(this.getEast().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getEast()) == false)\x0d\x0athis.getEast().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getEast());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getSouthEast() != null this.getSouthEast().isBomb == false) {\x0d\x0athis.getSouthEast().change();\x0d\x0aif(this.getSouthEast().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getSouthEast()) == false)\x0d\x0athis.getSouthEast().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getSouthEast());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getSouth() != null this.getSouth().isBomb == false) {\x0d\x0athis.getSouth().change();\x0d\x0aif(this.getSouth().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getSouth()) == false)\x0d\x0athis.getSouth().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getSouth());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getSouthWest() != null this.getSouthWest().isBomb == false) {\x0d\x0athis.getSouthWest().change();\x0d\x0aif(this.getSouthWest().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getSouthWest()) == false)\x0d\x0athis.getSouthWest().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getSouthWest());\x0d\x0a} \x0d\x0a\x0d\x0aif(this.getWest() != null this.getWest().isBomb == false) {\x0d\x0athis.getWest().change();\x0d\x0aif(this.getWest().getNearBombNo() == 0) {\x0d\x0aif(set.contains(this.getWest()) == false)\x0d\x0athis.getWest().moveon(set);\x0d\x0a}\x0d\x0a\x0d\x0aset.add(this.getWest());\x0d\x0a} \x0d\x0a}\x0d\x0a\x0d\x0a/*public Diamond[] getDiamonds() {\x0d\x0areturn diamonds;\x0d\x0a}*/\x0d\x0a\x0d\x0apublic Diamond getEast() {\x0d\x0areturn east;\x0d\x0a}\x0d\x0a\x0d\x0apublic int getNo() {\x0d\x0areturn no;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getNorth() {\x0d\x0areturn north;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getNorthEast() {\x0d\x0areturn northEast;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getNorthWest() {\x0d\x0areturn northWest;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getSouth() {\x0d\x0areturn south;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getSouthEast() {\x0d\x0areturn southEast;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getSouthWest() {\x0d\x0areturn southWest;\x0d\x0a}\x0d\x0a\x0d\x0apublic Diamond getWest() {\x0d\x0areturn west;\x0d\x0a}\x0d\x0a\x0d\x0apublic boolean isBomb() {\x0d\x0areturn isBomb;\x0d\x0a}\x0d\x0a\x0d\x0apublic boolean isChange() {\x0d\x0areturn isChange;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setBomb(boolean isBomb) {\x0d\x0athis.isBomb = isBomb;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setChange(boolean isChange) {\x0d\x0athis.isChange = isChange;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setDiamonds(Diamond[] diamonds) {\x0d\x0athis.diamonds = diamonds;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setEast(Diamond east) {\x0d\x0athis.east = east;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setNo(int no) {\x0d\x0athis.no = no;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setNorth(Diamond north) {\x0d\x0athis.north = north;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setNorthEast(Diamond northEast) {\x0d\x0athis.northEast = northEast;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setNorthWest(Diamond northWest) {\x0d\x0athis.northWest = northWest;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setSouth(Diamond south) {\x0d\x0athis.south = south;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setSouthEast(Diamond southEast) {\x0d\x0athis.southEast = southEast;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setSouthWest(Diamond southWest) {\x0d\x0athis.southWest = southWest;\x0d\x0a}\x0d\x0a\x0d\x0apublic void setWest(Diamond west) {\x0d\x0athis.west = west;\x0d\x0a}\x0d\x0a\x0d\x0a}


分享文章:用java写的扫雷代码,扫雷java程序详细解析
URL分享:http://cdweb.net/article/dsigdpg.html