您的位置:

java扫雷,Java扫雷脚本

本文目录一览:

java扫雷游戏代码

import java.awt.*;

import java.awt.event.*;

import javax.swing.*;

public class Frame

extends JFrame {

JTextField text;

JLabel nowBomb, setBomb;

int BombNum, BlockNum; // 当前雷数,当前方块数

int rightBomb, restBomb, restBlock; // 找到的地雷数,剩余雷数,剩余方块数

JButton start = new JButton(" 开始 ");

JPanel MenuPamel = new JPanel();

JPanel bombPanel = new JPanel();

Bomb[][] bombButton;

JPanel c;

BorderLayout borderLayout1 = new BorderLayout();

GridLayout gridLayout1 = new GridLayout();

public Frame() {

try {

setDefaultCloseOperation(EXIT_ON_CLOSE);

jbInit();

}

catch (Exception exception) {

exception.printStackTrace();

}

}

private void jbInit() throws Exception {

c = (JPanel) getContentPane();

setTitle("扫雷");

c.setBackground(Color.WHITE);

MenuPamel.setBackground(Color.GRAY);

c.setLayout(borderLayout1);

setSize(new Dimension(600, 600));

setResizable(false);

BlockNum = 144;

BombNum = 10;

text = new JTextField("10 ", 3);

nowBomb = new JLabel("当前雷数" + ":" + BombNum);

setBomb = new JLabel("设置地雷数");

start.addActionListener(new Frame1_start_actionAdapter(this));

MenuPamel.add(setBomb);

MenuPamel.add(text);

MenuPamel.add(start);

MenuPamel.add(nowBomb);

c.add(MenuPamel, java.awt.BorderLayout.SOUTH);

bombPanel.setLayout(gridLayout1);

gridLayout1.setColumns( (int) Math.sqrt(BlockNum));

gridLayout1.setRows( (int) Math.sqrt(BlockNum));

bombButton = new Bomb[ (int) Math.sqrt(BlockNum)][ (int) Math.sqrt(BlockNum)];

for (int i = 0; i (int) Math.sqrt(BlockNum); i++) {

for (int j = 0; j (int) Math.sqrt(BlockNum); j++) {

bombButton[i][j] = new Bomb(i, j);

//bombButton[i][j].setSize(10, 10);

bombButton[i][j].setFont(new Font("", Font.PLAIN, 14));//设置字体大小

bombButton[i][j].setForeground(Color.white);

bombButton[i][j].addMouseListener(new Bomb_mouseAdapter(this));

bombButton[i][j].addActionListener(new Bomb_actionAdapter(this));

bombPanel.add(bombButton[i][j]);

}

}

c.add(bombPanel, java.awt.BorderLayout.CENTER);

startBomb();

}

/* 开始按钮 */

public void start_actionPerformed(ActionEvent e) {

int num=Integer.parseInt(text.getText().trim());

if (num = 5 num 50) {

BombNum = num;

startBomb();

}

else if (num 5) {

JOptionPane.showMessageDialog(null, "您设置的地雷数太少了,请重设!", "错误",

JOptionPane.ERROR_MESSAGE);

num=10;

BombNum = num;

}

else {

JOptionPane.showMessageDialog(null, "您设置的地雷数太多了,请重设!", "错误",

JOptionPane.ERROR_MESSAGE);

num=10;

BombNum = num;

}

}

/* 开始,布雷 */

public void startBomb() {

nowBomb.setText("当前雷数" + ":" + BombNum);

for (int i = 0; i (int) Math.sqrt(BlockNum); i++) {

for (int j = 0; j (int) Math.sqrt(BlockNum); j++) {

bombButton[i][j].isBomb = false;

bombButton[i][j].isClicked = false;

bombButton[i][j].isRight = false;

bombButton[i][j].BombFlag = 0;

bombButton[i][j].BombRoundCount = 9;

bombButton[i][j].setEnabled(true);

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

bombButton[i][j].setFont(new Font("", Font.PLAIN, 14));//设置字体大小

bombButton[i][j].setForeground(Color.BLUE);

rightBomb = 0;

restBomb = BombNum;

restBlock = BlockNum - BombNum;

}

}

for (int i = 0; i BombNum; ) {

int x = (int) (Math.random() * (int) (Math.sqrt(BlockNum) - 1));

int y = (int) (Math.random() * (int) (Math.sqrt(BlockNum) - 1));

if (bombButton[x][y].isBomb != true) {

bombButton[x][y].isBomb = true;

i++;

}

}

CountRoundBomb();

}

/* 计算方块周围雷数 */

public void CountRoundBomb() {

for (int i = 0; i (int) Math.sqrt(BlockNum); i++) {

for (int j = 0; j (int) Math.sqrt(BlockNum); j++) {

int count = 0;

// 当需要检测的单元格本身无地雷的情况下,统计周围的地雷个数

if (bombButton[i][j].isBomb != true) {

for (int x = i - 1; x i + 2; x++) {

for (int y = j - 1; y j + 2; y++) {

if ( (x = 0) (y = 0)

(x ( (int) Math.sqrt(BlockNum)))

(y ( (int) Math.sqrt(BlockNum)))) {

if (bombButton[x][y].isBomb == true) {

count++;

}

}

}

}

bombButton[i][j].BombRoundCount = count;

}

}

}

}

/* 是否挖完了所有的雷 */

public void isWin() {

restBlock = BlockNum - BombNum;

for (int i = 0; i (int) Math.sqrt(BlockNum); i++) {

for (int j = 0; j (int) Math.sqrt(BlockNum); j++) {

if (bombButton[i][j].isClicked == true) {

restBlock--;

}

}

}

if (rightBomb == BombNum || restBlock == 0) {

JOptionPane.showMessageDialog(this, "您挖完了所有的雷,您胜利了!", "胜利",

JOptionPane.INFORMATION_MESSAGE);

startBomb();

}

}

/** 当选中的位置为空,则翻开周围的地图* */

public void isNull(Bomb ClickedButton) {

int i, j;

i = ClickedButton.num_x;

j = ClickedButton.num_y;

for (int x = i - 1; x i + 2; x++) {

for (int y = j - 1; y j + 2; y++) {

if ( ( (x != i) || (y != j)) (x = 0) (y = 0)

(x ( (int) Math.sqrt(BlockNum)))

(y ( (int) Math.sqrt(BlockNum)))) {

if (bombButton[x][y].isBomb == false

bombButton[x][y].isClicked == false

bombButton[x][y].isRight == false) {

turn(bombButton[x][y]);

}

}

}

}

}

/* 翻开 */

public void turn(Bomb ClickedButton) {

ClickedButton.setEnabled(false);

ClickedButton.isClicked = true;

if (ClickedButton.BombRoundCount 0) {

ClickedButton.setText(ClickedButton.BombRoundCount + "");

}

else {

isNull(ClickedButton);

}

}

/* 左键点击 */

public void actionPerformed(ActionEvent e) {

if ( ( (Bomb) e.getSource()).isClicked == false

( (Bomb) e.getSource()).isRight == false) {

if ( ( (Bomb) e.getSource()).isBomb == false) {

turn( ( (Bomb) e.getSource()));

isWin();

}

else {

for (int i = 0; i (int) Math.sqrt(BlockNum); i++) {

for (int j = 0; j (int) Math.sqrt(BlockNum); j++) {

if (bombButton[i][j].isBomb == true) {

bombButton[i][j].setText("b");

}

}

}

( (Bomb) e.getSource()).setForeground(Color.RED);

( (Bomb) e.getSource()).setFont(new Font("", Font.BOLD, 20));

( (Bomb) e.getSource()).setText("X");

JOptionPane.showMessageDialog(this, "你踩到地雷了,按确定重来", "踩到地雷", 2);

startBomb();

}

}

}

/* 右键点击 */

public void mouseClicked(MouseEvent e) {

Bomb bombSource = (Bomb) e.getSource();

boolean right = SwingUtilities.isRightMouseButton(e);

if ( (right == true) (bombSource.isClicked == false)) {

bombSource.BombFlag = (bombSource.BombFlag + 1) % 3;

if (bombSource.BombFlag == 1) {

if (restBomb 0) {

bombSource.setForeground(Color.RED);

bombSource.setText("F");

bombSource.isRight = true;

restBomb--;

}

else {

bombSource.BombFlag = 0;

}

}

else if (bombSource.BombFlag == 2) {

restBomb++;

bombSource.setText("Q");

bombSource.isRight = false;

}

else {

bombSource.setText("");

}

if (bombSource.isBomb == true) {

if (bombSource.BombFlag == 1) {

rightBomb++;

}

else if (bombSource.BombFlag == 2) {

rightBomb--;

}

}

nowBomb.setText("当前雷数" + ":" + restBomb);

isWin();

}

}

public static void main(String[] args) {

Frame frame = new Frame();

frame.setVisible(true);

}

}

