生命游戏-JAVA语言代码-细胞自动机-毕业论文 联系客服

发布时间 : 星期六 文章生命游戏-JAVA语言代码-细胞自动机-毕业论文更新完毕开始阅读2c24c0c77f1922791688e85b

浙江理工大学本科毕业设计(论文)

public void giveOutPlantByComp() {

double sumComp = this.getSumCompetitiveness(); double sumPlant = this.getSumPlant(); for (Organism organism : organisms) { }

35

}

public void enoughPlant() { }

//System.out.println(\

for (Organism organism : organisms) { }

if (getSumPlantNeed() > percent) {

percent = percent + 1.0 - getSumPlantNeed(); groundType--;

groundLevel = (int) (percent / 0.2);

//System.out.println(organism.getPlantNeeded()); organism.getFood(organism.getPlantNeeded());

}else{ }

percent = percent - getSumPlantNeed(); groundLevel = (int) (percent / 0.2);

organism.getFood(sumPlant

* (organism.getCompetitivenessByGround(this) / sumComp));

生命游戏的计算机模拟以及参数对运行结果的分析

public int findTheWeakest() {

if (organisms.size() > 0) {

int tempIndex = 0;

double minComp = organisms.get(0).getCompetitivenessByGround(this); for (int index = 0; index < organisms.size(); index++) { }

return tempIndex;

if (minComp > organisms.get(index).getCompetitivenessByGround( }

this)) {

public void killweakestUnitlEnough(double foodHad, double foodNeed) { }

double food = organisms.get(findTheWeakest()).beEatedToMeat(); tempKillList.add(organisms.get(findTheWeakest())); if (food + foodHad < foodNeed) { }

killweakestUnitlEnough(food + foodHad, foodNeed);

}

if(groundType!=0){ }

groundType=0; groundLevel = 4; percent=0.9;

tempIndex = index;

} else {

return -1;

36

浙江理工大学本科毕业设计(论文)

// (1+生物竞争力-该地平均竞争)*((草食物量-草食需求)*该生物草食性+(肉食物量-}

}

肉食需求)*该生物肉食性)

public void lineToUnit(String[] str) {

if (str.length == 4) {

this.x = Integer.valueOf(str[0]); this.y = Integer.valueOf(str[1]);

37

public double getScoreByOrganism(Organism organism) {

if (this.getGroundType() == 3) { }

double factor = 0; double avgComp = 0;

if ((double) organisms.size() == 0) {

factor = 1; return 0;

} else { }

avgComp = this.getSumCompetitiveness() / (double) organisms.size(); factor = organism.getCompetitivenessByGround(this) / avgComp;

//System.out.println();

return factor * (getSumPlant() - getSumPlantNeed());

}

生命游戏的计算机模拟以及参数对运行结果的分析

public boolean equals(GroundUnit obj) {

return this.getX() == obj.getX() && this.getY() == obj.getY()

&& this.getGroundType() == obj.getGroundType() && this.getGroundLevel() == obj.getGroundLevel();

38

}

}

this.groundType = Integer.valueOf(str[2]); this.groundLevel = Integer.valueOf(str[3]);

public void nextType() { }

groundType++; if (groundType == 4) { }

groundType = 0;

public void nextLevel() { }

groundLevel++; if (groundLevel == 5) { }

groundLevel = 0;

@Override

public String toString() { }

return \

+ groundLevel;