当前位置:首页 > 生命游戏-JAVA语言代码-细胞自动机-毕业论文
浙江理工大学本科毕业设计(论文)
public int getGroundLevel() {
return groundLevel;
39
}
// -------------------------get set------------------------- public int getX() { }
return x;
public void setX(int x) { }
this.x = x;
public int getY() { }
return y;
public void setY(int y) { }
this.y = y;
public int getGroundType() { }
return groundType;
public void setGroundType(int groundType) { }
this.groundType = groundType;
生命游戏的计算机模拟以及参数对运行结果的分析
}
public void setOrganisms(List
this.organisms = organisms; public List
return organisms;
public void setPercent(double percent) { }
this.percent = percent; public double getPercent() { }
return percent;
public void setGroundLevel(int groundLevel) { }
this.groundLevel = groundLevel; }
3.环境单元格类
package com.apei.lifegame.model.condition;
import javax.swing.JPanel;
public class GroundPanel extends JPanel{
40
浙江理工大学本科毕业设计(论文)
}
private static final long serialVersionUID = -6915526788758258155L;
private GroundUnit ground;
public GroundPanel() { }
public GroundPanel(int x,int y) { }
public GroundUnit getGround() { }
public void setGround(GroundUnit ground) { }
this.ground = ground; return ground;
ground=new GroundUnit(x,y,0,0); ground=new GroundUnit();
4.色彩获取工具类
package com.apei.lifegame.util;
import java.awt.Color;
public class ColorHelper {
static String[][] colors = {
{
\
\
\
\
\
{ \
41
生命游戏的计算机模拟以及参数对运行结果的分析
{ \
{ \
static String[] playerColors = {\
public static Color getColorFromTypeAndLevel(int type, int level) {
String color = colors[type][level];
String[] num = color.split(\
return new Color(Integer.valueOf(num[0]), Integer.valueOf(num[1]),
Integer.valueOf(num[2]));
}
//获取玩家颜色
public static Color getPlayerColor(int player){ }
// 随即颜色
public static Color getRandomColor() {
return
String[] num = playerColors[player].split(\
return new Color(Integer.valueOf(num[0]), Integer.valueOf(num[1]),
Integer.valueOf(num[2]));
Color.getHSBColor(Float.valueOf(String.valueOf(Math.random())), }
42
}
Float.valueOf(String.valueOf(Math.random())), Float.valueOf(String.valueOf(Math.random())));
共分享92篇相关文档