class Frame1_start_actionAdapter

implements ActionListener {

private Frame adaptee;

Frame1_start_actionAdapter(Frame adaptee) {

this.adaptee = adaptee;

}

public void actionPerformed(ActionEvent e) {

adaptee.start_actionPerformed(e);

}

}

////////////////////////////

class Bomb

extends JButton {

int num_x, num_y; // 第几号方块

int BombRoundCount; // 周围雷数

boolean isBomb; // 是否为雷

boolean isClicked; // 是否被点击

int BombFlag; // 探雷标记

boolean isRight; // 是否点击右键

public Bomb(int x, int y) {

num_x = x;

num_y = y;

BombFlag = 0;

BombRoundCount = 9;

isBomb = false;

isClicked = false;

isRight = false;

}

}

class Bomb_actionAdapter

implements ActionListener {

private Frame adaptee;

Bomb_actionAdapter(Frame adaptee) {

this.adaptee = adaptee;

}

public void actionPerformed(ActionEvent e) {

adaptee.actionPerformed(e);

}

}

class Bomb_mouseAdapter

extends MouseAdapter {

private Frame adaptee;

Bomb_mouseAdapter(Frame adaptee) {

this.adaptee = adaptee;

}

public void mouseClicked(MouseEvent e) {

adaptee.mouseClicked(e);

}

}

java扫雷递归算法

根据规则,应该有个 “打开没有空白方格时递归打开周围空白或数字方格” 的方法;

还要有个 “点击数字方格时,判断周围8个方格标记地雷数量与数字是否相同,相同打开未标记地雷的方块” 的方法。

方格类的思路应该是

class fangGe{

//标记是数字空白还是地雷

int type;

void daKai (){

//判断是否已经打开

//判断类型

//如果是空白 循环周围8个方格 调用其打开方法

//如果是数字,打开自己

//如果是地雷GameOver

}

}

只写了问题相关的,希望对你有帮助。

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

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

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做扫雷。有几个问题没想到怎么做。 1.每个方块,怎么判定周围八

没做过,就是说点啥想法。

是不是可以用二维数组来定义每个格子,这样判断周围8个格子的时候就可以[i][j]

i和j+-1来查看有没有雷,雷也可以存在一个二维数组里,有雷存1,没雷存0,你再把它也保存起来,存档的话可以添加一个初始化判断,有存档就调出二维数组,去布局显示。^^

运行在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}